-
-
Save headius/e3dec8bee3364e2831dbc58bd1493451 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/core/src/main/java/org/jruby/ir/IRBuilder.java b/core/src/main/java/org/jruby/ir/IRBuilder.java | |
index 9de004437e..afc2fa908f 100644 | |
--- a/core/src/main/java/org/jruby/ir/IRBuilder.java | |
+++ b/core/src/main/java/org/jruby/ir/IRBuilder.java | |
@@ -2398,7 +2398,7 @@ public class IRBuilder { | |
// used for yields; metaclass body (sclass) inherits yield var from surrounding, and accesses it as implicit | |
if (scope instanceof IRMethod || scope instanceof IRMetaClassBody) { | |
addInstr(new LoadImplicitClosureInstr(getYieldClosureVariable())); | |
- } else { | |
+ } else if (scope instanceof IRModuleBody || scope instanceof IRClassBody) { | |
addInstr(new LoadFrameClosureInstr(getYieldClosureVariable())); | |
} | |
} | |
@@ -4146,6 +4146,11 @@ public class IRBuilder { | |
Variable ret = result == null ? createTemporaryVariable() : result; | |
Operand value = argNode instanceof ArrayNode && unwrap ? buildArray((ArrayNode)argNode, true) : build(argNode); | |
+ | |
+ if (!(scope instanceof IRMethod || scope instanceof IRMetaClassBody || scope instanceof IRModuleBody || scope instanceof IRClassBody)) { | |
+ addInstr(new LoadFrameClosureInstr(getYieldClosureVariable())); | |
+ } | |
+ | |
addInstr(new YieldInstr(ret, getYieldClosureVariable(), value, unwrap)); | |
return ret; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment