@@ -1505,7 +1505,7 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
15051505 # 2(x) ==> (* 2 x)
15061506 return
15071507 end
1508- is_macrocall_on_entry = is_macrocall
1508+ processing_macro_name = is_macrocall
15091509 # source range of the @-prefixed part of a macro
15101510 macro_atname_range = nothing
15111511 # $A.@x ==> (macrocall (. ($ A) (macro_name x)))
@@ -1534,7 +1534,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
15341534 # A.@var"#" a ==> (macrocall (. A (macro_name (var #))) a)
15351535 # @+x y ==> (macrocall (macro_name +) x y)
15361536 # [email protected] ==> (macrocall (. A (macro_name .)) x) 1537- is_macrocall_on_entry && emit (ps, mark, K " macro_name" )
1537+ processing_macro_name && emit (ps, mark, K " macro_name" )
1538+ processing_macro_name = false
15381539 let ps = with_space_sensitive (ps)
15391540 # Space separated macro arguments
15401541 # A.@foo a b ==> (macrocall (. A (macro_name foo)) a b)
@@ -1567,7 +1568,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
15671568 # f(a; b; c) ==> (call f a (parameters b) (parameters c))
15681569 # (a=1)() ==> (call (parens (= a 1)))
15691570 # f (a) ==> (call f (error-t) a)
1570- is_macrocall_on_entry && emit (ps, mark, K " macro_name" )
1571+ processing_macro_name && emit (ps, mark, K " macro_name" )
1572+ processing_macro_name = false
15711573 bump_disallowed_space (ps)
15721574 bump (ps, TRIVIA_FLAG)
15731575 opts = parse_call_arglist (ps, K " )" )
@@ -1588,7 +1590,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
15881590 macro_atname_range = nothing
15891591 end
15901592 elseif k == K " ["
1591- is_macrocall_on_entry && emit (ps, mark, K " macro_name" )
1593+ processing_macro_name && emit (ps, mark, K " macro_name" )
1594+ processing_macro_name = false
15921595 m = position (ps)
15931596 # a [i] ==> (ref a (error-t) i)
15941597 bump_disallowed_space (ps)
@@ -1642,22 +1645,22 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
16421645 # Allow `@` in macrocall only in first and last position
16431646 # A.B.@x ==> (macrocall (. (. A B) (macro_name x)))
16441647 # @A.B.x ==> (macrocall (macro_name (. (. A B) x)))
1645- # [email protected] ==> (macrocall (. (. A B (error-t)) (macro_name x ))) 1648+ # [email protected] ==> (macrocall (macro_name ( . (. A B (error-t)))) 16461649 emit_diagnostic (ps, macro_atname_range... ,
16471650 error= " `@` must appear on first or last macro name component" )
16481651 bump (ps, TRIVIA_FLAG, error= " Unexpected `.` after macro name" )
16491652 # Recover by treating the `@` as if it had been on the wole thing
16501653 reset_node! (ps, macro_atname_range[2 ], kind= K " TOMBSTONE" )
1651- is_macrocall_on_entry = true
1654+ processing_macro_name = true
16521655 else
16531656 bump (ps, TRIVIA_FLAG)
16541657 end
16551658 k = peek (ps)
16561659 if k == K " ("
16571660 if is_macrocall
1658- is_macrocall_on_entry && emit (ps, mark, K " macro_name" )
1661+ processing_macro_name && emit (ps, mark, K " macro_name" )
16591662 # Recover by pretending we do have the syntax
1660- is_macrocall_on_entry = false
1663+ processing_macro_name = false
16611664 # @M.(x) ==> (macrocall (dotcall (macro_name M) (error-t) x))
16621665 bump_invisible (ps, K " error" , TRIVIA_FLAG)
16631666 emit_diagnostic (ps, mark,
@@ -1731,7 +1734,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
17311734 bump (ps, remap_kind= K " Identifier" )
17321735 emit (ps, mark, K " call" , POSTFIX_OP_FLAG)
17331736 elseif k == K " {"
1734- is_macrocall_on_entry && emit (ps, mark, K " macro_name" )
1737+ processing_macro_name && emit (ps, mark, K " macro_name" )
1738+ processing_macro_name = false
17351739 # Type parameter curlies and macro calls
17361740 m = position (ps)
17371741 # S {a} ==> (curly S (error-t) a)
0 commit comments