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/08/06 05:28:35 UTC

git commit: [flex-falcon] [refs/heads/develop] - improve handling of XML function

Repository: flex-falcon
Updated Branches:
  refs/heads/develop f5d0e2aab -> daf3a340b


improve handling of XML function


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

Branch: refs/heads/develop
Commit: daf3a340bc220a17e0a1df94be789f827ff9fcb1
Parents: f5d0e2a
Author: Alex Harui <ah...@apache.org>
Authored: Fri Aug 5 22:28:18 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Aug 5 22:28:18 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/FunctionCallEmitter.java    |  4 +++-
 .../codegen/js/flexjs/TestFlexJSGlobalClasses.java     |  4 ++--
 .../codegen/js/flexjs/TestFlexJSGlobalFunctions.java   | 13 +++++++++++--
 3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daf3a340/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index 19d35d8..0d34a3d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -101,7 +101,9 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                 def = node.getNameNode().resolve(getProject());
 
                 isClassCast = (def instanceof ClassDefinition || def instanceof InterfaceDefinition)
-                        && !(NativeUtils.isJSNative(def.getBaseName()));
+                        && !(NativeUtils.isJSNative(def.getBaseName()))
+                        && !def.getBaseName().equals(IASLanguageConstants.XML)
+                        && !def.getBaseName().equals(IASLanguageConstants.XMLList);
             }
 
             if (node.isNewExpression())

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daf3a340/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index 504674f..5e2d3a9 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -421,7 +421,7 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
     {
         IUnaryOperatorNode node = getUnaryNode("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:Object = { xml: a};delete XML(b.xml).child.grandchild;");
         asBlockWalker.visitUnaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.as(b.xml, XML, true).child('child').removeChild('grandchild')");
+        assertOut("XML(b.xml).child('child').removeChild('grandchild')");
     }
     
     @Test
@@ -462,7 +462,7 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
     {
         IUnaryOperatorNode node = getUnaryNode("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:Object = { xml: a};delete XML(b.xml).child.grandchild[0];");
         asBlockWalker.visitUnaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.as(b.xml, XML, true).child('child').child('grandchild').removeChildAt(0)");
+        assertOut("XML(b.xml).child('child').child('grandchild').removeChildAt(0)");
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daf3a340/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
index f1be070..578ecfc 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
@@ -22,6 +22,8 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalFunctions;
 import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
@@ -34,6 +36,15 @@ import org.junit.Test;
 public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
 {
     @Override
+    public void setUp()
+    {
+    	project = new FlexJSProject(workspace);
+    	((FlexJSProject)project).config = new JSGoogConfiguration();
+    	project.setProxyBaseClass("flash.utils.Proxy");
+        super.setUp();
+    }
+	
+    @Override
     @Test
     public void testArray()
     {
@@ -183,7 +194,6 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
         assertOut("var /** @type {Array} */ a = ['Hello', 'World'].slice()");
     }
 
-    @Ignore
     @Override
     @Test
     public void testXML()
@@ -201,7 +211,6 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
         assertOut("var /** @type {XML} */ a = XML('@')");
     }
 
-    @Ignore
     @Override
     @Test
     public void testXMLList()