@@ -3251,21 +3251,21 @@ function expand_macro_def(ctx, ex)
32513251 name = sig[1 ]
32523252 args = remove_empty_parameters (children (sig))
32533253 @chk kind (args[end ]) != K " parameters" (args[end ], " macros cannot accept keyword arguments" )
3254+ scope_ref = kind (name) == K " ." ? name[1 ] : name
32543255 if ctx. expr_compat_mode
32553256 @ast ctx ex [K " function"
32563257 [K " call" (sig)
32573258 _make_macro_name (ctx, name)
32583259 [K " ::"
3259- adopt_scope ( @ast (ctx, sig, " __source__ " :: K"Identifier" ),
3260- kind (name) == K " . " ? name[ 1 ] : name )
3260+ # TODO : should we be adopting the scope of the K"macro" expression itself?
3261+ adopt_scope ( @ast (ctx, sig, " __source__ " :: K"Identifier" ), scope_ref )
32613262 LineNumberNode:: K"Value"
32623263 ]
32633264 [K " ::"
3264- adopt_scope (@ast (ctx, sig, " __module__" :: K"Identifier" ),
3265- kind (name) == K " ." ? name[1 ] : name)
3265+ adopt_scope (@ast (ctx, sig, " __module__" :: K"Identifier" ), scope_ref)
32663266 Module:: K"Value"
32673267 ]
3268- args[2 : end ]. .. # nospecialize?
3268+ map (e -> _apply_nospecialize (ctx, e), args[2 : end ]) ...
32693269 ]
32703270 ex[2 ]
32713271 ]
@@ -3274,8 +3274,7 @@ function expand_macro_def(ctx, ex)
32743274 [K " call" (sig)
32753275 _make_macro_name (ctx, name)
32763276 [K " ::"
3277- adopt_scope (@ast (ctx, sig, " __context__" :: K"Identifier" ),
3278- kind (name) == K " ." ? name[1 ] : name)
3277+ adopt_scope (@ast (ctx, sig, " __context__" :: K"Identifier" ), scope_ref)
32793278 MacroContext:: K"Value"
32803279 ]
32813280 # flisp: We don't mark these @nospecialize because all arguments to
@@ -4509,7 +4508,12 @@ function expand_forms_2(ctx::DesugaringContext, ex::SyntaxTree, docs=nothing)
45094508 eval :: K"Value"
45104509 ctx. mod :: K"Value"
45114510 [K " inert" ex]
4512- ctx. expr_compat_mode :: K"Bool"
4511+ [K " parameters"
4512+ [K " ="
4513+ " expr_compat_mode" :: K"Identifier"
4514+ ctx. expr_compat_mode:: K"Bool"
4515+ ]
4516+ ]
45134517 ]
45144518 ]
45154519 elseif k == K " vect"
0 commit comments