Skip to content

Commit 0212df1

Browse files
committed
Update generated functions for Julia 1.12
Adapts to JuliaLang/julia#57230
1 parent 22f186b commit 0212df1

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/construct.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,18 @@ end
8888

8989
get_source(meth::Method) = Base.uncompressed_ast(meth)
9090

91-
function get_source(g::GeneratedFunctionStub, env, file, line::Int)
92-
b = g(Base.get_world_counter(), LineNumberNode(line, file), env..., g.argnames...)
93-
b isa CodeInfo && return b
94-
return eval(b)
91+
@static if VERSION < v"1.12.0-DEV.1968" # julia #57230
92+
function get_source(g::GeneratedFunctionStub, env, file, line::Int)
93+
b = g(Base.get_world_counter(), LineNumberNode(line, file), env..., g.argnames...)
94+
b isa CodeInfo && return b
95+
return eval(b)
96+
end
97+
else
98+
function get_source(g::GeneratedFunctionStub, source::Method, env)
99+
b = g(Base.get_world_counter(), source, env..., g.argnames...)
100+
b isa CodeInfo && return b
101+
return eval(b)
102+
end
95103
end
96104

97105
"""
@@ -151,7 +159,11 @@ function prepare_framecode(method::Method, @nospecialize(argtypes); enter_genera
151159
generator = false
152160
else
153161
if is_generated(method)
154-
code = get_source(method.generator, lenv, method.file, Int(method.line))
162+
code = @static if VERSION < v"1.12.0-DEV.1968" # julia #57230
163+
get_source(method.generator, lenv, method.file, Int(method.line))
164+
else
165+
get_source(method.generator, method, lenv)
166+
end
155167
generator = true
156168
else
157169
code = get_source(method)

0 commit comments

Comments
 (0)