Package org.jruby.ast

Examples of org.jruby.ast.Node.assign()


        Node argsNode = node.getArgsNode();
        if (argsNode != null) {
            if (argsNode.nodeId == NodeType.STARNODE) {
                // no check for '*'
            } else if (varLen < valueLen) {
                argsNode.assign(runtime, context, self, value.subseqLight(varLen, valueLen), Block.NULL_BLOCK, checkArity);
            } else {
                argsNode.assign(runtime, context, self, RubyArray.newArrayLight(runtime, 0), Block.NULL_BLOCK, checkArity);
            }
        } else if (checkArity && valueLen < varLen) {
            throw runtime.newArgumentError("Wrong # of arguments (" + valueLen + " for " + varLen + ")");
View Full Code Here


            if (argsNode.nodeId == NodeType.STARNODE) {
                // no check for '*'
            } else if (varLen < valueLen) {
                argsNode.assign(runtime, context, self, value.subseqLight(varLen, valueLen), Block.NULL_BLOCK, checkArity);
            } else {
                argsNode.assign(runtime, context, self, RubyArray.newArrayLight(runtime, 0), Block.NULL_BLOCK, checkArity);
            }
        } else if (checkArity && valueLen < varLen) {
            throw runtime.newArgumentError("Wrong # of arguments (" + valueLen + " for " + varLen + ")");
        }

View Full Code Here

        Node restArgument = node.getRest();
        if (restArgument != null) {
            int restLen = valueLen - varLen;
            if (restLen > 0) {
                restArgument.assign(runtime, context, self, value.subseqLight(offset, restLen), Block.NULL_BLOCK, false);
                offset += restLen;
            } else {
                restArgument.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, false);
            }
        }
View Full Code Here

            int restLen = valueLen - varLen;
            if (restLen > 0) {
                restArgument.assign(runtime, context, self, value.subseqLight(offset, restLen), Block.NULL_BLOCK, false);
                offset += restLen;
            } else {
                restArgument.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, false);
            }
        }

        for (int i = 0; i < node.getPostCount(); i++) {
            offset += i;
View Full Code Here

        Node argsNode = node.getArgsNode();
        if (argsNode != null) {
            if (argsNode.getNodeType() == NodeType.STARNODE) {
                // no check for '*'
            } else if (varLen < valueLen) {
                argsNode.assign(runtime, context, self, value.subseqLight(varLen, valueLen), Block.NULL_BLOCK, checkArity);
            } else {
                argsNode.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, checkArity);
            }
        } else if (checkArity && valueLen < varLen) {
            throw runtime.newArgumentError("Wrong # of arguments (" + valueLen + " for " + varLen + ")");
View Full Code Here

            if (argsNode.getNodeType() == NodeType.STARNODE) {
                // no check for '*'
            } else if (varLen < valueLen) {
                argsNode.assign(runtime, context, self, value.subseqLight(varLen, valueLen), Block.NULL_BLOCK, checkArity);
            } else {
                argsNode.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, checkArity);
            }
        } else if (checkArity && valueLen < varLen) {
            throw runtime.newArgumentError("Wrong # of arguments (" + valueLen + " for " + varLen + ")");
        }

View Full Code Here

        Node rest = node.getRest();
        if (rest != null) {
            if (rest.getNodeType() == NodeType.STARNODE) {
                // no check for '*'
            } else if (preCount + postCount < valueLen) {
                rest.assign(runtime, context, self, value.subseqLight(preCount, valueLen - preCount - postCount), Block.NULL_BLOCK, false);
            } else {
                rest.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, false);
            }

            // FIXME: This is wrong
View Full Code Here

            if (rest.getNodeType() == NodeType.STARNODE) {
                // no check for '*'
            } else if (preCount + postCount < valueLen) {
                rest.assign(runtime, context, self, value.subseqLight(preCount, valueLen - preCount - postCount), Block.NULL_BLOCK, false);
            } else {
                rest.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), Block.NULL_BLOCK, false);
            }

            // FIXME: This is wrong
            int postIndexBase = valueLen - postCount;
            for (int i = 0; i < valueLen && i < postCount; i++) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.