Package org.jruby.ir.instructions.ruby18

Examples of org.jruby.ir.instructions.ruby18.ReceiveRestArgInstr18


            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 ReceiveOptArgInstr18(av, argIndex));
            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;
View Full Code Here


            if (isSplat) s.addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex));
            else s.addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex));
        } else {
            // argsArray can be null when the first node in the args-node-ast is a multiple-assignment
            // For example, for-nodes
            s.addInstr(isClosureArg ? new ReceiveClosureInstr(v) : (isSplat ? new ReceiveRestArgInstr18(v, argIndex) : new ReceivePreReqdArgInstr(v, argIndex)));
        }
    }
View Full Code Here

            // For this code, there is no argument name available from the ruby code.
            // So, we generate an implicit arg name
            String argName = argsNode.getRestArgNode().getName();
            if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("rest", argName);
            argName = (argName.equals("")) ? "%_arg_array" : argName;
            s.addInstr(new ReceiveRestArgInstr18(s.getLocalVariable(argName, 0), argIndex));
        }

        // Receive block
        receiveMethodClosureArg(argsNode, s);
    }
View Full Code Here

TOP

Related Classes of org.jruby.ir.instructions.ruby18.ReceiveRestArgInstr18

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.