-
-
Save headius/b9d3b5d7f9fb79b9013d78079ac773ef 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 6750379b09..d38d6f2b25 100644 | |
--- a/core/src/main/java/org/jruby/ir/IRBuilder.java | |
+++ b/core/src/main/java/org/jruby/ir/IRBuilder.java | |
@@ -3575,14 +3575,28 @@ public class IRBuilder { | |
IRScope outerScope = scope.getNearestTopLocalVariableScope(); | |
// 'using single_mod_arg' possible nearly everywhere but method scopes. | |
- if (!(outerScope instanceof IRMethod) && args.length == 1 | |
- && ( | |
- CommonByteLists.USING_METHOD.equals(methodName.getBytes()) | |
- // FIXME: This sets the bit for the whole module, but really only the refine block needs it | |
- || CommonByteLists.REFINE_METHOD.equals(methodName.getBytes()) | |
- )) { | |
- scope.setIsMaybeUsingRefinements(); | |
+ boolean refinement = false; | |
+ if (!(outerScope instanceof IRMethod)) { | |
+ ByteList methodBytes = methodName.getBytes(); | |
+ if (args.length == 1) { | |
+ refinement = isRefinementCall(methodBytes); | |
+ } else if (args.length == 2 | |
+ && CommonByteLists.SEND.equal(methodBytes)) { | |
+ if (args[1] instanceof Symbol) { | |
+ Symbol sendName = (Symbol) args[1]; | |
+ methodBytes = sendName.getBytes(); | |
+ refinement = isRefinementCall(methodBytes); | |
+ } | |
+ } | |
} | |
+ | |
+ if (refinement) scope.setIsMaybeUsingRefinements(); | |
+ } | |
+ | |
+ private static boolean isRefinementCall(ByteList methodBytes) { | |
+ return CommonByteLists.USING_METHOD.equals(methodBytes) | |
+ // FIXME: This sets the bit for the whole module, but really only the refine block needs it | |
+ || CommonByteLists.REFINE_METHOD.equals(methodBytes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment