-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)
Description
julia> macro foo()
quote
call(f) = f((1, 2))
function $(esc(:foo))()
call() do (a, b)
return a+b
end
end
end
end
@foo (macro with 1 method)
julia> @foo
foo (generic function with 1 method)
julia> foo()
3
julia> a
1
julia> b
2
julia> @macroexpand @foo
quote
#= REPL[1]:3 =#
var"#7#call"(var"#8#f") = begin
#= REPL[1]:3 =#
var"#8#f"((1, 2))
end
#= REPL[1]:4 =#
function foo()
#= REPL[1]:4 =#
#= REPL[1]:5 =#
var"#7#call"() do (Main.a, Main.b)
#= REPL[1]:6 =#
return Main.a + Main.b
end
end
end
Metadata
Metadata
Assignees
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)