Package org.apache.flex.compiler.internal.tree.as

Examples of org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode


        {
            // Left-hand side is a "full name", for example: "ns1::ns2::member".
            // Then convert the "full name" node into a namespace qualifier,
            // and associate it with the variable.
            final QualifiedNamespaceExpressionNode qualifier = new QualifiedNamespaceExpressionNode((FullNameNode)left);
            result = new NamespaceAccessExpressionNode(qualifier, op, right);
        }
        else if (left instanceof MemberAccessExpressionNode)
        {
            // In this case, we need to turn the right side into the full qualified bit.
            IExpressionNode maRight = ((MemberAccessExpressionNode)left).getRightOperandNode();
            if (maRight instanceof NamespaceIdentifierNode)
            {
                ((MemberAccessExpressionNode)left).setRightOperandNode(new NamespaceAccessExpressionNode((NamespaceIdentifierNode)maRight, op, right));
            }
            else if (maRight instanceof IdentifierNode)
            {
                ((MemberAccessExpressionNode)left).setRightOperandNode(new NamespaceAccessExpressionNode(new NamespaceIdentifierNode((IdentifierNode)maRight), op, right));
                //this is the @ case, so @x::y
            }
            else if (maRight instanceof UnaryOperatorNodeBase && ((UnaryOperatorNodeBase)maRight).getOperator() == OperatorType.AT)
            {
                ((UnaryOperatorNodeBase)maRight).setExpression(new NamespaceAccessExpressionNode((IdentifierNode)((UnaryOperatorNodeBase)maRight).getOperandNode(), op, right));
            }
            if (maRight.hasParenthesis() && maRight instanceof MemberAccessExpressionNode)
            {
                ((MemberAccessExpressionNode)left).setRightOperandNode(new NamespaceAccessExpressionNode(new QualifiedNamespaceExpressionNode((MemberAccessExpressionNode)maRight), op, right));
            }
            result = left;
        }
        else if (left instanceof NamespaceIdentifierNode &&
                 right instanceof IdentifierNode &&
                 ((NamespaceIdentifierNode)left).getNamespaceDecorationKind() == NamespaceDecorationKind.CONFIG)
        {
            // Check to see if this is a "configCondition". 
            final ConfigExpressionNode cn = new ConfigExpressionNode(
                    (NamespaceIdentifierNode)left,
                    (ASToken)op,
                    (IdentifierNode)right);
            result = evaluateConstNodeExpression(cn);
        }
        else
        {
            result = new NamespaceAccessExpressionNode(left, op, right);
        }

        return result;
    }
View Full Code Here


    @Test
    public void testVisitBinaryOperator_NamespaceAccess_1()
    {
        // TODO (mschmalle) this needs INamespaceAccessExpressionNode interface
      // TODO (erikdebruin) JS implementation?
      NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
                "a::b", NamespaceAccessExpressionNode.class);
        visitor.visitNamespaceAccessExpression(node);
        assertOut("");
    }
View Full Code Here

    @Test
    public void testVisitBinaryOperator_NamespaceAccess_2()
    {
        // TODO (mschmalle) this needs INamespaceAccessExpressionNode interface
      // TODO (erikdebruin) JS implementation?
        NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
                "a::b::c", NamespaceAccessExpressionNode.class);
        visitor.visitNamespaceAccessExpression(node);
        assertOut("");
    }
View Full Code Here

    @Test
    public void testVisitBinaryOperator_NamespaceAccess_1()
    {
        // TODO this needs INamespaceAccessExpressionNode interface
        NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
                "a::b", NamespaceAccessExpressionNode.class);
        visitor.visitNamespaceAccessExpression(node);
        assertOut("a::b");
    }
View Full Code Here

    @Test
    public void testVisitBinaryOperator_NamespaceAccess_2()
    {
        // TODO this needs INamespaceAccessExpressionNode interface
        NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
                "a::b::c", NamespaceAccessExpressionNode.class);
        visitor.visitNamespaceAccessExpression(node);
        assertOut("a::b::c");
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode

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.