Skip to content

Commit

Permalink
Merge pull request #79 from tgehr/unpacking-extern-scope-fix
Browse files Browse the repository at this point in the history
Parse extern (a, b) = ...; and scope (a, b) = ...;.
  • Loading branch information
adamdruppe authored Oct 11, 2024
2 parents a8b2a88 + 3af1106 commit fb70ba6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions compiler/src/dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
}
case TOK.extern_:
{
if (peekNext() != TOK.leftParenthesis)
Token* next = peek(&token);
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
{
stc = STC.extern_;
goto Lstc;
Expand Down Expand Up @@ -4520,7 +4521,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer

case TOK.extern_:
{
if (peekNext() != TOK.leftParenthesis)
Token* next = peek(&token);
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
{
stc = STC.extern_;
goto L1;
Expand Down Expand Up @@ -6468,7 +6470,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
goto Lerror;

case TOK.scope_:
if (peekNext() != TOK.leftParenthesis)
auto next = peek(&token);
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
goto Ldeclaration; // scope used as storage class
nextToken();
check(TOK.leftParenthesis);
Expand Down

0 comments on commit fb70ba6

Please sign in to comment.