diff --git a/kernel/bootstrap/compiled_method.rb b/kernel/bootstrap/compiled_method.rb index 8e600d8b45..453890d4fc 100644 --- a/kernel/bootstrap/compiled_method.rb +++ b/kernel/bootstrap/compiled_method.rb @@ -1,4 +1,4 @@ -class CompiledMethod +class CompiledMethod < Executable def self.allocate Ruby.primitive :compiledmethod_allocate diff --git a/kernel/common/compiled_method.rb b/kernel/common/compiled_method.rb index 29cfe98d06..64855d29ba 100644 --- a/kernel/common/compiled_method.rb +++ b/kernel/common/compiled_method.rb @@ -117,6 +117,11 @@ def to_s end class CompiledMethod < Executable + class Visibility + attr_accessor :method + attr_reader :visibility + end + # Ivars: instance_variables, primitive, serial, name, iseq, stack_size, # local_count, required_args, total_args, splat, literals, exceptions, # lines, file, compiled, scope diff --git a/kernel/common/module.rb b/kernel/common/module.rb index 14f5867110..95cab87db3 100644 --- a/kernel/common/module.rb +++ b/kernel/common/module.rb @@ -336,6 +336,9 @@ def instance_method(name) cmethod = mod.method_table[name] end + # unwrap the real method from Visibility if needed + cmethod = cmethod.method if cmethod.kind_of? CompiledMethod::Visibility + # We want to show the real module mod = mod.module if mod.class == IncludedModule return UnboundMethod.new(mod, cmethod, self) if cmethod