public void receiveRequiredArg(Node node, IRScope s, int argIndex, boolean post, int numPreReqd, int numPostRead) { switch (node.getNodeType()) { case ARGUMENTNODE: { ArgumentNode a = (ArgumentNode)node; String argName = a.getName(); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName); addArgReceiveInstr(s, s.getNewLocalVariable(argName, 0), argIndex, post, numPreReqd, numPostRead); break; } case MULTIPLEASGN19NODE: { MultipleAsgn19Node childNode = (MultipleAsgn19Node) node; Variable v = s.getNewTemporaryVariable(); addArgReceiveInstr(s, v, argIndex, post, numPreReqd, numPostRead); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", ""); s.addInstr(new ToAryInstr(v, v, manager.getFalse())); buildMultipleAsgn19Assignment(childNode, s, v, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
public void receiveRequiredArg(Node node, IRScope s, int argIndex, boolean post, int numPreReqd, int numPostRead) { switch (node.getNodeType()) { case ARGUMENTNODE: { ArgumentNode a = (ArgumentNode)node; String argName = a.getName(); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName); addArgReceiveInstr(s, s.getNewLocalVariable(argName, 0), argIndex, post, numPreReqd, numPostRead); break; } case MULTIPLEASGN19NODE: { MultipleAsgn19Node childNode = (MultipleAsgn19Node) node; Variable v = s.getNewTemporaryVariable(); addArgReceiveInstr(s, v, argIndex, post, numPreReqd, numPostRead); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", ""); s.addInstr(new ToAryInstr(v, v, manager.getFalse())); buildMultipleAsgn19Assignment(childNode, s, v, null); break; } default: throw new NotCompilableException("Can't build assignment node: " + node); } }
private void receiveClosureArg(BlockArgNode blockVarNode, IRScope s) { Variable blockVar = null; if (blockVarNode != null) { String blockArgName = blockVarNode.getName(); blockVar = s.getNewLocalVariable(blockArgName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("block", blockArgName); s.addInstr(new ReceiveClosureInstr(blockVar)); } // SSS FIXME: This instruction is only needed if there is an yield instr somewhere! // In addition, store the block argument in an implicit block variable Variable implicitBlockArg = s.getImplicitBlockArg(); if (blockVar == null) s.addInstr(new ReceiveClosureInstr(implicitBlockArg)); else s.addInstr(new CopyInstr(implicitBlockArg, blockVar)); }
private void receiveClosureArg(BlockArgNode blockVarNode, IRScope s) { Variable blockVar = null; if (blockVarNode != null) { String blockArgName = blockVarNode.getName(); blockVar = s.getNewLocalVariable(blockArgName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("block", blockArgName); s.addInstr(new ReceiveClosureInstr(blockVar)); } // SSS FIXME: This instruction is only needed if there is an yield instr somewhere! // In addition, store the block argument in an implicit block variable Variable implicitBlockArg = s.getImplicitBlockArg(); if (blockVar == null) s.addInstr(new ReceiveClosureInstr(implicitBlockArg)); else s.addInstr(new CopyInstr(implicitBlockArg, blockVar)); }
private void receiveMethodClosureArg(ArgsNode argsNode, IRScope s) { Variable blockVar = null; if (argsNode.getBlock() != null) { String blockArgName = argsNode.getBlock().getName(); blockVar = s.getLocalVariable(blockArgName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("block", blockArgName); s.addInstr(new ReceiveClosureInstr(blockVar)); } // SSS FIXME: This instruction is only needed if there is an yield instr somewhere! // In addition, store the block argument in an implicit block variable Variable implicitBlockArg = s.getImplicitBlockArg(); if (blockVar == null) s.addInstr(new ReceiveClosureInstr(implicitBlockArg)); else s.addInstr(new CopyInstr(implicitBlockArg, blockVar)); }
private void receiveMethodClosureArg(ArgsNode argsNode, IRScope s) { Variable blockVar = null; if (argsNode.getBlock() != null) { String blockArgName = argsNode.getBlock().getName(); blockVar = s.getLocalVariable(blockArgName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("block", blockArgName); s.addInstr(new ReceiveClosureInstr(blockVar)); } // SSS FIXME: This instruction is only needed if there is an yield instr somewhere! // In addition, store the block argument in an implicit block variable Variable implicitBlockArg = s.getImplicitBlockArg(); if (blockVar == null) s.addInstr(new ReceiveClosureInstr(implicitBlockArg)); else s.addInstr(new CopyInstr(implicitBlockArg, blockVar)); }
String argName = a.getName(); s.addInstr(new ReceivePreReqdArgInstr(s.getLocalVariable(argName, 0), argIndex)); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", argName); argName = (argName.equals("")) ? "%_arg_array" : argName; s.addInstr(new ReceiveRestArgInstr(s.getLocalVariable(argName, 0), argIndex, argIndex));
String argName = a.getName(); s.addInstr(new ReceivePreReqdArgInstr(s.getLocalVariable(argName, 0), argIndex)); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", argName); argName = (argName.equals("")) ? "%_arg_array" : argName; s.addInstr(new ReceiveRestArgInstr(s.getLocalVariable(argName, 0), argIndex, argIndex));
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return argIndex; }
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return argIndex; }
Label l = s.getNewLabel(); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("kwarg", argName); s.addInstr(new ReceiveKeywordArgInstr(av, required)); Variable av = s.getNewLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("kwrestarg", argName); s.addInstr(new ReceiveKeywordRestArgInstr(av, required));
Label l = s.getNewLabel(); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("kwarg", argName); s.addInstr(new ReceiveKeywordArgInstr(av, required)); Variable av = s.getNewLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("kwrestarg", argName); s.addInstr(new ReceiveKeywordRestArgInstr(av, required));
String argName = n.getName(); Variable av = s.getNewLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", argName == null ? "" : argName); argName = (argName == null || argName.equals("")) ? "%_arg_array" : argName;
String argName = n.getName(); Variable av = s.getNewLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", argName == null ? "" : argName); argName = (argName == null || argName.equals("")) ? "%_arg_array" : argName;