@@ -191,7 +191,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
191191 maybe_kind = find_kind (string (e. head))
192192 st_k = isnothing (maybe_kind) ? K " None" : maybe_kind
193193 st_flags = 0x0000
194- child_exprs = copy (e. args)
194+ child_exprs:: Vector{Any} = copy (e. args)
195195
196196 # The following are special cases where the kind, flags, or children are
197197 # different from what we guessed above.
@@ -247,9 +247,21 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
247247 # Existing behaviour appears to just ignore any extra args
248248 return _insert_convert_expr (e. args[1 ], graph, src)
249249 elseif e. head === :meta
250- @assert nargs <= 2
251250 @assert e. args[1 ] isa Symbol
252- child_exprs[1 ] = Expr (:sym_not_identifier , e. args[1 ])
251+ if e. args[1 ] === :nospecialize
252+ if nargs > 2
253+ st_k = K " block"
254+ # Kick the can down the road
255+ child_exprs = map (c-> Expr (:meta , :nospecialize , c), child_exprs[2 : end ])
256+ else
257+ st_id, src = _insert_convert_expr (e. args[2 ], graph, src)
258+ setmeta! (SyntaxTree (graph, st_id); nospecialize= true )
259+ return st_id, src
260+ end
261+ else
262+ @assert nargs === 1
263+ child_exprs[1 ] = Expr (:sym_not_identifier , e. args[1 ])
264+ end
253265 elseif e. head === Symbol (" '" )
254266 @assert nargs === 1
255267 st_k = K " call"
@@ -394,14 +406,19 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
394406
395407 st_flags |= JS. NON_TERMINAL_FLAG
396408 st_id = _insert_tree_node (graph, st_k, src, st_flags)
409+ st_child_ids, last_src = _insert_expr_children (child_exprs, graph, src)
410+ setchildren! (graph, st_id, st_child_ids)
411+ return st_id, last_src
412+ end
413+
414+ function _insert_expr_children (child_exprs:: Vector{Any} , graph:: SyntaxGraph ,
415+ src:: SourceAttrType )
397416 st_child_ids = NodeId[]
398417 last_src = src
399418 for c in child_exprs
400419 (c_id, c_src) = _insert_convert_expr (c, graph, last_src)
401420 isnothing (c_id) || push! (st_child_ids, c_id)
402421 last_src = something (c_src, src)
403422 end
404-
405- setchildren! (graph, st_id, st_child_ids)
406- return (st_id, last_src)
423+ return st_child_ids, last_src
407424end
0 commit comments