|
80 | 80 |
|
81 | 81 | """ |
82 | 82 | Return `e.args`, but with any parameters in SyntaxTree (flattened, source) order. |
83 | | -Parameters are expected to be as `e.args[pos]`. |
| 83 | +Parameters are expected to be at `e.args[pos]`. |
84 | 84 |
|
85 | 85 | e.g. orderings of (a,b,c;d;e;f): |
86 | 86 | Expr: (tuple (parameters (parameters (parameters f) e) d) a b c) |
@@ -463,36 +463,35 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA |
463 | 463 | if e.args[1] isa Expr && e.args[1].head === :purity |
464 | 464 | st_k = K"meta" |
465 | 465 | child_exprs = [Expr(:quoted_symbol, :purity), Base.EffectsOverride(e.args[1].args...)] |
466 | | - else |
467 | | - @assert e.args[1] isa Symbol |
468 | | - if e.args[1] === :nospecialize |
469 | | - if nargs > 2 |
470 | | - st_k = K"block" |
471 | | - # Kick the can down the road (should only be simple atoms?) |
472 | | - child_exprs = map(c->Expr(:meta, :nospecialize, c), child_exprs[2:end]) |
473 | | - else |
474 | | - st_id, src = _insert_convert_expr(e.args[2], graph, src) |
475 | | - setmeta!(SyntaxTree(graph, st_id); nospecialize=true) |
476 | | - return st_id, src |
477 | | - end |
478 | | - elseif e.args[1] in (:inline, :noinline, :generated, :generated_only, |
479 | | - :max_methods, :optlevel, :toplevel, :push_loc, :pop_loc, |
480 | | - :no_constprop, :aggressive_constprop, :specialize, :compile, :infer, |
481 | | - :nospecializeinfer, :force_compile, :propagate_inbounds, :doc) |
482 | | - # TODO: Some need to be handled in lowering |
483 | | - for (i, ma) in enumerate(e.args) |
484 | | - if ma isa Symbol |
485 | | - # @propagate_inbounds becomes (meta inline |
486 | | - # propagate_inbounds), but usually(?) only args[1] is |
487 | | - # converted here |
488 | | - child_exprs[i] = Expr(:quoted_symbol, e.args[i]) |
489 | | - end |
| 466 | + elseif nargs === 0 |
| 467 | + # pass |
| 468 | + elseif e.args[1] === :nospecialize |
| 469 | + if nargs === 1 |
| 470 | + child_exprs[1] = Expr(:quoted_symbol, :nospecialize) |
| 471 | + elseif nargs > 2 |
| 472 | + st_k = K"block" |
| 473 | + # Kick the can down the road (should only be simple atoms?) |
| 474 | + child_exprs = map(c->Expr(:meta, :nospecialize, c), child_exprs[2:end]) |
| 475 | + elseif nargs === 2 |
| 476 | + st_id, src = _insert_convert_expr(e.args[2], graph, src) |
| 477 | + setmeta!(SyntaxTree(graph, st_id); nospecialize=true) |
| 478 | + return st_id, src |
| 479 | + end |
| 480 | + elseif e.args[1] in (:inline, :noinline, :generated, :generated_only, |
| 481 | + :max_methods, :optlevel, :toplevel, :push_loc, :pop_loc, |
| 482 | + :no_constprop, :aggressive_constprop, :specialize, :compile, :infer, |
| 483 | + :nospecializeinfer, :force_compile, :propagate_inbounds, :doc) |
| 484 | + # TODO: Some need to be handled in lowering |
| 485 | + for (i, ma) in enumerate(e.args) |
| 486 | + if ma isa Symbol |
| 487 | + # @propagate_inbounds becomes (meta inline propagate_inbounds) |
| 488 | + child_exprs[i] = Expr(:quoted_symbol, e.args[i]) |
490 | 489 | end |
491 | | - else |
492 | | - # Can't throw a hard error; it is explicitly tested that meta can take arbitrary keys. |
493 | | - @error("Unknown meta form at $src: `$e`\n$(sprint(dump, e))") |
494 | | - child_exprs[1] = Expr(:quoted_symbol, e.args[1]) |
495 | 490 | end |
| 491 | + else |
| 492 | + # Can't throw a hard error; it is explicitly tested that meta can take arbitrary keys. |
| 493 | + @error("Unknown meta form at $src: `$e`\n$(sprint(dump, e))") |
| 494 | + child_exprs[1] = Expr(:quoted_symbol, e.args[1]) |
496 | 495 | end |
497 | 496 | elseif e.head === :scope_layer |
498 | 497 | @assert nargs === 2 |
|
0 commit comments