You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/03/08 06:34:40 UTC
[1/2] git commit: [flex-falcon] [refs/heads/develop] - fix some tests
now that we have better error checking
Repository: flex-falcon
Updated Branches:
refs/heads/develop 445854b7e -> 85a170101
fix some tests now that we have better error checking
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/fde03868
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/fde03868
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/fde03868
Branch: refs/heads/develop
Commit: fde038685889b3d9e821937143e14bb5fd9e7cbb
Parents: 445854b
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 7 22:34:03 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 7 22:34:03 2017 -0800
----------------------------------------------------------------------
.../mxml/flexjs/TestFlexJSMXMLApplication.java | 44 ++++++++++++++++----
1 file changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fde03868/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index 8cb54be..d49661d 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -297,7 +297,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+ "<fx:Script><![CDATA["
+ " import org.apache.flex.net.HTTPConstants;"
- + "]]></fx:Script><basic:initialView><basic:Label text=\"{HTTPConstants.GET}\"/></basic:initialView></basic:Application>";
+ + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{HTTPConstants.GET}\"/></basic:View></basic:initialView></basic:Application>";
IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -316,6 +316,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
"goog.provide('AppName');\n" +
"\n" +
"goog.require('org.apache.flex.core.Application');\n" +
+ "goog.require('org.apache.flex.core.View');\n" +
"goog.require('org.apache.flex.html.Label');\n" +
"goog.require('org.apache.flex.net.HTTPConstants');\n" +
"\n" +
@@ -330,6 +331,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" \n" +
" /**\n" +
" * @private\n" +
+ " * @type {org.apache.flex.core.View}\n" +
+ " */\n" +
+ " this.$ID1_;\n" +
+ " \n" +
+ " /**\n" +
+ " * @private\n" +
" * @type {org.apache.flex.html.Label}\n" +
" */\n" +
" this.$ID0_;\n" +
@@ -350,7 +357,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" ([1,\n" +
"'initialView',\n" +
"false,\n" +
- "[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+ "[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
"0,\n" +
"0\n" +
" ]);\n" +
@@ -412,7 +419,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+ "<fx:Script><![CDATA["
+ " import org.apache.flex.net.HTTPConstants;"
- + "]]></fx:Script><basic:initialView><basic:Label text=\"{org.apache.flex.net.HTTPConstants.GET}\"/></basic:initialView></basic:Application>";
+ + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{org.apache.flex.net.HTTPConstants.GET}\"/></basic:View></basic:initialView></basic:Application>";
IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -431,6 +438,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
"goog.provide('AppName');\n" +
"\n" +
"goog.require('org.apache.flex.core.Application');\n" +
+ "goog.require('org.apache.flex.core.View');\n" +
"goog.require('org.apache.flex.html.Label');\n" +
"goog.require('org.apache.flex.net.HTTPConstants');\n" +
"\n" +
@@ -445,6 +453,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" \n" +
" /**\n" +
" * @private\n" +
+ " * @type {org.apache.flex.core.View}\n" +
+ " */\n" +
+ " this.$ID1_;\n" +
+ " \n" +
+ " /**\n" +
+ " * @private\n" +
" * @type {org.apache.flex.html.Label}\n" +
" */\n" +
" this.$ID0_;\n" +
@@ -465,7 +479,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" ([1,\n" +
"'initialView',\n" +
"false,\n" +
- "[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+ "[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
"0,\n" +
"0\n" +
" ]);\n" +
@@ -528,7 +542,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
+ "<fx:Script><![CDATA["
+ " import binding.ComplexValueObject;\n"
+ " public var firstOne:ComplexValueObject;\n"
- + "]]></fx:Script><basic:initialView><basic:Label text=\"{firstOne.subObject.labelText}\"/></basic:initialView></basic:Application>";
+ + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{firstOne.subObject.labelText}\"/></basic:View></basic:initialView></basic:Application>";
IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -547,6 +561,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
"goog.provide('AppName');\n" +
"\n" +
"goog.require('org.apache.flex.core.Application');\n" +
+ "goog.require('org.apache.flex.core.View');\n" +
"goog.require('org.apache.flex.html.Label');\n" +
"goog.require('binding.ComplexValueObject');\n" +
"\n" +
@@ -561,6 +576,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" \n" +
" /**\n" +
" * @private\n" +
+ " * @type {org.apache.flex.core.View}\n" +
+ " */\n" +
+ " this.$ID1_;\n" +
+ " \n" +
+ " /**\n" +
+ " * @private\n" +
" * @type {org.apache.flex.html.Label}\n" +
" */\n" +
" this.$ID0_;\n" +
@@ -581,7 +602,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" ([1,\n" +
"'initialView',\n" +
"false,\n" +
- "[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+ "[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
"0,\n" +
"0\n" +
" ]);\n" +
@@ -676,7 +697,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+ "<fx:Script><![CDATA["
+ " public var xml:XML = new XML();\n"
- + "]]></fx:Script><basic:initialView><basic:Label text=\"Hello World\"/></basic:initialView></basic:Application>";
+ + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"Hello World\"/></basic:View></basic:initialView></basic:Application>";
IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -695,6 +716,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
"goog.provide('AppName');\n" +
"\n" +
"goog.require('org.apache.flex.core.Application');\n" +
+ "goog.require('org.apache.flex.core.View');\n" +
"goog.require('org.apache.flex.html.Label');\n" +
"goog.require('XML');\n" +
"goog.require('XML');\n" +
@@ -711,6 +733,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" this.xml = new XML();\n" +
" /**\n" +
" * @private\n" +
+ " * @type {org.apache.flex.core.View}\n" +
+ " */\n" +
+ " this.$ID1_;\n" +
+ " \n" +
+ " /**\n" +
+ " * @private\n" +
" * @type {org.apache.flex.html.Label}\n" +
" */\n" +
" this.$ID0_;\n" +
@@ -731,7 +759,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
" ([1,\n" +
"'initialView',\n" +
"false,\n" +
- "[org.apache.flex.html.Label, 2, '_id', true, '$ID0', 'text', true, 'Hello World', 0, 0, null],\n" +
+ "[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 2, '_id', true, '$ID0', 'text', true, 'Hello World', 0, 0, null]],\n" +
"0,\n" +
"0\n" +
" ]);\n" +
[2/2] git commit: [flex-falcon] [refs/heads/develop] - handle a few
more cases with super
Posted by ah...@apache.org.
handle a few more cases with super
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/85a17010
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/85a17010
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/85a17010
Branch: refs/heads/develop
Commit: 85a170101d19dcfe51a177fdb21e34bc9bc43c94
Parents: fde0386
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 7 22:34:21 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 7 22:34:21 2017 -0800
----------------------------------------------------------------------
.../internal/codegen/js/goog/JSGoogEmitter.java | 3 +-
.../codegen/js/jx/MemberAccessEmitter.java | 16 ++++++-
.../js/flexjs/TestFlexJSExpressions.java | 45 ++++++++++++++++++++
3 files changed, 62 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 8486ab0..98a4015 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -909,7 +909,8 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
if (definition instanceof FunctionDefinition &&
!((FunctionDefinition)definition).isStatic() &&
(!(definition instanceof AccessorDefinition)) &&
- node instanceof MemberAccessExpressionNode)
+ node instanceof MemberAccessExpressionNode &&
+ ((MemberAccessExpressionNode)node).getLeftOperandNode().getNodeID() != ASTNodeID.SuperID)
{
emitClosureStart();
getWalker().walk(node);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 0c37490..2f5f278 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -269,7 +269,10 @@ public class MemberAccessEmitter extends JSSubEmitter implements
{
write(ASEmitterTokens.COMMA);
write(ASEmitterTokens.SPACE);
- writeLeftSide(node, leftNode, rightNode);
+ if (leftNode.getNodeID() == ASTNodeID.SuperID)
+ write(ASEmitterTokens.THIS);
+ else
+ writeLeftSide(node, leftNode, rightNode);
getEmitter().emitClosureEnd(node, def);
}
@@ -311,6 +314,17 @@ public class MemberAccessEmitter extends JSSubEmitter implements
write(ASEmitterTokens.PAREN_CLOSE);
return false;
}
+ else if (leftNode.getNodeID() == ASTNodeID.SuperID
+ && (rightDef != null && rightDef instanceof FunctionDefinition))
+ {
+ write(getEmitter().formatQualifiedName(
+ getEmitter().getModel().getCurrentClass().getQualifiedName()));
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSGoogEmitterTokens.SUPERCLASS);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(rightDef.getBaseName());
+ return false;
+ }
}
else
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 3331fc6..17c9940 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -102,6 +102,51 @@ public class TestFlexJSExpressions extends TestGoogExpressions
assertOut("/**\n */\nFalconTest_A.prototype[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo\"] = function() {\n if (a)\n FalconTest_A.superClass_['http://www.adobe.com/2006/actionscript/flash/proxy::setProperty'].apply(this, [ a, b] );\n}");
}
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMethodAsFunctionReference()
+ {
+ IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {var f:Function = super.foo;} } }\n" +
+ "class Base { public function foo(){} }", IFileNode.class, 0, false);
+ IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+ node, IFunctionNode.class);
+ IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+ node, IClassNode.class);
+ IClassDefinition def = classnode.getDefinition();
+ ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+ asBlockWalker.visitFunction(fnode);
+ assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n var /** @type {Function} */ f = org.apache.flex.utils.Language.closure(FalconTest_A.superClass_.foo, this, 'foo');\n}");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMethodAsVarFunctionReference()
+ {
+ IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {var f:Function; f = super.foo;} } }\n" +
+ "class Base { public function foo(){} }", IFileNode.class, 0, false);
+ IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+ node, IFunctionNode.class);
+ IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+ node, IClassNode.class);
+ IClassDefinition def = classnode.getDefinition();
+ ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+ asBlockWalker.visitFunction(fnode);
+ assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n var /** @type {Function} */ f;\n f = org.apache.flex.utils.Language.closure(FalconTest_A.superClass_.foo, this, 'foo');\n}");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMethodInApply()
+ {
+ IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {super.foo.apply(this, [a, b, c]);} } }\n" +
+ "class Base { public function foo(){} }", IFileNode.class, 0, false);
+ IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+ node, IFunctionNode.class);
+ IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+ node, IClassNode.class);
+ IClassDefinition def = classnode.getDefinition();
+ ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+ asBlockWalker.visitFunction(fnode);
+ assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n FalconTest_A.superClass_.foo.apply(this, [a, b, c]);\n}");
+ }
+
//----------------------------------
// Primary expression keywords
//----------------------------------