@@ -20,15 +20,15 @@ Expr-producing macros. Always prefer re-parsing source text over using this.
2020Supports parsed and/or macro-expanded exprs, but not lowered exprs
2121"""
2222function expr_to_syntaxtree (@nospecialize (e),
23- mctx :: Union{MacroExpansionContext , Nothing} = nothing ,
24- lnn :: Union{LineNumberNode, Nothing} = nothing )
25- graph = if isnothing (mctx )
23+ lnn :: Union{LineNumberNode , Nothing} = nothing ,
24+ ctx = nothing )
25+ graph = if isnothing (ctx )
2626 ensure_attributes! (SyntaxGraph (),
2727 kind= Kind, syntax_flags= UInt16,
2828 source= SourceAttrType, var_id= Int, value= Any,
2929 name_val= String, is_toplevel_thunk= Bool)
3030 else
31- mctx . graph
31+ syntax_graph (ctx)
3232 end
3333 toplevel_src = if isnothing (lnn)
3434 # Provenance sinkhole for all nodes until we hit a linenode
@@ -154,7 +154,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
154154 return (st_id, src)
155155 elseif e isa Symbol
156156 st_id = _insert_tree_node (graph, K " Identifier" , src)
157- setattr! (graph, st_id, name_val= String (e))
157+ setattr! (graph, st_id; name_val= String (e))
158158 if ! Base. isoperator (e) && ! Base. is_valid_identifier (e)
159159 return _insert_var_str (st_id, graph, src)
160160 end
@@ -368,10 +368,8 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
368368 # produce these and they would historically be accepted by flisp lowering.
369369 if e. head === Symbol (" latestworld-if-toplevel" )
370370 st_k = K " latestworld_if_toplevel"
371- elseif e. head === :escape || e. head === Symbol (" hygienic-scope" )
372- @assert nargs >= 1
373- # Existing behaviour appears to just ignore any extra args
374- return _insert_convert_expr (e. args[1 ], graph, src)
371+ elseif e. head === Symbol (" hygienic-scope" )
372+ st_k = K " hygienic_scope"
375373 elseif e. head === :meta
376374 # Messy and undocumented. Sometimes we want a K"meta".
377375 @assert e. args[1 ] isa Symbol
0 commit comments