Skip to content

Commit

Permalink
Document the edge case in a FIXME as caused by define_method use
Browse files Browse the repository at this point in the history
* We should rip out the fix when we update the define_method
  implementation to convert those blocks to real method scopes.
  • Loading branch information
subbuss committed Apr 21, 2015
1 parent c2f66f2 commit b65a584
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Expand Up @@ -742,6 +742,28 @@ public static RubyModule findInstanceMethodContainer(ThreadContext context, Dyna
// - in the rare case where it is not (looks like it can
// happen in some testing frameworks), we have to add
// the method to self itself => its metaclass.
//
// SSS FIXME: Looks like this rare case happens when
// the closure is used in a "define_method &block" scenario
// => in reality the scope is not a closure but an
// instance_method. So, when we fix define_method implementation
// to actually convert blocks to real instance_method scopes,
// we will not have this edge case since the code will then
// be covered by the (scopeType == IRScopeType.INSTANCE_METHOD)
// scenario below. Whenever we get to fixing define_method
// implementation, we should rip out this code here.
//
// Verify that this test runs:
// -------------
// require "minitest/autorun"
//
// describe "A" do
// it "should do something" do
// def foo
// end
// end
// end
// -------------
case MODULE_EVAL : return self instanceof RubyModule ? (RubyModule) self : self.getMetaClass();
case INSTANCE_EVAL: return self.getSingletonClass();
case BINDING_EVAL : ds = ds.getParentScope(); break;
Expand Down

0 comments on commit b65a584

Please sign in to comment.