flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - better fix for internal vars
Date Mon, 10 Oct 2016 17:52:59 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop e40f95df6 -> 557cd7978


better fix for internal vars


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

Branch: refs/heads/develop
Commit: 557cd79780944c7b72ba20695cd8c704b8fff435
Parents: e40f95d
Author: Alex Harui <aharui@apache.org>
Authored: Mon Oct 10 10:52:49 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Oct 10 10:52:49 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/IdentifierEmitter.java       |  7 -------
 .../internal/codegen/js/utils/EmitterUtils.java         |  5 ++++-
 .../codegen/js/flexjs/TestFlexJSExpressions.java        | 12 +++++++++++-
 3 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/557cd797/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 6b5418f..0b27b39 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
@@ -81,13 +81,6 @@ public class IdentifierEmitter extends JSSubEmitter implements
     	JSFlexJSEmitter fjs = (JSFlexJSEmitter)getEmitter();
     	boolean isCustomNamespace = false;
     	boolean isStatic = nodeDef != null && nodeDef.isStatic();
-    	if (nodeDef != null && nodeDef.isInternal())
-    	{
-    		IASScope nodeScope = nodeDef.getContainingScope();
-    		if (!(((nodeScope instanceof FunctionScope) || // other scopes may need to be added
here
-    		   (nodeScope instanceof CatchScope))))
-    			isStatic = true; // internal vars are output like statick vars
-    	}
         if (nodeDef instanceof FunctionDefinition &&
           	  fjs.isCustomNamespace((FunctionDefinition)nodeDef))
           	isCustomNamespace = true;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/557cd797/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
index 635c6c0..82f8165 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
@@ -381,7 +381,7 @@ public class EmitterUtils
         		// or maybe we need to test if identifier exists on XML/XMLList
         		return false;
         	}
-            if (nodeDef != null && !nodeDef.isInternal()
+            if (nodeDef != null
                     && isClassMember(project, nodeDef, classNode))
             {
                 if (identifierIsMemberAccess)
@@ -406,6 +406,9 @@ public class EmitterUtils
     public static boolean isClassMember(ICompilerProject project,
             IDefinition nodeDef, IClassNode classNode)
     {
+    	if (nodeDef.isInternal() && (!(nodeDef.getParent() instanceof ClassDefinition)))
+    		return false;
+    	
         TypeScope cscope = (TypeScope) classNode.getDefinition()
                 .getContainedScope();
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/557cd797/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 291a845..ff2d7fd 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
@@ -287,12 +287,22 @@ public class TestFlexJSExpressions extends TestGoogExpressions
     }
 
     @Test
-    public void testVisitBinaryOperatorNode_setterAssignmentFromInternalVae()
+    public void testVisitBinaryOperatorNode_setterAssignmentFromInternalVar()
     {
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
                 "public class B {var b:int; public function c() { b = b + 1; }}",
                 IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
         asBlockWalker.visitBinaryOperator(node);
+        assertOut("this.b = this.b + 1");
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_staticSetterAssignmentFromInternalVar()
+    {
+        IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
+                "public class B {static var b:int; public function c() { b = b + 1; }}",
+                IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
+        asBlockWalker.visitBinaryOperator(node);
         assertOut("B.b = B.b + 1");
     }
 


Mime
View raw message