Added/updated (FlexJS) tests Added a complete set of FlexJS specific tests, most of which extend the 'goog' tests, but since the getter/setter handling differs between 'goog' and FlexJS, some adjustments were made.
Other test(-file)s received minor updates; removed some Ignores and ToDos as the functionality (parenthesis handling) was already in place. Raised visibility of some constants to allow access in the new subclasses. Signed-off-by: Erik de Bruin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/06664de8 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/06664de8 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/06664de8 Branch: refs/heads/develop Commit: 06664de8b9850668159e7a6e521b57a0cae785ed Parents: d415385 Author: Erik de Bruin <[email protected]> Authored: Wed Mar 27 15:46:15 2013 +0100 Committer: Erik de Bruin <[email protected]> Committed: Wed Mar 27 16:29:59 2013 +0100 ---------------------------------------------------------------------- .../internal/codegen/as/TestExpressions.java | 13 +- .../js/flexjs/TestFlexJSAccessorMembers.java | 129 +++++++++++++++ .../codegen/js/flexjs/TestFlexJSAccessors.java | 86 ++++++++++ .../codegen/js/flexjs/TestFlexJSClass.java | 76 +++++++++ .../codegen/js/flexjs/TestFlexJSEmiter.java | 38 +++++ .../codegen/js/flexjs/TestFlexJSExpressions.java | 106 ++++++++++++ .../codegen/js/flexjs/TestFlexJSFieldMembers.java | 38 +++++ .../codegen/js/flexjs/TestFlexJSGlobalClasses.java | 38 +++++ .../js/flexjs/TestFlexJSGlobalConstants.java | 38 +++++ .../js/flexjs/TestFlexJSGlobalFunctions.java | 38 +++++ .../codegen/js/flexjs/TestFlexJSInterface.java | 41 +++++ .../codegen/js/flexjs/TestFlexJSMethodMembers.java | 38 +++++ .../codegen/js/flexjs/TestFlexJSPackage.java | 49 ++++++ .../codegen/js/flexjs/TestFlexJSStatements.java | 38 +++++ .../codegen/js/goog/TestGoogExpressions.java | 27 +++ .../codegen/js/goog/TestGoogStatements.java | 1 + .../mxml/flexjs/TestFlexJSMXMLApplication.java | 4 +- .../flex/compiler/internal/test/ASTestBase.java | 6 +- .../files/MyInitialView_2013_03_11_result.js | 12 +- 19 files changed, 793 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java index 27a0597..effe3d8 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java @@ -42,8 +42,6 @@ import org.junit.Test; public class TestExpressions extends ASTestBase { - // ILanguageIdentifierNode -> IIdentifierNode - @Test public void testVisitLanguageIdentifierNode_This() { @@ -466,36 +464,31 @@ public class TestExpressions extends ASTestBase // Other //---------------------------------- - @Ignore @Test public void testParentheses_1() { - // TODO (mschmalle) why aren't parentheses preserved, various math - // will come out wrong if they aren't? IVariableNode node = (IVariableNode) getNode("var a = (a + b);", IVariableNode.class); asBlockWalker.visitVariable(node); - assertOut("var a = (a + b)"); + assertOut("var a:* = (a + b)"); } - @Ignore @Test public void testParentheses_2() { IVariableNode node = (IVariableNode) getNode("var a = (a + b) - c;", IVariableNode.class); asBlockWalker.visitVariable(node); - assertOut("var a = (a + b) - c"); + assertOut("var a:* = (a + b) - c"); } - @Ignore @Test public void testParentheses_3() { IVariableNode node = (IVariableNode) getNode( "var a = ((a + b) - (c + d)) * e;", IVariableNode.class); asBlockWalker.visitVariable(node); - assertOut("var a = ((a + b) - (c + d)) * e"); + assertOut("var a:* = ((a + b) - (c + d)) * e"); } @Test http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java new file mode 100644 index 0000000..5f23314 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java @@ -0,0 +1,129 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogAccessorMembers; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.tree.as.IGetterNode; +import org.apache.flex.compiler.tree.as.ISetterNode; +import org.junit.Test; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers +{ + @Override + @Test + public void testGetAccessor() + { + IGetterNode node = (IGetterNode) getAccessor("function get foo():int{}"); + asBlockWalker.visitGetter(node); + assertOut("A.prototype.get_foo = function() {\n}"); + } + + @Override + @Test + public void testGetAccessor_withBody() + { + IGetterNode node = (IGetterNode) getAccessor("function get foo():int{return -1;}"); + asBlockWalker.visitGetter(node); + assertOut("A.prototype.get_foo = function() {\n\tvar self = this;\n\treturn -1;\n}"); + } + + @Override + @Test + public void testGetAccessor_withNamespace() + { + IGetterNode node = (IGetterNode) getAccessor("public function get foo():int{return -1;}"); + asBlockWalker.visitGetter(node); + assertOut("A.prototype.get_foo = function() {\n\tvar self = this;\n\treturn -1;\n}"); + } + + @Override + @Test + public void testGetAccessor_withNamespaceOverride() + { + IGetterNode node = (IGetterNode) getAccessor("public override function get foo():int{super.foo(); return -1;}"); + asBlockWalker.visitGetter(node); + assertOut("A.prototype.get_foo = function() {\n\tvar self = this;\n\tgoog.base(this, 'get_foo');\n\treturn -1;\n}"); + } + + @Override + @Test + public void testGetAccessor_withStatic() + { + IGetterNode node = (IGetterNode) getAccessor("public static function get foo():int{return -1;}"); + asBlockWalker.visitGetter(node); + assertOut("A.get_foo = function() {\n\tvar self = this;\n\treturn -1;\n}"); + } + + @Override + @Test + public void testSetAccessor() + { + ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{}"); + asBlockWalker.visitSetter(node); + assertOut("A.prototype.set_foo = function(value) {\n}"); + } + + @Override + @Test + public void testSetAccessor_withBody() + { + ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{fetch('haai');}"); + asBlockWalker.visitSetter(node); + assertOut("A.prototype.set_foo = function(value) {\n\tvar self = this;\n\tfetch('haai');\n}"); + } + + @Override + @Test + public void testSetAccessor_withNamespace() + { + ISetterNode node = (ISetterNode) getAccessor("public function set foo(value:int):void{}"); + asBlockWalker.visitSetter(node); + assertOut("A.prototype.set_foo = function(value) {\n}"); + } + + @Override + @Test + public void testSetAccessor_withNamespaceOverride() + { + ISetterNode node = (ISetterNode) getAccessor("public override function set foo(value:int):void{super.foo();}"); + asBlockWalker.visitSetter(node); + assertOut("A.prototype.set_foo = function(value) {\n\tvar self = this;\n\tgoog.base(this, 'set_foo');\n}"); + } + + @Override + @Test + public void testSetAccessor_withStatic() + { + ISetterNode node = (ISetterNode) getAccessor("public static function set foo(value:int):void{}"); + asBlockWalker.visitSetter(node); + assertOut("A.set_foo = function(value) {\n}"); + } + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java new file mode 100644 index 0000000..edc9fc2 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java @@ -0,0 +1,86 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.internal.test.ASTestBase; +import org.apache.flex.compiler.tree.as.IClassNode; +import org.junit.Test; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSAccessors extends ASTestBase +{ + + @Test + public void testGetAndSetAccessor() + { + IClassNode node = (IClassNode) getNode( + "public function A() {}; 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 */\nA = function() {\n};\n\nA.prototype.doStuff = function() {\n\tvar self = this;\n\tset_label('hello, bye');\n\tvar /** @type {string} */ theLabel = get_label();\n};\n\n/**\n * @private\n * @type {string}\n */\nA.prototype._label;\n\nA.prototype.get_label = function() {\n\tvar self = this;\n\treturn _label;\n};\n\nA.prototype.set_label = function(value) {\n\tvar self = this;\n\t_label = value;\n};"; + assertOut(expected); + } + + @Test + public void testSetAccessorWithMemberAccessOnLeftSide() + { + IClassNode node = (IClassNode) getNode( + "public function A() {}; 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_CLASS); + asBlockWalker.visitClass(node); + String expected = "/**\n * @constructor\n */\nA = function() {\n};\n\n/**\n * @this {A}\n */\nA.prototype.doStuff = function() {\n\tvar self = this;\n\tthis.set_label(get_label() + 'bye');\n\tvar /** @type {string} */ theLabel = get_label();\n};\n\n/**\n * @private\n * @type {string}\n */\nA.prototype._label;\n\nA.prototype.get_label = function() {\n\tvar self = this;\n\treturn _label;\n};\n\nA.prototype.set_label = function(value) {\n\tvar self = this;\n\t_label = value;\n};"; + assertOut(expected); + } + + @Test + public void testSetAccessorWithCompoundRightSide() + { + IClassNode node = (IClassNode) getNode( + "public function A() {}; 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 */\nA = function() {\n};\n\nA.prototype.doStuff = function() {\n\tvar self = this;\n\tset_label(get_label() + 'bye');\n\tvar /** @type {string} */ theLabel = get_label();\n};\n\n/**\n * @private\n * @type {string}\n */\nA.prototype._label;\n\nA.prototype.get_label = function() {\n\tvar self = this;\n\treturn _label;\n};\n\nA.prototype.set_label = function(value) {\n\tvar self = this;\n\t_label = value;\n};"; + assertOut(expected); + } + + @Test + public void testSetAccessorWithMemberAccessOnRightSide() + { + IClassNode node = (IClassNode) getNode( + "public function A() {}; 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_CLASS); + asBlockWalker.visitClass(node); + System.out.println(writer.toString()); + String expected = "/**\n * @constructor\n */\nA = function() {\n};\n\n/**\n * @this {A}\n */\nA.prototype.doStuff = function() {\n\tvar self = this;\n\tset_label(this.get_label());\n\tvar /** @type {string} */ theLabel = get_label();\n};\n\n/**\n * @private\n * @type {string}\n */\nA.prototype._label;\n\nA.prototype.get_label = function() {\n\tvar self = this;\n\treturn _label;\n};\n\nA.prototype.set_label = function(value) {\n\tvar self = this;\n\t_label = value;\n};"; + System.out.println(expected); + assertOut(expected); + } + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java new file mode 100644 index 0000000..a1a759a --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java @@ -0,0 +1,76 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogClass; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.tree.as.IClassNode; +import org.junit.Test; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSClass extends TestGoogClass +{ + + @Override + @Test + public void testAccessors() + { + IClassNode node = getClassNode("public class A {" + + "public function get foo1():Object{return null;}" + + "public function set foo1(value:Object):void{}" + + "protected function get foo2():Object{return null;}" + + "protected function set foo2(value:Object):void{}" + + "private function get foo3():Object{return null;}" + + "private function set foo3(value:Object):void{}" + + "internal function get foo5():Object{return null;}" + + "internal function set foo5(value:Object):void{}" + + "foo_bar function get foo6():Object{return null;}" + + "foo_bar function set foo6(value:Object):void{}" + "}"); + asBlockWalker.visitClass(node); + assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\norg.apache.flex.A.prototype.get_foo1 = function() {\n\tvar self = this;\n\treturn null;\n};\n\norg.apache.flex.A.prototype.set_foo1 = function(value) {\n};\n\norg.apache.flex.A.prototype.get_foo2 = function() {\n\tvar self = this;\n\treturn null;\n};\n\norg.apache.flex.A.prototype.set_foo2 = function(value) {\n};\n\norg.apache.flex.A.prototype.get_foo3 = function() {\n\tvar self = this;\n\treturn null;\n};\n\norg.apache.flex.A.prototype.set_foo3 = function(value) {\n};\n\norg.apache.flex.A.prototype.get_foo5 = function() {\n\tvar self = this;\n\treturn null;\n};\n\norg.apache.flex.A.prototype.set_foo5 = function(value) {\n};\n\norg.apache.flex.A.prototype.get_foo6 = function() {\n\tvar self = this;\n\treturn null;\n};\n\norg.apache.flex.A.prototype.set_foo6 = function(value) {\n};"); + } + + @Override + @Test + public void testMethods() + { + IClassNode node = getClassNode("public class A {" + + "public function foo1():Object{return null;}" + + "public final function foo1a():Object{return null;}" + + "override public function foo1b():Object{return super.foo1b();}" + + "protected function foo2(value:Object):void{}" + + "private function foo3(value:Object):void{}" + + "internal function foo5(value:Object):void{}" + + "foo_bar function foo6(value:Object):void{}" + + "public static function foo7(value:Object):void{}" + + "foo_bar static function foo7(value:Object):void{}" + "}"); + asBlockWalker.visitClass(node); + assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n\tvar self = this;\n\treturn null;\n};\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n\tvar self = this;\n\treturn null;\n};\n\n/**\n * @return {Object}\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n\tvar self = this;\n\treturn goog.base(this, 'foo1b');\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo6 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg .apache.flex.A.foo7 = function(value) {\n};"); + } + + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java new file mode 100644 index 0000000..97a72a1 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogEmiter; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSEmiter extends TestGoogEmiter +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java new file mode 100644 index 0000000..c96bf60 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java @@ -0,0 +1,106 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogExpressions; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.tree.as.IBinaryOperatorNode; +import org.apache.flex.compiler.tree.as.IFunctionNode; +import org.junit.Test; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSExpressions extends TestGoogExpressions +{ + + @Override + @Test + public void testVisitLanguageIdentifierNode_SuperMethod_1() + { + IFunctionNode node = getMethod("function foo(){if (a) super.foo();}"); + asBlockWalker.visitFunction(node); + assertOut("A.prototype.foo = function() {\n\tvar self = this;\n\tif (a)\n\t\tgoog.base(this, 'foo');\n}"); + } + + @Override + @Test + public void testVisitLanguageIdentifierNode_SuperMethod_2() + { + IFunctionNode node = getMethod("function foo(){if (a) super.foo(a, b, c);}"); + asBlockWalker.visitFunction(node); + assertOut("A.prototype.foo = function() {\n\tvar self = this;\n\tif (a)\n\t\tgoog.base(this, 'foo', a, b, c);\n}"); + } + + //---------------------------------- + // Primary expression keywords + //---------------------------------- + + //---------------------------------- + // Logical + //---------------------------------- + + @Override + @Test + public void testVisitBinaryOperatorNode_LogicalAndAssignment() + { + IBinaryOperatorNode node = getBinaryNode("a &&= b"); + asBlockWalker.visitBinaryOperator(node); + assertOut("a = a && b"); + } + + @Override + @Test + public void testVisitBinaryOperatorNode_LogicalOrAssignment() + { + IBinaryOperatorNode node = getBinaryNode("a ||= b"); + asBlockWalker.visitBinaryOperator(node); + assertOut("a = a || b"); + } + + //---------------------------------- + // Other + //---------------------------------- + + @Override + @Test + public void testVisitAs() + { + IBinaryOperatorNode node = getBinaryNode("a as b"); + asBlockWalker.visitBinaryOperator(node); + assertOut("(is(a, b) ? a : null)"); + } + + @Override + @Test + public void testVisitBinaryOperator_Is() + { + IBinaryOperatorNode node = getBinaryNode("a is b"); + asBlockWalker.visitBinaryOperator(node); + assertOut("is(a, b)"); + } + + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java new file mode 100644 index 0000000..3785357 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogFieldMembers; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSFieldMembers extends TestGoogFieldMembers +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java new file mode 100644 index 0000000..90e3d5b --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalClasses; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java new file mode 100644 index 0000000..24e67e5 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalConstants; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSGlobalConstants extends TestGoogGlobalConstants +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java new file mode 100644 index 0000000..00566fa --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalFunctions; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java new file mode 100644 index 0000000..e2de1df --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java @@ -0,0 +1,41 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogInterface; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * This class tests the production of valid 'goog' JS code for Interface + * production. + * + * @author Michael Schmalle + * @author Erik de Bruin + */ +public class TestFlexJSInterface extends TestGoogInterface +{ + + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java new file mode 100644 index 0000000..15310f7 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogMethodMembers; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSMethodMembers extends TestGoogMethodMembers +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java new file mode 100644 index 0000000..b0d4f8b --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java @@ -0,0 +1,49 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogPackage; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; +import org.apache.flex.compiler.tree.as.IFileNode; +import org.junit.Test; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSPackage extends TestGoogPackage +{ + + @Override + @Test + public void testPackageQualified_ClassBodyMethodContents() + { + IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){if (a){for (var i:Object in obj){doit();}}}}}"); + asBlockWalker.visitFile(node); + assertOut("goog.provide('foo.bar.baz.A');\n\n/**\n * @constructor\n */\nfoo.bar.baz.A = function() {\n\tvar self = this;\n\tif (a) {\n\t\tfor (var /** @type {Object} */ i in obj) {\n\t\t\tdoit();\n\t\t}\n\t}\n};"); + } + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java new file mode 100644 index 0000000..e367ac7 --- /dev/null +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.flex.compiler.internal.codegen.js.flexjs; + +import org.apache.flex.compiler.driver.IBackend; +import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogStatements; +import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend; + +/** + * @author Erik de Bruin + */ +public class TestFlexJSStatements extends TestGoogStatements +{ + + @Override + protected IBackend createBackend() + { + return new FlexJSBackend(); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java index e569aff..39ad702 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogExpressions.java @@ -83,6 +83,33 @@ public class TestGoogExpressions extends TestExpressions // Other //---------------------------------- + @Test + public void testParentheses_1() + { + IVariableNode node = (IVariableNode) getNode("var a = (a + b);", + IVariableNode.class); + asBlockWalker.visitVariable(node); + assertOut("var /** @type {*} */ a = (a + b)"); + } + + @Test + public void testParentheses_2() + { + IVariableNode node = (IVariableNode) getNode("var a = (a + b) - c;", + IVariableNode.class); + asBlockWalker.visitVariable(node); + assertOut("var /** @type {*} */ a = (a + b) - c"); + } + + @Test + public void testParentheses_3() + { + IVariableNode node = (IVariableNode) getNode( + "var a = ((a + b) - (c + d)) * e;", IVariableNode.class); + asBlockWalker.visitVariable(node); + assertOut("var /** @type {*} */ a = ((a + b) - (c + d)) * e"); + } + @Override @Test public void testAnonymousFunction() http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java index 5572c44..19cd3cd 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java @@ -288,6 +288,7 @@ public class TestGoogStatements extends TestStatements assertOut("goog.provide('A');\n\n/**\n * @constructor\n */\nA = function() {\n};\n\nA.prototype.a = function() {\n\tvar self = this;\n\ttry {\n\t\ta;\n\t} catch (e) {\n\t\tif (a) {\n\t\t\tif (b) {\n\t\t\t\tif (c)\n\t\t\t\t\tb;\n\t\t\t\telse if (f)\n\t\t\t\t\ta;\n\t\t\t\telse\n\t\t\t\t\te;\n\t\t\t}\n\t\t}\n\t} finally {\n\t}\n\tif (d)\n\t\tfor (var /** @type {number} */ i = 0; i < len; i++)\n\t\t\tbreak;\n\tif (a) {\n\t\twith (ab) {\n\t\t\tc();\n\t\t}\n\t\tdo {\n\t\t\ta++;\n\t\t\tdo\n\t\t\t\ta++;\n\t\t\twhile (a > b);\n\t\t} while (c > d);\n\t}\n\tif (b) {\n\t\ttry {\n\t\t\ta;\n\t\t\tthrow new Error('foo');\n\t\t} catch (e) {\n\t\t\tswitch (i) {\n\t\t\t\tcase 1:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t} finally {\n\t\t\td;\n\t\t\tvar /** @type {Object} */ a = function(foo, bar) {\n\t\t\t\tvar self = this;\n\t\t\t\tbar = typeof bar !== 'undefined' ? bar : 'goo';\n\t\t\t\treturn -1;\n\t\t\t};\n\t\t\teee.dd;\n\t\t\teee.dd;\n\t\t\teee.dd;\n\t\t\teee.d d;\n\t\t}\n\t}\n\tfoo : goog.array.forEach(obj, function (i) {\n\t\tbreak foo;\n\t});\n};"); } + @Override protected IBackend createBackend() { return new GoogBackend(); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java index 3006817..ddf143b 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java @@ -17,7 +17,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase mxmlBlockWalker.visitFile(node); - //writeResultToFile(writer.toString(), fileName); // for external comparison + writeResultToFile(writer.toString(), fileName); // for external comparison assertOut(getCodeFromFile(fileName + "_result", true, "flexjs/files")); } @@ -32,7 +32,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase mxmlBlockWalker.visitFile(node); - //writeResultToFile(writer.toString(), fileName); // for external comparison + writeResultToFile(writer.toString(), fileName); // for external comparison assertOut(getCodeFromFile(fileName + "_result", true, "flexjs/files")); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java index 6cb8a30..9b70db3 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/ASTestBase.java @@ -54,9 +54,9 @@ public class ASTestBase extends TestBase // Node "factory" //-------------------------------------------------------------------------- - private static final int WRAP_LEVEL_MEMBER = 3; - private static final int WRAP_LEVEL_CLASS = 2; - private static final int WRAP_LEVEL_PACKAGE = 1; + protected static final int WRAP_LEVEL_MEMBER = 3; + protected static final int WRAP_LEVEL_CLASS = 2; + protected static final int WRAP_LEVEL_PACKAGE = 1; protected IASNode getNode(String code, Class<? extends IASNode> type) { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/06664de8/compiler.jx.tests/test-files/flexjs/files/MyInitialView_2013_03_11_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_2013_03_11_result.js b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_2013_03_11_result.js index 7da3794..ae82674 100644 --- a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_2013_03_11_result.js +++ b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_2013_03_11_result.js @@ -129,22 +129,18 @@ MyInitialView_2013_03_11 = function() { goog.inherits(MyInitialView_2013_03_11, org.apache.flex.core.ViewBase); /** - * @this {MyInitialView_2013_03_11} - * @expose * @return {string} */ -MyInitialView_2013_03_11.prototype.get_symbol = function() -{ +MyInitialView_2013_03_11.prototype.get_symbol = function() { + var self = this; return this.list.get_selectedItem(); }; /** - * @this {MyInitialView_2013_03_11} - * @expose * @return {string} */ -MyInitialView_2013_03_11.prototype.get_inputText = function() -{ +MyInitialView_2013_03_11.prototype.get_inputText = function() { + var self = this; return this.input.get_text(); };
