Skip to content

Instantly share code, notes, and snippets.

@headius
Created March 2, 2015 19:06
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/7f041aefb2330b6e8bcd to your computer and use it in GitHub Desktop.
Save headius/7f041aefb2330b6e8bcd to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java b/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
index c9746dd..ddc44a8 100644
--- a/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
+++ b/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
@@ -183,21 +183,23 @@ public class IRRuntimeHelpers {
}
}
- @JIT
+ @Interp @JIT
public static IRubyObject handleBreakAndReturnsInLambdas(ThreadContext context, StaticScope scope, DynamicScope dynScope, Object exc, Block.Type blockType) throws RuntimeException {
if ((exc instanceof IRBreakJump) && inNonMethodBodyLambda(scope, blockType)) {
// We just unwound all the way up because of a non-local break
- throw IRException.BREAK_LocalJumpError.getException(context.getRuntime());
- } else if (exc instanceof IRReturnJump && (blockType == null || inLambda(blockType))) {
+ if (((IRBreakJump)exc).scopeToReturnTo == dynScope) throw IRException.BREAK_LocalJumpError.getException(context.getRuntime());
+ }
+
+ if (exc instanceof IRReturnJump && (blockType == null || inLambda(blockType))) {
// Ignore non-local return processing in non-lambda blocks.
// Methods have a null blocktype
return handleNonlocalReturn(scope, dynScope, exc, blockType);
- } else {
- // Propagate
- Helpers.throwException((Throwable)exc);
- // should not get here
- return null;
}
+
+ // Propagate
+ Helpers.throwException((Throwable)exc);
+ // should not get here
+ return null;
}
@JIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment