Skip to content

Commit c93c7bb

Browse files
committed
Add comment explaining why scope loads can't move later.
1 parent 579b8f2 commit c93c7bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/java/org/jruby/ir/IRBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,9 @@ private IRMethod defineMethodInner(MethodDefNode defNode, IRMethod method, IRSco
16571657

16581658
addInstr(method, new ReceiveSelfInstr(method.getSelf()));
16591659

1660+
1661+
// These instructions need to be toward the top of the method because they may both be needed for
1662+
// processing optional arguments as in def foo(a = Object).
16601663
// Set %current_scope = <current-scope>
16611664
// Set %current_module = isInstanceMethod ? %self.metaclass : %self
16621665
int nearestScopeDepth = parent.getNearestModuleReferencingScopeDepth();

0 commit comments

Comments
 (0)