Skip to content

Commit b4ae8ea

Browse files
Merge pull request #86 from CarloLucibello/cl/generated
fix isgenerated on nightly
2 parents af17a16 + a02baf1 commit b4ae8ea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/reflection/reflection.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ using Core: CodeInfo, Typeof
22
using Core.Compiler: InferenceState, MethodInstance, svec
33
using InteractiveUtils: typesof
44

5+
if isdefined(Base, :hasgenerator) # VERSION >= v"1.7.0"
6+
hasgenerator(x) = Base.hasgenerator(x)
7+
else
8+
hasgenerator(x) = Base.isgenerated(x)
9+
end
10+
511
worldcounter() = ccall(:jl_get_world_counter, UInt, ())
612

713
isprecompiling() = ccall(:jl_generating_output, Cint, ()) == 1
@@ -46,10 +52,10 @@ function meta(T; types = T, world = worldcounter())
4652
sps = svec(map(untvar, sps)...)
4753
@static if VERSION >= v"1.2-"
4854
mi = Core.Compiler.specialize_method(method, types, sps)
49-
ci = Base.isgenerated(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(method)
55+
ci = hasgenerator(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(method)
5056
else
5157
mi = Core.Compiler.code_for_method(method, types, sps, world, false)
52-
ci = Base.isgenerated(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(mi)
58+
ci = hasgenerator(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(mi)
5359
end
5460
Base.Meta.partially_inline!(ci.code, [], method.sig, Any[sps...], 0, 0, :propagate)
5561
Meta(method, mi, ci, method.nargs, sps)

0 commit comments

Comments
 (0)