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

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


    }

    @Test
    public void testSimpleExtendsImplements()
    {
        IClassNode node = getClassNode("public class A extends B implements IA {}");
        asBlockWalker.visitClass(node);
        assertOut("public class A extends B implements IA {\n}");
    }
View Full Code Here


    }

    @Test
    public void testSimpleExtendsImplementsMultiple()
    {
        IClassNode node = getClassNode("public class A extends B implements IA, IB, IC {}");
        asBlockWalker.visitClass(node);
        assertOut("public class A extends B implements IA, IB, IC {\n}");
    }
View Full Code Here

{
   
    @Test
    public void testGetAndSetAccessor()
    {
        IClassNode node = (IClassNode) getNode(
                "public function doStuff():void {label = 'hello, bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
                IClassNode.class, WRAP_LEVEL_CLASS);
        asBlockWalker.visitClass(node);
        String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n  this.set_label('hello, bye');\n  var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.get_label = function() {\n  return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nFalconTest_A.prototype.set_label = function(value) {\n  this._label = value;\n};";
        assertOut(expected);
View Full Code Here

    }

    @Test
    public void testSetAccessorWithMemberAccessOnLeftSide()
    {
        IClassNode node = (IClassNode) getNode(
                "public class B { public function B() {}; public function doStuff():void {this.label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
                IClassNode.class, WRAP_LEVEL_PACKAGE);
        asBlockWalker.visitClass(node);
        String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n  this.set_label(this.get_label() + 'bye');\n  var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nB.prototype.get_label = function() {\n  return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nB.prototype.set_label = function(value) {\n  this._label = value;\n};";
        assertOut(expected);
View Full Code Here

    }

    @Test
    public void testSetAccessorWithCompoundRightSide()
    {
        IClassNode node = (IClassNode) getNode(
                "public function doStuff():void {label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
                IClassNode.class, WRAP_LEVEL_CLASS);
        asBlockWalker.visitClass(node);
        String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n  this.set_label(this.get_label() + 'bye');\n  var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.get_label = function() {\n  return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nFalconTest_A.prototype.set_label = function(value) {\n  this._label = value;\n};";
        assertOut(expected);
View Full Code Here

    }
   
    @Test
    public void testSetAccessorWithMemberAccessOnRightSide()
    {
        IClassNode node = (IClassNode) getNode(
                "public class B { public function B() {}; public function doStuff():void {label = this.label; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
                IClassNode.class, WRAP_LEVEL_PACKAGE);
        asBlockWalker.visitClass(node);
        String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n  this.set_label(this.get_label());\n  var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nB.prototype.get_label = function() {\n  return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nB.prototype.set_label = function(value) {\n  this._label = value;\n};";
        assertOut(expected);
View Full Code Here

{
    @Override
    @Test
    public void testSimple()
    {
        IClassNode node = getClassNode("public class A{}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
    }
View Full Code Here

    @Test
    public void testSimpleInternal()
    {
        // (erikdebruin) the AS compiler will enforce 'internal' namespace,
        //               in JS we ignore it
        IClassNode node = getClassNode("internal class A{}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
    }
View Full Code Here

    @Test
    public void testSimpleFinal()
    {
        // (erikdebruin) the AS compiler will enforce the 'final' keyword,
        //               in JS we ignore it
        IClassNode node = getClassNode("public final class A{}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
    }
View Full Code Here

    @Override
    @Test
    public void testSimpleDynamic()
    {
        // (erikdebruin) all JS objects are 'dynamic' by design
        IClassNode node = getClassNode("public dynamic class A{}");
        asBlockWalker.visitClass(node);
        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
    }
View Full Code Here

TOP

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

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.