public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); buildMultipleAsgnAssignment(multipleAsgnNode, s, null, ret); return ret; }
public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); buildMultipleAsgnAssignment(multipleAsgnNode, s, null, ret); return ret; }
public void buildVersionSpecificAssignment(Node node, IRScope s, Variable v) { switch (node.getNodeType()) { case MULTIPLEASGNNODE: { Operand valuesArg; MultipleAsgnNode childNode = (MultipleAsgnNode) node; if (childNode.getHeadNode() != null && ((ListNode)childNode.getHeadNode()).childNodes().size() > 0) { // Invoke to_ary on the operand only if it is not an array already Variable result = s.getNewTemporaryVariable(); s.addInstr(new ToAryInstr(result, v, manager.getTrue())); valuesArg = result; } else { s.addInstr(new EnsureRubyArrayInstr(v, v)); valuesArg = v; } buildMultipleAsgnAssignment(childNode, s, null, valuesArg); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void buildVersionSpecificAssignment(Node node, IRScope s, Variable v) { switch (node.getNodeType()) { case MULTIPLEASGNNODE: { Operand valuesArg; MultipleAsgnNode childNode = (MultipleAsgnNode) node; if (childNode.getHeadNode() != null && ((ListNode)childNode.getHeadNode()).childNodes().size() > 0) { // Invoke to_ary on the operand only if it is not an array already Variable result = s.getNewTemporaryVariable(); s.addInstr(new ToAryInstr(result, v, manager.getTrue())); valuesArg = result; } else { s.addInstr(new EnsureRubyArrayInstr(v, v)); valuesArg = v; } buildMultipleAsgnAssignment(childNode, s, null, valuesArg); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void buildVersionSpecificBlockArgsAssignment(Node node, IRScope s, Operand argsArray, int argIndex, boolean isMasgnRoot, boolean isClosureArg, boolean isSplat) { switch (node.getNodeType()) { case MULTIPLEASGNNODE: { Variable oldArgs = null; MultipleAsgnNode childNode = (MultipleAsgnNode) node; if (!isMasgnRoot) { // Vars used to receive args should always be local-variables because // these arg values may need to be accessed by some zsuper instruction. // During interpretation, only local-vars are accessible (at least right now) // outside the scope they are defined in. Variable v = s.getLocalVariable("%_masgn_arg_" + argIndex, 0); receiveBlockArg(s, v, argsArray, argIndex, isClosureArg, isSplat); boolean runToAry = childNode.getHeadNode() != null && (((ListNode)childNode.getHeadNode()).childNodes().size() > 0); if (runToAry) { s.addInstr(new ToAryInstr(v, v, manager.getFalse())); } else { s.addInstr(new EnsureRubyArrayInstr(v, v)); } argsArray = v; // SSS FIXME: Are we guaranteed that splats dont head to multiple-assignment nodes! i.e. |*(a,b)|? } // Build buildMultipleAsgnAssignment(childNode, s, argsArray, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void buildVersionSpecificBlockArgsAssignment(Node node, IRScope s, Operand argsArray, int argIndex, boolean isMasgnRoot, boolean isClosureArg, boolean isSplat) { switch (node.getNodeType()) { case MULTIPLEASGNNODE: { Variable oldArgs = null; MultipleAsgnNode childNode = (MultipleAsgnNode) node; if (!isMasgnRoot) { // Vars used to receive args should always be local-variables because // these arg values may need to be accessed by some zsuper instruction. // During interpretation, only local-vars are accessible (at least right now) // outside the scope they are defined in. Variable v = s.getLocalVariable("%_masgn_arg_" + argIndex, 0); receiveBlockArg(s, v, argsArray, argIndex, isClosureArg, isSplat); boolean runToAry = childNode.getHeadNode() != null && (((ListNode)childNode.getHeadNode()).childNodes().size() > 0); if (runToAry) { s.addInstr(new ToAryInstr(v, v, manager.getFalse())); } else { s.addInstr(new EnsureRubyArrayInstr(v, v)); } argsArray = v; // SSS FIXME: Are we guaranteed that splats dont head to multiple-assignment nodes! i.e. |*(a,b)|? } // Build buildMultipleAsgnAssignment(childNode, s, argsArray, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }