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

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


    }

    @Test
    public void testComplexBooleanExpression()
    {
        IFunctionNode node = getMethod("function foo(b:Boolean):Boolean {var c:String; var d:String; if (!(b ? c : d)) { return b;}");
        asBlockWalker.visitFunction(node);
        assertOut("/**\n * @param {boolean} b\n * @return {boolean}\n */\nFalconTest_A.prototype.foo = function(b) {\n  var /** @type {string} */ c;\n  var /** @type {string} */ d;\n  if (!(b ? c : d)) {\n    return b;\n  }\n}");
    }
View Full Code Here


    }

    @Test
    public void testVisitAs2()
    {
        IFunctionNode node = (IFunctionNode) getNode(
                "public class B {public function b(o:Object):int { var a:B; a = o as B; }}",
                IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
        asBlockWalker.visitFunction(node);
        assertOut("/**\n * @expose\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b = function(o) {\n  var /** @type {foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language.as(o, foo.bar.B);\n}");
    }
View Full Code Here

    //--------------------------------------------------------------------------

    @Test
    public void testMethod()
    {
        IFunctionNode node = getMethod("function foo(){}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo() {\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withReturnType()
    {
        IFunctionNode node = getMethod("function foo():int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo():int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withParameterReturnType()
    {
        IFunctionNode node = getMethod("function foo(bar):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo(bar:*):int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withParameterTypeReturnType()
    {
        IFunctionNode node = getMethod("function foo(bar:String):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo(bar:String):int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withDefaultParameterTypeReturnType()
    {
        IFunctionNode node = getMethod("function foo(bar:String = \"baz\"):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo(bar:String = \"baz\"):int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withMultipleDefaultParameterTypeReturnType()
    {
        IFunctionNode node = getMethod("function foo(bar:String, baz:int = null):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withRestParameterTypeReturnType()
    {
        IFunctionNode node = getMethod("function foo(bar:String, ...rest):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("function foo(bar:String, ...rest):int {\n\treturn -1;\n}");
    }
View Full Code Here

    }

    @Test
    public void testMethod_withNamespace()
    {
        IFunctionNode node = getMethod("public function foo(bar:String, baz:int = null):int{\treturn -1;}");
        asBlockWalker.visitFunction(node);
        assertOut("public function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
    }
View Full Code Here

TOP

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

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.