flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/2] git commit: [flex-falcon] [refs/heads/develop] - FLEX-34897 maintain scope when assigning methods to vars (attempt #2)
Date Tue, 30 Jun 2015 05:18:22 GMT
FLEX-34897 maintain scope when assigning methods to vars (attempt #2)


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

Branch: refs/heads/develop
Commit: 70bc7d8a01fe4634a033ba5ee5f81ba11350cdfb
Parents: 1b8d9bb
Author: Alex Harui <aharui@apache.org>
Authored: Mon Jun 29 22:16:46 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Jun 29 22:16:46 2015 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/goog/JSGoogEmitter.java  | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/70bc7d8a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 12bfb7e..c45cb3f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -40,10 +40,13 @@ import org.apache.flex.compiler.internal.codegen.js.JSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSessionModel;
 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.scopes.PackageScope;
 import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
+import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.scopes.IASScope;
@@ -858,14 +861,26 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         {
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
+            IDefinition definition = node.resolve(getWalker().getProject());
             if (node.getNodeID() == ASTNodeID.ClassReferenceID)
             {
-                IDefinition definition = node.resolve(getWalker().getProject());
                 write(definition.getQualifiedName());
             }
             else
             {
-                getWalker().walk(node);
+            	if (definition instanceof FunctionDefinition &&
+            			(!(definition instanceof AccessorDefinition)) &&
+            			node instanceof MemberAccessExpressionNode)
+            	{
+                    write(JSGoogEmitterTokens.GOOG_BIND);
+                    write(ASEmitterTokens.PAREN_OPEN);
+            		getWalker().walk(node);
+                    writeToken(ASEmitterTokens.COMMA);
+            		getWalker().walk(((MemberAccessExpressionNode)node).getLeftOperandNode());
+                    write(ASEmitterTokens.PAREN_CLOSE);
+            	}
+            	else
+            		getWalker().walk(node);
             }
         }
     }


Mime
View raw message