Package org.jruby.ast

Examples of org.jruby.ast.ConstNode


            context.assignConstantInObject(constDeclNode.getName());
        }
    }

    public void compileConst(Node node, BodyCompiler context) {
        ConstNode constNode = (ConstNode) node;

        context.retrieveConstant(constNode.getName());
    }
View Full Code Here


        case Tokens.k__LINE__:
            return new FixnumNode(token.getPosition(), token.getPosition().getEndLine()+1);
        case Tokens.tIDENTIFIER:
            return currentScope.declare(token.getPosition(), (String) token.getValue());
        case Tokens.tCONSTANT:
            return new ConstNode(token.getPosition(), (String) token.getValue());
        case Tokens.tIVAR:
            return new InstVarNode(token.getPosition(), (String) token.getValue());
        case Tokens.tCVAR:
            return new ClassVarNode(token.getPosition(), (String) token.getValue());
        case Tokens.tGVAR:
View Full Code Here

        assertNull(getVisitor().visitPostExeNode(new PostExeNode(emptyPosition, null)));
    }

    public void testUnwrapSingleArrayNode() {
        ArrayNode arrayNode = new ArrayNode(emptyPosition);
        ConstNode constNode = new ConstNode(emptyPosition, "const");
        ConstNode anotherConstNode = new ConstNode(emptyPosition, "const");
        arrayNode.add(constNode);

        assertEquals(ReWriteVisitor.unwrapSingleArrayNode(arrayNode), constNode);
        assertEquals(ReWriteVisitor.unwrapSingleArrayNode(constNode), constNode);
View Full Code Here

        String fileName = "outputTest";
        try {
            String testString = "test";
            FileOutputStream stream = new FileOutputStream(fileName);
            ReWriteVisitor visitor = new ReWriteVisitor(stream, "");
            ConstNode node = new ConstNode(emptyPosition, testString);
            node.accept(visitor);
            visitor.flushStream();
            stream.close();
            BufferedReader reader = new BufferedReader(new FileReader(fileName));
            assertEquals(reader.readLine(), testString);
            reader.close();
View Full Code Here

        // TODO: don't require pop
        if (!expr) context.consumeCurrentValue();
    }

    public void compileConst(Node node, BodyCompiler context, boolean expr) {
        ConstNode constNode = (ConstNode) node;

        context.retrieveConstant(constNode.getName());
        // TODO: don't require pop
        if (!expr) context.consumeCurrentValue();
        // XXX: const lookup can trigger const_missing; is that enough to warrant it always being executed?
    }
View Full Code Here

        switch (node.getNodeType()) {
        case DASGNNODE: // LOCALVAR
        case LOCALASGNNODE:
            return currentScope.declare(node.getPosition(), ((INameNode) node).getName());
        case CONSTDECLNODE: // CONSTANT
            return new ConstNode(node.getPosition(), ((INameNode) node).getName());
        case INSTASGNNODE: // INSTANCE VARIABLE
            return new InstVarNode(node.getPosition(), ((INameNode) node).getName());
        case CLASSVARDECLNODE:
        case CLASSVARASGNNODE:
            return new ClassVarNode(node.getPosition(), ((INameNode) node).getName());
View Full Code Here

        case Tokens.k__ENCODING__:
            return new EncodingNode(token.getPosition(), lexer.getEncoding());
        case Tokens.tIDENTIFIER:
            return currentScope.declare(token.getPosition(), (String) token.getValue());
        case Tokens.tCONSTANT:
            return new ConstNode(token.getPosition(), (String) token.getValue());
        case Tokens.tIVAR:
            return new InstVarNode(token.getPosition(), (String) token.getValue());
        case Tokens.tCVAR:
            return new ClassVarNode(token.getPosition(), (String) token.getValue());
        case Tokens.tGVAR:
View Full Code Here

TOP

Related Classes of org.jruby.ast.ConstNode

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.