Created
August 21, 2011 17:17
-
-
Save knu/1160870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/jruby/RubyKernel.java b/src/org/jruby/RubyKernel.java | |
index 2f1cad9..109e0cd 100644 | |
--- a/src/org/jruby/RubyKernel.java | |
+++ b/src/org/jruby/RubyKernel.java | |
@@ -1169,13 +1169,14 @@ public class RubyKernel { | |
return context.createCallerBacktrace(context.getRuntime(), level); | |
} | |
- @JRubyMethod(name = "catch", module = true, visibility = PRIVATE) | |
+ @JRubyMethod(name = "catch", module = true, visibility = PRIVATE, compat = RUBY1_8) | |
public static IRubyObject rbCatch(ThreadContext context, IRubyObject recv, IRubyObject tag, Block block) { | |
Ruby runtime = context.runtime; | |
- RubyContinuation rbContinuation = new RubyContinuation(runtime, stringOrSymbol(tag)); | |
+ RubySymbol sym = stringOrSymbol(tag); | |
+ RubyContinuation rbContinuation = new RubyContinuation(runtime, sym); | |
try { | |
context.pushCatch(rbContinuation.getContinuation()); | |
- return rbContinuation.enter(context, rbContinuation, block); | |
+ return rbContinuation.enter(context, sym, block); | |
} finally { | |
context.popCatch(); | |
} | |
@@ -1184,19 +1185,19 @@ public class RubyKernel { | |
@JRubyMethod(name = "catch", module = true, visibility = PRIVATE, compat = RUBY1_9) | |
public static IRubyObject rbCatch19(ThreadContext context, IRubyObject recv, Block block) { | |
IRubyObject tag = new RubyObject(context.runtime.getObject()); | |
- return rbCatch19Common(context, tag, block, true); | |
+ return rbCatch19Common(context, tag, block); | |
} | |
@JRubyMethod(name = "catch", module = true, visibility = PRIVATE, compat = RUBY1_9) | |
public static IRubyObject rbCatch19(ThreadContext context, IRubyObject recv, IRubyObject tag, Block block) { | |
- return rbCatch19Common(context, tag, block, false); | |
+ return rbCatch19Common(context, tag, block); | |
} | |
- private static IRubyObject rbCatch19Common(ThreadContext context, IRubyObject tag, Block block, boolean yieldTag) { | |
+ private static IRubyObject rbCatch19Common(ThreadContext context, IRubyObject tag, Block block) { | |
RubyContinuation rbContinuation = new RubyContinuation(context.getRuntime(), tag); | |
try { | |
context.pushCatch(rbContinuation.getContinuation()); | |
- return rbContinuation.enter(context, yieldTag ? tag : rbContinuation, block); | |
+ return rbContinuation.enter(context, tag, block); | |
} finally { | |
context.popCatch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@knu, thanks!
I applied this patch in rev. 37cab7e jruby-1_6 branch and rev. 636d625 master branch.