flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [09/44] git commit: [flex-falcon] [refs/heads/feature-autobuild/maven-archetypes] - static accessors are now accessed via class['someStaticProperty'] instead of class.someStaticProperty
Date Fri, 21 Oct 2016 15:16:47 GMT
static accessors are now accessed via class['someStaticProperty'] instead of class.someStaticProperty


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ecd8e1cf
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ecd8e1cf
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ecd8e1cf

Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: ecd8e1cf2d0247277186433f064e636c8266eb45
Parents: 3861128
Author: Alex Harui <aharui@apache.org>
Authored: Wed Oct 5 10:55:55 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Oct 6 21:22:02 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/AccessorEmitter.java  |  6 +-----
 .../internal/codegen/js/jx/BindableEmitter.java  | 19 +++----------------
 .../codegen/js/jx/IdentifierEmitter.java         | 13 +++++++++++--
 .../js/flexjs/TestFlexJSAccessorMembers.java     |  4 ++--
 .../codegen/js/flexjs/TestFlexJSExpressions.java | 10 +++++-----
 5 files changed, 22 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ecd8e1cf/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
index de8e86b..0b82abb 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
@@ -438,11 +438,7 @@ public class AccessorEmitter extends JSSubEmitter implements
                         propName);
                 IGetterNode getterNode = p.getter;
                 ISetterNode setterNode = p.setter;
-                // @expose is supposed to be deprecated, so this isn't ideal,
-                // but @export and/or @nocollapse were not working in a release
-                // build with ADVANCED_OPTIMIZATIONS, so I don't know what else
-                // to do. maybe it's a bug in closure compiler... -JT
-                writeNewline("/** @expose */");
+                writeNewline("/** @export */");
                 write(propName);
                 write(ASEmitterTokens.COLON);
                 write(ASEmitterTokens.SPACE);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ecd8e1cf/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
index 8625733..8f26835 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
@@ -279,11 +279,7 @@ public class BindableEmitter extends JSSubEmitter implements
         // export above did not work in the release build for the static getter/setter bindables,
         // solution below:
         //Commented by JT, in AccessorEmitter:
-        // @expose is supposed to be deprecated, so this isn't ideal,
-        // but @export and/or @nocollapse were not working in a release
-        // build with ADVANCED_OPTIMIZATIONS, so I don't know what else
-        // to do. maybe it's a bug in closure compiler... -JT
-        writeNewline("/** @expose");
+        writeNewline("/** @export");
         writeNewline("  * @type {"+DISPATCHER_CLASS_QNAME+"} */");
         write(STATIC_DISPATCHER_GETTER);
         write(ASEmitterTokens.COLON);
@@ -361,20 +357,11 @@ public class BindableEmitter extends JSSubEmitter implements
         String qname = fjs.formatQualifiedName(cdef.getQualifiedName());
         // 'PropName': {
 
-        //writeNewline("/** @export */");
-        // export above did not work in the release build for the static getter/setter bindables,
-        // solution below:
-        //Commented by JT, in AccessorEmitter:
-        // @expose is supposed to be deprecated, so this isn't ideal,
-        // but @export and/or @nocollapse were not working in a release
-        // build with ADVANCED_OPTIMIZATIONS, so I don't know what else
-        // to do. maybe it's a bug in closure compiler... -JT
-
         if (info.namespace != "public") {
-            writeNewline("/** @expose");
+            writeNewline("/** @export");
             writeNewline("  * @private");
         } else {
-            writeNewline("/** @expose");
+            writeNewline("/** @export");
         }
 
         writeNewline("  * @type {"+convertASTypeToJS(info.type)+"} */");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ecd8e1cf/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
index 89f0c00..7573db4 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
@@ -76,11 +76,12 @@ public class IdentifierEmitter extends JSSubEmitter implements
         boolean emitName = true;
     	JSFlexJSEmitter fjs = (JSFlexJSEmitter)getEmitter();
     	boolean isCustomNamespace = false;
+    	boolean isStatic = nodeDef != null && nodeDef.isStatic();
         if (nodeDef instanceof FunctionDefinition &&
           	  fjs.isCustomNamespace((FunctionDefinition)nodeDef))
           	isCustomNamespace = true;
 
-        if (nodeDef != null && nodeDef.isStatic())
+        if (isStatic)
         {
             String sname = nodeDef.getParent().getQualifiedName();
             if (sname.equals("Array"))
@@ -175,7 +176,7 @@ public class IdentifierEmitter extends JSSubEmitter implements
                     endMapping(prevSibling);
                     startMapping(parentNode, prevSibling);
                 }
-                if (!isCustomNamespace)
+                if (!isCustomNamespace && (!(identifierIsAccessorFunction &&
isStatic)))
                 	write(ASEmitterTokens.MEMBER_ACCESS);
                 endMapping(parentNode);
             }
@@ -293,6 +294,10 @@ public class IdentifierEmitter extends JSSubEmitter implements
                     	String ns = ((FunctionDefinition)nodeDef).getNamespaceReference().resolveAETNamespace(getProject()).getName();
                     	write("[\"" + ns + "::" + qname + "\"]");
                     }
+                    else if (identifierIsAccessorFunction && isStatic)
+                    {
+                    	write("[\"" +node.getName() + "\"]");                    	
+                    }
                 	else
                 	{
                 		write(node.getName());
@@ -307,6 +312,10 @@ public class IdentifierEmitter extends JSSubEmitter implements
                 	String ns = ((FunctionDefinition)nodeDef).getNamespaceReference().resolveAETNamespace(getProject()).getName();
                 	write("[\"" + ns + "::" + qname + "\"]");
                 }
+                else if (identifierIsAccessorFunction && isStatic)
+                {
+                	write("[\"" + qname + "\"]");                    	
+                }
                 else
                     write(qname);
                 endMapping(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ecd8e1cf/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
index f4b0513..e7ad931 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
@@ -98,7 +98,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
         asBlockWalker.visitClass(node);
         assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n" +
 				"FalconTest_A.get__foo = function() {\n  return -1;\n};\n\n\n" +
-        		"Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose
*/\nfoo: {\nget: FalconTest_A.get__foo}}\n);");
+        		"Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @export
*/\nfoo: {\nget: FalconTest_A.get__foo}}\n);");
     }
 
     @Override
@@ -158,7 +158,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
         asBlockWalker.visitClass(node);
         assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n" +
 				"FalconTest_A.set__foo = function(value) {\n};\n\n\n" +
-        		"Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose
*/\nfoo: {\nset: FalconTest_A.set__foo}}\n);");
+        		"Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @export
*/\nfoo: {\nset: FalconTest_A.set__foo}}\n);");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ecd8e1cf/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 def28f7..60fdb20 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
@@ -465,7 +465,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                 node, IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("foo.bar.B.b = 1");
+        assertOut("foo.bar.B[\"b\"] = 1");
     }
 
     @Test
@@ -477,7 +477,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                 node, IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("foo.bar.B.b = 1");
+        assertOut("foo.bar.B[\"b\"] = 1");
     }
 
     @Test
@@ -489,7 +489,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                 node, IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("foo.bar.B.d.b = 1");
+        assertOut("foo.bar.B[\"d\"].b = 1");
     }
 
     @Test
@@ -513,7 +513,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
 
         ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("foo.bar.B.d.b = 1");
+        assertOut("foo.bar.B[\"d\"].b = 1");
     }
 
     @Test
@@ -525,7 +525,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
                 node, IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("foo.bar.B.b = foo.bar.B.b + 1");
+        assertOut("foo.bar.B[\"b\"] = foo.bar.B[\"b\"] + 1");
     }
 
     @Test


Mime
View raw message