Skip to content

Commit 437e74a

Browse files
committed
Parsing hook: fall back to Expr if we aren't Core._lower
1 parent c137f41 commit 437e74a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/hooks.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ end
4141
# TODO: This is code copied from JuliaSyntax, adapted to produce
4242
# `Expr(:syntaxtree, st::SyntaxTree)`.
4343
function core_parse_for_lowering_hook(code, filename::String, lineno::Int, offset::Int, options::Symbol)
44+
if Core._lower != core_lowerer_hook
45+
# If lowering can't handle SyntaxTree, return Expr.
46+
# (assumes no Core._lower function other than our core_lowerer_hook can handle SyntaxTree)
47+
return JuliaSyntax.core_parser_hook(code, filename, lineno, offset, options)
48+
end
4449
try
4550
# TODO: Check that we do all this input wrangling without copying the
4651
# code buffer

0 commit comments

Comments
 (0)