Skip to content

Commit c9975ab

Browse files
KenoJeffBezanson
authored andcommitted
Don't reach into .mt directly (#31063)
1 parent b01fad2 commit c9975ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/reflection.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,10 +967,10 @@ function may_invoke_generator(method::Method, @nospecialize(atypes), sparams::Si
967967
# For now, only handle the (common, generated by the frontend case) that the
968968
# generator only has one method
969969
isa(method.generator, Core.GeneratedFunctionStub) || return false
970-
generator_mt = typeof(method.generator.gen).name.mt
971-
length(generator_mt) == 1 || return false
970+
gen_mthds = methods(method.generator.gen)
971+
length(gen_mthds) == 1 || return false
972972

973-
generator_method = first(MethodList(generator_mt))
973+
generator_method = first(gen_mthds)
974974
nsparams = length(sparams)
975975
isdefined(generator_method, :source) || return false
976976
code = generator_method.source

0 commit comments

Comments
 (0)