Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is preparatory work for experimental integration with JuliaLowering, which
happened to be separable into its own PR.
We currently have three lowering entry points doing slightly different things:
jl-expand-to-thunk
,jl-expand-to-thunk-warn
(for complaining about ambiguoussoft scope assignments during non-interactive use), and
jl-expand-to-thunk-stmt
(which wraps the expression in a block returningnothing before lowering it) and a bunch of C wrappers on top of those (see red
nodes in the call graphs below).
In this PR:
jl_lower
, which just calls out to lispfor now, but will probably function like
jl_parse
does in a future PR.warn
with an extra parameterthree entry points
"expand"-prefixed functions to "lower"-prefixed ones (excluding macro
expansion functions, which are called as the first part of lowering).
Here's a call graph before this change, made by looking for callers
of each lowering entry point and tracing back one or more steps (expect
mistakes...). Macro expansion functions are mostly omitted for clarity.
Blue is scheme, red is ast.c, and green is toplevel.c.
After this change:

todo?
I'd like to see if we can eliminate thestmt
boolean option fromjl_lower
and handle that another way; I'm just not sure it's worth the effort at the
moment. We only use it in one place in
jl_eval_module_expr
. The originalcode path was added in lower top-level statements so that the front-end knows their values are unused #26304.