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

Examples of org.apache.flex.compiler.tree.as.IVariableNode


    @Override
    @Test
    public void testAnonymousFunctionWithParamsReturn()
    {
        IVariableNode node = (IVariableNode) getNode(
                "var a:Object = function(foo:int, bar:String = 'goo'):int{return -1;};",
                IVariableNode.class);
        asBlockWalker.visitVariable(node);
        assertOut("var /** @type {Object} */ a = function(foo, bar) {\n  bar = typeof bar !== 'undefined' ? bar : 'goo';\n  return -1;\n}");
    }
View Full Code Here


    }
   
    @Test
    public void testVarDeclaration_withTypeAssignedStringWithNewLine()
    {
        IVariableNode node = (IVariableNode) getNode("var a:String = \"\\n\"",
                IVariableNode.class);
        asBlockWalker.visitVariable(node);
        assertOut("var /** @type {string} */ a = \"\\n\"");
    }
View Full Code Here

        IExpressionNode init = null;
        if( hasInit() )
        {
            if( this.getVariableClassification() == VariableClassification.LOCAL )
            {
                IVariableNode n = getNodeIfExists();
                assert n != null : "The AST for a local var should still be in memory!";
                init = n.getAssignedValueNode();
            }
            else
            {
                init = initializer;
            }
View Full Code Here

        sb.append('(');
        IVariableNode[] args = getParameterNodes();
        for (int i = 0; i < args.length; i++)
        {
            IVariableNode arg = args[i];
            sb.append(arg.getVariableType());
            if (i < args.length - 1)
                sb.append(", ");
        }
        sb.append(')');
View Full Code Here

            {
                problem =  new ConflictingNameInNamespaceProblem(iNode, varName, getNamespaceStringFromDef(varDef));
            }
            else
            {
                IVariableNode varNode = (IVariableNode)iNode;
                IASNode varNameNode = varNode.getNameExpressionNode();
                if (ambiguity == MultiDefinitionType.MULTIPLE)
                    problem = new DuplicateVariableDefinitionProblem(varNameNode, varName);
                else if (ambiguity == MultiDefinitionType.SHADOWS_PARAM)
                    problem = new VariableDefinitionDuplicatesParameterProblem(varNameNode, varName);
            }
           
            assert problem != null;
            if (problem != null)
                addProblem(problem);
        }

        if (SemanticUtils.hasBaseClassDefinition(iNode, project) )
        {
            addProblem(new ConflictingInheritedNameInNamespaceProblem(iNode, varDef.getBaseName(), getNamespaceStringFromDef(varDef) ));
        }
           
        // Now look to see if the variable name is also a package name
        ASScope cs = (ASScope)varDef.getContainingScope();
        if (cs.isPackageName(varDef.getBaseName()))
        {
            IVariableNode varNode = (IVariableNode)iNode;
            IASNode varNameNode = varNode.getNameExpressionNode();
            addProblem(new DefinitionShadowedByPackageNameProblem(varNameNode));
        }
    }
View Full Code Here

                    .getAncestorOfType(IBinaryOperatorNode.class);
            if (isThisLeftOf(node))
                parent = (IBinaryOperatorNode) parent
                        .getAncestorOfType(IBinaryOperatorNode.class);

            IVariableNode vparent = (IVariableNode) node
                    .getAncestorOfType(IVariableNode.class);
            if (vparent != null)
            {
                IExpressionNode indentFromThis = getIndentFromThis(node);
                if (vparent.getAssignedValueNode() == node
                        || ((IBinaryOperatorNode) vparent
                                .getAssignedValueNode()).getRightOperandNode() == indentFromThis)
                    return true;
            }

            if (rightSide == node && parent != null/*|| isThisLeftOf(node)*/)
 
View Full Code Here

{
    @Override
    @Test
    public void testInfinity()
    {
        IVariableNode node = getField("var a:Number = Infinity;");
        asBlockWalker.visitVariable(node);
        assertOut("/**\n * @type {number}\n */\nFalconTest_A.prototype.a = Infinity");
    }
View Full Code Here

    @Override
    @Test
    public void testNegativeInfinity()
    {
        IVariableNode node = getField("var a:Number = -Infinity;");
        asBlockWalker.visitVariable(node);
        assertOut("/**\n * @type {number}\n */\nFalconTest_A.prototype.a = -Infinity");
    }
View Full Code Here

    @Override
    @Test
    public void testNaN()
    {
        IVariableNode node = getField("var a:Number = NaN;");
        asBlockWalker.visitVariable(node);
        assertOut("/**\n * @type {number}\n */\nFalconTest_A.prototype.a = NaN");
    }
View Full Code Here

    @Override
    @Test
    public void testUndefined()
    {
        IVariableNode node = getField("var a:* = undefined;");
        asBlockWalker.visitVariable(node);
        assertOut("/**\n * @type {*}\n */\nFalconTest_A.prototype.a = undefined");
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.as.IVariableNode

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.