@@ -459,27 +459,39 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
459459 st_k = K " hygienic_scope"
460460 elseif e. head === :meta
461461 # Messy and undocumented. Only sometimes we want a K"meta".
462- @assert e. args[1 ] isa Symbol
463- if e. args[1 ] === :nospecialize
464- if nargs > 2
465- st_k = K " block"
466- # Kick the can down the road (should only be simple atoms?)
467- child_exprs = map (c-> Expr (:meta , :nospecialize , c), child_exprs[2 : end ])
462+ if e. args[1 ] isa Expr && e. args[1 ]. head === :purity
463+ st_k = K " meta"
464+ child_exprs = [Expr (:quoted_symbol , :purity ), Base. EffectsOverride (e. args[1 ]. args... )]
465+ else
466+ @assert e. args[1 ] isa Symbol
467+ if e. args[1 ] === :nospecialize
468+ if nargs > 2
469+ st_k = K " block"
470+ # Kick the can down the road (should only be simple atoms?)
471+ child_exprs = map (c-> Expr (:meta , :nospecialize , c), child_exprs[2 : end ])
472+ else
473+ st_id, src = _insert_convert_expr (e. args[2 ], graph, src)
474+ setmeta! (SyntaxTree (graph, st_id); nospecialize= true )
475+ return st_id, src
476+ end
477+ elseif e. args[1 ] in (:inline , :noinline , :generated , :generated_only ,
478+ :max_methods , :optlevel , :toplevel , :push_loc , :pop_loc ,
479+ :no_constprop , :aggressive_constprop , :specialize , :compile , :infer ,
480+ :nospecializeinfer , :force_compile , :propagate_inbounds , :doc )
481+ # TODO : Some need to be handled in lowering
482+ for (i, ma) in enumerate (e. args)
483+ if ma isa Symbol
484+ # @propagate_inbounds becomes (meta inline
485+ # propagate_inbounds), but usually(?) only args[1] is
486+ # converted here
487+ child_exprs[i] = Expr (:quoted_symbol , e. args[i])
488+ end
489+ end
468490 else
469- st_id, src = _insert_convert_expr (e . args[ 2 ], graph, src)
470- setmeta! ( SyntaxTree (graph, st_id); nospecialize = true )
471- return st_id, src
491+ # Can't throw a hard error; it is explicitly tested that meta can take arbitrary keys.
492+ @error ( " Unknown meta form at $src : ` $e ` \n $( sprint (dump, e)) " )
493+ child_exprs[ 1 ] = Expr ( :quoted_symbol , e . args[ 1 ])
472494 end
473- elseif e. args[1 ] in (:inline , :noinline , :generated , :generated_only ,
474- :max_methods , :optlevel , :toplevel , :push_loc , :pop_loc ,
475- :no_constprop , :aggressive_constprop , :specialize , :compile , :infer ,
476- :nospecializeinfer , :force_compile , :doc )
477- # TODO : Some need to be handled in lowering
478- child_exprs[1 ] = Expr (:quoted_symbol , e. args[1 ])
479- else
480- # Can't throw a hard error; it is explicitly tested that meta can take arbitrary keys.
481- @error (" Unknown meta form at $src : `$e `\n $(sprint (dump, e)) " )
482- child_exprs[1 ] = Expr (:quoted_symbol , e. args[1 ])
483495 end
484496 elseif e. head === :scope_layer
485497 @assert nargs === 2
0 commit comments