Skip to content

Commit 197772a

Browse files
committed
Reorganize some cases; handle `:[no]inline
1 parent d541446 commit 197772a

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

src/compat.jl

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -242,27 +242,6 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
242242
end
243243

244244
# TODO node->expr handles do blocks here?
245-
elseif e.head === :escape || e.head === Symbol("hygienic-scope")
246-
@assert nargs >= 1
247-
# Existing behaviour appears to just ignore any extra args
248-
return _insert_convert_expr(e.args[1], graph, src)
249-
elseif e.head === :meta
250-
# Messy and undocumented. Sometimes we want a K"meta".
251-
@assert e.args[1] isa Symbol
252-
if e.args[1] === :nospecialize
253-
if nargs > 2
254-
st_k = K"block"
255-
# Kick the can down the road (should only be simple atoms?)
256-
child_exprs = map(c->Expr(:meta, :nospecialize, c), child_exprs[2:end])
257-
else
258-
st_id, src = _insert_convert_expr(e.args[2], graph, src)
259-
setmeta!(SyntaxTree(graph, st_id); nospecialize=true)
260-
return st_id, src
261-
end
262-
else
263-
@assert nargs === 1
264-
child_exprs[1] = Expr(:sym_not_identifier, e.args[1])
265-
end
266245
elseif e.head === Symbol("'")
267246
@assert nargs === 1
268247
st_k = K"call"
@@ -373,14 +352,43 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
373352
(e)->(e.head = :importpath))
374353
elseif e.head === :kw
375354
st_k = K"="
376-
elseif e.head === Symbol("latestworld-if-toplevel")
355+
end
356+
357+
# The following heads are not emitted from parsing, but old macros could
358+
# produce these and they would historically be accepted by flisp lowering.
359+
if e.head === Symbol("latestworld-if-toplevel")
377360
st_k = K"latestworld_if_toplevel"
361+
elseif e.head === :escape || e.head === Symbol("hygienic-scope")
362+
@assert nargs >= 1
363+
# Existing behaviour appears to just ignore any extra args
364+
return _insert_convert_expr(e.args[1], graph, src)
365+
elseif e.head === :meta
366+
# Messy and undocumented. Sometimes we want a K"meta".
367+
@assert e.args[1] isa Symbol
368+
if e.args[1] === :nospecialize
369+
if nargs > 2
370+
st_k = K"block"
371+
# Kick the can down the road (should only be simple atoms?)
372+
child_exprs = map(c->Expr(:meta, :nospecialize, c), child_exprs[2:end])
373+
else
374+
st_id, src = _insert_convert_expr(e.args[2], graph, src)
375+
setmeta!(SyntaxTree(graph, st_id); nospecialize=true)
376+
return st_id, src
377+
end
378+
else
379+
@assert nargs === 1
380+
child_exprs[1] = Expr(:sym_not_identifier, e.args[1])
381+
end
378382
elseif e.head === :symbolicgoto || e.head === :symboliclabel
379383
@assert nargs === 1
380384
st_k = e.head === :symbolicgoto ? K"symbolic_label" : K"symbolic_goto"
381385
st_id = _insert_tree_node(graph, st_k, src)
382386
setattr!(graph, st_id, name_val=string(e.args[1]))
383387
return (st_id, src)
388+
elseif e.head === :inline || e.head === :noinline
389+
@assert nargs === 1 && e.args[1] isa Bool
390+
# TODO: JuliaLowering doesn't accept this (non-:meta) form yet
391+
return (nothing, src)
384392
end
385393

386394
# Temporary heads introduced by converting the parent expr

0 commit comments

Comments
 (0)