Skip to content

Commit

Permalink
Showing 2 changed files with 4 additions and 18 deletions.
10 changes: 4 additions & 6 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
@@ -121,9 +121,9 @@ public static void checkForLJE(ThreadContext context, DynamicScope dynScope, boo
* Handle non-local returns (ex: when nested in closures, root scopes of module/class/sclass bodies)
*/
public static IRubyObject initiateNonLocalReturn(ThreadContext context, DynamicScope dynScope, Block.Type blockType, IRubyObject returnValue) {
if (IRRuntimeHelpers.inLambda(blockType)) throw new IRWrappedLambdaReturnValue(returnValue);

// If not in a lambda, check if this was a non-local return
if (IRRuntimeHelpers.inLambda(blockType)) return returnValue;

while (dynScope != null) {
StaticScope ss = dynScope.getStaticScope();
// SSS FIXME: Why is scopeType empty? Looks like this static-scope
@@ -171,7 +171,7 @@ public static IRubyObject initiateBreak(ThreadContext context, DynamicScope dynS
// Ensures would already have been run since the IR builder makes
// sure that ensure code has run before we hit the break. Treat
// the break as a regular return from the closure.
throw new IRWrappedLambdaReturnValue(breakValue);
return breakValue;
} else {
StaticScope scope = dynScope.getStaticScope();
IRScopeType scopeType = scope.getScopeType();
@@ -193,9 +193,7 @@ public static IRubyObject initiateBreak(ThreadContext context, DynamicScope dynS

@JIT
public static IRubyObject handleBreakAndReturnsInLambdas(ThreadContext context, StaticScope scope, DynamicScope dynScope, Object exc, Block.Type blockType) throws RuntimeException {
if (exc instanceof IRWrappedLambdaReturnValue) {
return ((IRWrappedLambdaReturnValue)exc).returnValue;
} else if ((exc instanceof IRBreakJump) && inNonMethodBodyLambda(scope, blockType)) {
if ((exc instanceof IRBreakJump) && inNonMethodBodyLambda(scope, blockType)) {
// We just unwound all the way up because of a non-local break
context.setSavedExceptionInLambda(IRException.BREAK_LocalJumpError.getException(context.getRuntime()));
return null;

This file was deleted.

0 comments on commit 3af83b3

Please sign in to comment.