@@ -2,6 +2,12 @@ using Core: CodeInfo, Typeof
22using Core. Compiler: InferenceState, MethodInstance, svec
33using 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+
511worldcounter () = ccall (:jl_get_world_counter , UInt, ())
612
713isprecompiling () = 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