flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [08/18] git commit: [flex-falcon] [refs/heads/feature/maven-migration-test] - FLEX-35071 some XML method names resolve against instance methods and add an extra 'this'
Date Thu, 14 Apr 2016 07:46:37 GMT
FLEX-35071 some XML method names resolve against instance methods and add an extra 'this'


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

Branch: refs/heads/feature/maven-migration-test
Commit: fd872052619305dcb4498eef5207f2b36c595d64
Parents: 0b74b6a
Author: Alex Harui <aharui@apache.org>
Authored: Wed Apr 13 09:40:00 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Apr 13 09:40:00 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java    | 2 +-
 .../flex/compiler/internal/codegen/js/JSSessionModel.java      | 2 ++
 .../compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java   | 2 ++
 .../flex/compiler/internal/codegen/js/utils/EmitterUtils.java  | 6 ++++++
 4 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd872052/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index de10f74..ba03b6d 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -527,7 +527,7 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
     @Test
     public void testXMLFilterWithAttribute()
     {
-    	IBinaryOperatorNode node = getBinaryNode("var a:XMLList; a = a.(attribute('name').length());");
+    	IBinaryOperatorNode node = (IBinaryOperatorNode)getNode("private var attribute:Function;
private function test() {var a:XMLList; a = a.(attribute('name').length())};", IBinaryOperatorNode.class,
WRAP_LEVEL_CLASS);
         asBlockWalker.visitBinaryOperator(node);
         assertOut("a = a.filter(function(node){return (node.attribute('name').length())})");
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd872052/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
index 5c45227..acd8232 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
@@ -60,6 +60,8 @@ public class JSSessionModel
     }
     private Stack<Context> stack = new Stack<Context>();
     
+    public boolean inE4xFilter = false;
+    
     private LinkedHashMap<String, PropertyNodes> propertyMap = new LinkedHashMap<String,
PropertyNodes>();
 
     private List<String> interfacePropertyMap = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd872052/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 99114b3..c954e2c 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
@@ -658,6 +658,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     @Override
     public void emitE4XFilter(IMemberAccessExpressionNode node)
     {
+    	getModel().inE4xFilter = true;
     	getWalker().walk(node.getLeftOperandNode());
     	write(".filter(function(node){return (node.");
     	String s = stringifyNode(node.getRightOperandNode());
@@ -665,6 +666,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     		s = s.substring(1, s.length() - 1);
     	write(s);
     	write(")})");
+    	getModel().inE4xFilter = false;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd872052/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
index ebe21ee..eb09a06 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
@@ -345,6 +345,12 @@ public class EmitterUtils
         }
         else
         {
+        	if (parentNodeId == ASTNodeID.FunctionCallID && model.inE4xFilter)
+        	{
+        		// instance methods must be qualified with 'this'?
+        		// or maybe we need to test if identifier exists on XML/XMLList
+        		return false;
+        	}
             if (nodeDef != null && !nodeDef.isInternal()
                     && isClassMember(project, nodeDef, classNode))
             {


Mime
View raw message