flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [8/8] git commit: one last fix for emitIdentifier
Date Fri, 12 Apr 2013 07:02:34 GMT
one last fix for emitIdentifier


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

Branch: refs/heads/develop
Commit: 1b5195a6baa5c38af1a3ed0f750097e163650834
Parents: 83c2c12
Author: Alex Harui <aharui@apache.org>
Authored: Fri Apr 12 00:01:43 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Apr 12 00:01:43 2013 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java         |   42 ++++++++++++--
 1 files changed, 36 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1b5195a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 989595f..91bc345 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -412,11 +412,41 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             IASNode anode = node
                     .getAncestorOfType(BinaryOperatorAssignmentNode.class);
 
-            boolean isLeftSide = anode != null
-                    && (pnode.equals(anode.getChild(0)) || node.equals(anode
-                            .getChild(0)));
+            boolean isAssignment = false;
+            if (anode != null)
+            {
+            	IASNode leftNode = anode.getChild(0);
+            	if (anode == pnode)
+            	{
+            		if (node == leftNode)
+            			isAssignment = true;
+            	}
+            	else
+            	{
+	            	IASNode parentNode = pnode;
+	            	IASNode thisNode = node;
+	            	while (anode != parentNode)
+	            	{
+	            		if (parentNode instanceof IMemberAccessExpressionNode)
+	            		{
+	            			if (thisNode != parentNode.getChild(1))
+	            			{
+	            				// can't be an assignment because 
+	            				// we're on the left side of a memberaccessexpression
+	            				break;
+	            			}
+	            		}
+	            		if (parentNode == leftNode)
+	            		{
+	            			isAssignment = true;
+	            		}
+	            		thisNode = parentNode;
+	            		parentNode = parentNode.getParent();
+	            	}
+            	}
+            }
 
-            writeGetSetPrefix(!(anode != null && isLeftSide));
+            writeGetSetPrefix(!isAssignment);
             write(node.getName());
             write(ASEmitterTokens.PAREN_OPEN);
 
@@ -424,7 +454,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
 
             if (anode != null)
             {
-                if (isLeftSide)
+                if (isAssignment)
                 {
                     rightSide = ((BinaryOperatorAssignmentNode) anode)
                             .getRightOperandNode();
@@ -441,7 +471,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             write(ASEmitterTokens.PAREN_CLOSE);
 
             if (anode != null
-                    && !isLeftSide && pnode instanceof IBinaryOperatorNode
+                    && !isAssignment && pnode instanceof IBinaryOperatorNode
                     && !(pnode instanceof IMemberAccessExpressionNode))
             {
                 rightSide = ((IBinaryOperatorNode) pnode).getRightOperandNode();


Mime
View raw message