You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements mixed macro expansion for old-style macros (those written to
expect an `Expr` data structure) and new-style macros (those written to
expect `SyntaxTree`).
The main difficulty here is managing hygiene correctly. We choose to
represent new-style scoped identifiers passed to old macros using
`Expr(:scope_layer, name, layer_id)` where necessary. But only where
necessary - in most contexts, old-style macros will see unadorned
identifiers just as they currently do. The only time the new `Expr`
construct is visible is when new macros interpolate an expression into a
call to an old-style macro in the returned code. Previously, such
macro-calling-macro situations would result in the inner macro call
seeing `Expr(:escape, ...)` but they now see `Expr(:scope_layer)`.
However, and it's rare for old-style macros to de- and re-construct
escaped expressions correctly so this should be a minor issue for
compatibility.
Old-style macros may still return `Expr(:escape)` expressions resulting
from manual escaping. When consuming the output of old macros, we
process these manual escapes by escaping up the macro expansion stack in
the same way we currently do.
Also add `parent_layer` id to `ScopeLayer` to preserve the macro
expansion stack there for use by JETLS.
Co-authored-by: Em Chu <[email protected]>
0 commit comments