Skip to content

Commit fb70ba6

Browse files
authored
Merge pull request #79 from tgehr/unpacking-extern-scope-fix
Parse extern (a, b) = ...; and scope (a, b) = ...;.
2 parents a8b2a88 + 3af1106 commit fb70ba6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/src/dmd/parse.d

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
804804
}
805805
case TOK.extern_:
806806
{
807-
if (peekNext() != TOK.leftParenthesis)
807+
Token* next = peek(&token);
808+
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
808809
{
809810
stc = STC.extern_;
810811
goto Lstc;
@@ -4520,7 +4521,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
45204521

45214522
case TOK.extern_:
45224523
{
4523-
if (peekNext() != TOK.leftParenthesis)
4524+
Token* next = peek(&token);
4525+
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
45244526
{
45254527
stc = STC.extern_;
45264528
goto L1;
@@ -6468,7 +6470,8 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
64686470
goto Lerror;
64696471

64706472
case TOK.scope_:
6471-
if (peekNext() != TOK.leftParenthesis)
6473+
auto next = peek(&token);
6474+
if (next.value != TOK.leftParenthesis || peekPastParen(next).value == TOK.assign)
64726475
goto Ldeclaration; // scope used as storage class
64736476
nextToken();
64746477
check(TOK.leftParenthesis);

0 commit comments

Comments
 (0)