Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5461d4bf5d8e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 18866ad42627
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jan 20, 2016

  1. Copy the full SHA
    0be6817 View commit details
  2. Copy the full SHA
    18866ad View commit details
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
if (IRRuntimeHelpers.isDebug()) doDebug();

if (callCount >= 0) promoteToFullBuild(context);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass().getMethodLocation(), self, name, args, block);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass(), self, name, args, block);
}

private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext ic, RubyModule implClass,
@@ -135,7 +135,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz

if (callCount >= 0) promoteToFullBuild(context);

return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass().getMethodLocation(), self, name, block);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass(), self, name, block);
}

private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext ic, RubyModule implClass,
@@ -163,7 +163,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
if (IRRuntimeHelpers.isDebug()) doDebug();

if (callCount >= 0) promoteToFullBuild(context);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass().getMethodLocation(), self, name, arg0, block);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass(), self, name, arg0, block);
}

private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext ic, RubyModule implClass,
@@ -191,7 +191,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
if (IRRuntimeHelpers.isDebug()) doDebug();

if (callCount >= 0) promoteToFullBuild(context);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass().getMethodLocation(), self, name, arg0, arg1, block);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass(), self, name, arg0, arg1, block);
}

private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext ic, RubyModule implClass,
@@ -219,7 +219,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
if (IRRuntimeHelpers.isDebug()) doDebug();

if (callCount >= 0) promoteToFullBuild(context);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass().getMethodLocation(), self, name, arg0, arg1, arg2, block);
return INTERPRET_METHOD(context, ensureInstrsReady(), getImplementationClass(), self, name, arg0, arg1, arg2, block);
}

private IRubyObject INTERPRET_METHOD(ThreadContext context, InterpreterContext ic, RubyModule implClass,
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
@@ -971,8 +971,8 @@ public static RubyModule findImplementerIfNecessary(RubyModule clazz, RubyModule
// modules are included with a shim class; we must find that shim to handle super() appropriately
return clazz.findImplementer(implementationClass);
} else {
// classes are directly in the hierarchy, so no special logic is necessary for implementer
return implementationClass;
// method is directly in a class, so just ensure we don't use any prepends
return implementationClass.getMethodLocation();
}
}

28 changes: 28 additions & 0 deletions spec/ruby/core/module/prepend_spec.rb
Original file line number Diff line number Diff line change
@@ -303,4 +303,32 @@ def self.inherited(base)
child_class = Class.new(base_class)
ScratchPad.recorded.should == child_class
end

it "does not interfere with a define_method super in the original class" do
base_class = Class.new do
def foo(ary)
ary << 1
end
end

child_class = Class.new(base_class) do
define_method :foo do |ary|
ary << 2
super(ary)
end
end

prep_mod = Module.new do
def foo(ary)
ary << 3
super(ary)
end
end

child_class.prepend(prep_mod)

ary = []
child_class.new.foo(ary)
ary.should == [3, 2, 1]
end
end