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 2016/10/10 17:20:55 UTC

git commit: [flex-falcon] [refs/heads/develop] - try to fix internal var output

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 4a2a54244 -> e40f95df6


try to fix internal var output


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

Branch: refs/heads/develop
Commit: e40f95df64afd3f8cc91de66423683c6f9cb9c0c
Parents: 4a2a542
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 10 10:20:40 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Oct 10 10:20:40 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/IdentifierEmitter.java        | 11 +++++++++++
 .../codegen/js/flexjs/TestFlexJSExpressions.java         | 10 ++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e40f95df/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 7573db4..6b5418f 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
@@ -36,7 +36,11 @@ import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.definitions.TypeDefinitionBase;
+import org.apache.flex.compiler.internal.scopes.CatchScope;
+import org.apache.flex.compiler.internal.scopes.FunctionScope;
+import org.apache.flex.compiler.internal.scopes.TypeScope;
 import org.apache.flex.compiler.internal.tree.as.NonResolvingIdentifierNode;
+import org.apache.flex.compiler.scopes.IASScope;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
@@ -77,6 +81,13 @@ 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/e40f95df/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 60fdb20..291a845 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,6 +287,16 @@ public class TestFlexJSExpressions extends TestGoogExpressions
     }
 
     @Test
+    public void testVisitBinaryOperatorNode_setterAssignmentFromInternalVae()
+    {
+        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("B.b = B.b + 1");
+    }
+
+    @Test
     public void testVisitBinaryOperatorNode_bindableAssignment()
     {
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(