Examples of IClassNode


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

    }

    @Test
    public void testMethodsWithLocalFunctions()
    {
        IClassNode node = getClassNode("public class B {"
                + "public function foo1():Object{function bar1():Object {return null;}; return bar1()}"
                + "public function foo2():Object{function bar2(param1:Object):Object {return null;}; return bar2('foo');}"
                + "}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n  function bar1() {\n    return null;\n  };\n  return goog.bind(bar1, this)();\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n  function bar2(param1) {\n    return null;\n  };\n  return goog.bind(bar2, this)('foo');\n};");
View Full Code Here

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

    }

    @Test
    public void testMethodsWithLocalFunctions2()
    {
        IClassNode node = getClassNode("public class B {"
                + "public var baz1:String;"
                + "public function foo1():String{function bar1():String {return baz1;}; return bar1()}"
                + "public function foo2():String{function bar2(param1:String):String {return param1 + baz1;}; return bar2('foo');}"
                + "}");
        asBlockWalker.visitClass(node);
View Full Code Here

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

        // (erikdebruin) what's wrong with this test case and/or the resulting code?
       
        // (erikdebruin) if you're looking for a way to test multiple cu's
        //               (a project), look in 'TestGoogProject' for an example
       
        IClassNode node = getClassNode("public class B {"
                + "public function clone():B { return new B() }"
                + "}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n * @expose\n * @return {org.apache.flex.B}\n */\norg.apache.flex.B.prototype.clone = function() {\n  return new org.apache.flex.B();\n};");
    }
View Full Code Here

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

        IFileNode node = (IFileNode) getNode(
                "public class B { public function c() { this.b = 1; }; public function set b(value:int):void {}}",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("this.set_b(1)");
    }
View Full Code Here

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

        IFileNode node = (IFileNode) getNode(
                "public class B { public function c() { b = 1; }; public function set b(value:int):void {}}",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("this.set_b(1)");
    }
View Full Code Here

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

        IFileNode node = (IFileNode) getNode(
                "public class B {public function c() { d.b = 1; }; public function set b(value:int):void {}; public static function get d():B {}}",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("foo.bar.B.get_d().set_b(1)");
    }
View Full Code Here

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

        IFileNode node = (IFileNode) getNode(
                "class B extends C { public function c() { E(model).labelText = null; } } class C extends D {} class D { public var model:Object; } class E { public function set labelText(value:String) {} }",
                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
                node, IFunctionNode.class);
        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
                node, IClassNode.class);
        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                fnode, IBinaryOperatorNode.class);
        ((NodeBase)fnode).setParent(null);
        IDefinition def = classnode.getDefinition();

        ((JSFlexJSEmitter)asEmitter).thisClass = def;
        asBlockWalker.visitBinaryOperator(bnode);
        assertOut("org.apache.flex.utils.Language.as(this.model, foo.bar.E, true).set_labelText(null)");
    }
View Full Code Here

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

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

    @Test
    public void testClassCast()
    {
        IClassNode node = (IClassNode) getNode("import spark.components.Button; public class B implements Button { public function B() { Button(b).label = ''; } }", ClassNode.class, WRAP_LEVEL_PACKAGE);
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n * @implements {spark.components.Button}\n */\nB = function() {\n  org.apache.flex.utils.Language.as(b, spark.components.Button, true).set_label('');\n};");
    }
View Full Code Here

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

        // Find the nodes representing the interfaces inside the {@code FileNode}.
        List<IIdentifierNode> interfaceNodeList = new ArrayList<IIdentifierNode>();
        if (fileNode.getChildCount() == 1 && fileNode.getChild(0) instanceof IClassNode)
        {
            IClassNode classNode = (IClassNode)fileNode.getChild(0);
            for (IExpressionNode interfaceNode : classNode.getImplementedInterfaceNodes())
            {
                if (interfaceNode instanceof IIdentifierNode)
                {
                    interfaceNodeList.add((IIdentifierNode)interfaceNode);
                    // Reparent them onto this {@code MXMLImplementsNode}.
View Full Code Here

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

        if (targetAttributes == null)
        {
            final IDefinitionNode[] definitionNodes = getTopLevelDefinitionNodes(false, false);
            if (definitionNodes.length == 1 && definitionNodes[0] instanceof IClassNode)
            {
                final IClassNode classNode = (IClassNode)definitionNodes[0];
                final IMetaTagNode[] metaTagSWF = classNode.getMetaTagNodesByName("SWF");
                if (metaTagSWF != null && metaTagSWF.length > 0)
                {
                    if (metaTagSWF.length > 1)
                        throw new IllegalStateException("Only allow one [SWF] metadata tag.");
                    targetAttributes = new TargetAttributesMetadata(metaTagSWF[0]);
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.