Skip to content

Commit

Permalink
Revert non-proc allocator fix because it breaks tb. Work with them fo…
Browse files Browse the repository at this point in the history
…r different soln for 1.7.0
  • Loading branch information
enebo committed Sep 10, 2012
1 parent 8b966d6 commit 34b46fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.

This file was deleted.

14 changes: 12 additions & 2 deletions src/org/jruby/RubyProc.java
Expand Up @@ -75,9 +75,19 @@ protected RubyProc(Ruby runtime, RubyClass rubyClass, Block.Type type, ISourcePo
this(runtime, rubyClass, type);
this.sourcePosition = sourcePosition;
}

private static ObjectAllocator PROC_ALLOCATOR = new ObjectAllocator() {
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
RubyProc instance = new RubyProc(runtime, runtime.getProc(), Block.Type.PROC);

instance.setMetaClass(klass);

return instance;
}
};

public static RubyClass createProcClass(Ruby runtime) {
RubyClass procClass = runtime.defineClass("Proc", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
RubyClass procClass = runtime.defineClass("Proc", runtime.getObject(), PROC_ALLOCATOR);
runtime.setProc(procClass);

procClass.index = ClassIndex.PROC;
Expand Down Expand Up @@ -126,7 +136,7 @@ public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, I
return block.getProcObject();
}

RubyProc obj = new RubyProc(context.runtime, (RubyClass)recv, Block.Type.PROC);
RubyProc obj = (RubyProc)((RubyClass) recv).allocate();
obj.setup(block);

obj.callMethod(context, "initialize", args, block);
Expand Down

0 comments on commit 34b46fe

Please sign in to comment.