@@ -86,7 +86,7 @@ e.g. orderings of (a,b,c;d;e;f):
8686"""
8787function collect_expr_parameters (e:: Expr , pos:: Int )
8888 params = expr_parameters (e, pos)
89- isnothing (params) && return e. args
89+ isnothing (params) && return copy ( e. args)
9090 args = Any[e. args[1 : pos- 1 ]. .. , e. args[pos+ 1 : end ]. .. ]
9191 return _flatten_params! (args, params)
9292end
@@ -140,6 +140,11 @@ function _insert_var_str(child::NodeId, graph::SyntaxGraph, src::SourceAttrType)
140140 return (var_id, src)
141141end
142142
143+ function is_call_expr (e)
144+ return e isa Expr && (e. head === :call ||
145+ e. head in (:where , :(:: )) && is_call_expr (e. args[1 ]))
146+ end
147+
143148"""
144149Insert `e` converted to a syntaxtree into graph and recurse on children. Return
145150a pair (my_node_id, last_srcloc). Should not mutate `e`.
@@ -174,7 +179,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
174179 return (st_id, src)
175180 elseif ! (e isa Expr)
176181 if ! (e isa Union{Number, Bool, Char, GlobalRef, Nothing})
177- @info " unknown leaf type in expr, guessing value:" e typeof (e)
182+ # @info "unknown leaf type in expr, guessing value:" e typeof(e)
178183 end
179184 # TODO : st_k of Float. others?
180185 st_k = e isa Integer ? K " Integer" : find_kind (string (typeof (e)))
@@ -314,7 +319,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
314319 deleteat! (child_exprs, 2 )
315320 elseif e. head === :(-> )
316321 @assert nargs === 2
317- if e. args[1 ] isa Symbol
322+ if ! ( e. args[1 ] isa Expr && e . args[ 1 ] . head === :tuple )
318323 child_exprs[1 ] = Expr (:tuple , e. args[1 ])
319324 end
320325 child_exprs[2 ] = maybe_strip_block (e. args[2 ])
@@ -330,7 +335,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
330335 end
331336 end
332337 elseif e. head === :(= )
333- if e. args[1 ] isa Expr && e . args[ 1 ] . head === :call
338+ if is_call_expr ( e. args[1 ])
334339 st_k = K " function"
335340 st_flags |= JS. SHORT_FORM_FUNCTION_FLAG
336341 child_exprs[2 ] = maybe_strip_block (child_exprs[2 ])
@@ -349,7 +354,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
349354 st_k = K " call"
350355 child_exprs = [e. args[1 ]. args... , Expr (:do_lambda , e. args[2 ]. args... )]
351356 elseif e. head === :let
352- if nargs >= 1 && e. args[1 ] isa Expr && e. args[1 ]. head != = :block
357+ if nargs >= 1 && ! ( e. args[1 ] isa Expr && e. args[1 ]. head === :block )
353358 child_exprs[1 ] = Expr (:block , e. args[1 ])
354359 end
355360 elseif e. head === :struct
0 commit comments