Skip to content

Instantly share code, notes, and snippets.

@headius
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/a64568fbc97c86cbad6f to your computer and use it in GitHub Desktop.
Save headius/a64568fbc97c86cbad6f to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/RubyProc.java b/core/src/main/java/org/jruby/RubyProc.java
index d520c2a..94518c7 100644
--- a/core/src/main/java/org/jruby/RubyProc.java
+++ b/core/src/main/java/org/jruby/RubyProc.java
@@ -298,15 +298,17 @@ public class RubyProc extends RubyObject implements DataType {
}
private IRubyObject handleBreakJump(Ruby runtime, Block newBlock, JumpException.BreakJump bj, int jumpTarget) {
- switch(newBlock.type) {
- case LAMBDA:
- if (bj.getTarget() == jumpTarget) return (IRubyObject) bj.getValue();
-
- throw runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "unexpected break");
- case PROC:
- if (newBlock.isEscaped()) throw runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "break from proc-closure");
+ if (bj.getTarget() == jumpTarget) {
+ switch (newBlock.type) {
+ case LAMBDA:
+ return (IRubyObject) bj.getValue();
+ case PROC:
+ if (newBlock.isEscaped()) {
+ throw runtime.newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject) bj.getValue(), "break from proc-closure");
+ }
+ }
}
-
+
throw bj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment