Commit 91018f5
[JuliaLowering] Use Expr structure in macro expansion (#60733)
Step 4 in the the plan at #60373.
Main changes:
- Delete old `expr_to_syntaxtree` (hooray)
- Introduce `est_to_dst`, which does a similar conversion as the above,
but can assume all macros have expanded. (I've chosen "dst" for to mean
"desugarable syntax tree" instead of the "current syntax tree" naming
I've been using thus far)
- Update macro expansion to be a function EST->EST
- Add the AST validator from
JuliaLang/JuliaLowering.jl#93, which I've
changed to work on Expr structure. It's included in this PR so that
`est_to_dst` doesn't need to do all the same checking (since nothing can
be assumed about the output of macro expansion). Most of the long
write-up there still applies, and using the same assumptions in
desugaring could make it much less messy in the future.
- This also means we're now able to return multiple AST-related syntax
errors per top-level thunk, which may be of interest to @aviatesk. I
haven't implemented pretty-printing for this beyond a `for` loop,
though.
- We now go though the `Core.@doc`system instead of the `K"doc"`system,
which should be a temporary solution before we (1) get JuliaLowering
working, then (2) handle docstrings in lowering in both implementations.
- Many tests have been updated with the changes in behaviour. I've
deleted a few where the point of the test is no longer relevant, but
otherwise tried to maintain the spirit of each test.
- Changes in syntax_macros.jl to produce the new old AST. The largest
change is to our version of `@ccall`. Desugaring has also been tweaked
so that it can tolerate `@ccall` expanded by flisp.
stdlib status: There shouldn't be any regressions, and TOML and LibGit2
now precompile.
Atop #60710
---------
Co-authored-by: Cody Tapscott <topolarity@tapscott.me>1 parent 839059f commit 91018f5
40 files changed
Lines changed: 2118 additions & 1964 deletions
File tree
- JuliaLowering
- src
- test
- JuliaSyntax/src/porcelain
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
0 commit comments