Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add current-scope/module instrs after arg receive
  • Loading branch information
subbuss committed Oct 22, 2014
1 parent b58b9f3 commit 2fbbf60
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -1658,12 +1658,13 @@ private IRMethod defineNewMethod(MethodDefNode defNode, IRScope s, boolean isIns
// Set %current_scope = <current-scope>
// Set %current_module = isInstanceMethod ? %self.metaclass : %self
int nearestScopeDepth = s.getNearestModuleReferencingScopeDepth();
addInstr(method, new CopyInstr(method.getCurrentScopeVariable(), new CurrentScope(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));
addInstr(method, new CopyInstr(method.getCurrentModuleVariable(), new ScopeModule(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));

// Build IR for arguments (including the block arg)
receiveMethodArgs(defNode.getArgsNode(), method);

addInstr(method, new CopyInstr(method.getCurrentScopeVariable(), new CurrentScope(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));
addInstr(method, new CopyInstr(method.getCurrentModuleVariable(), new ScopeModule(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));

// Thread poll on entry to method
addInstr(method, new ThreadPollInstr());

Expand Down

0 comments on commit 2fbbf60

Please sign in to comment.