flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [16/18] git commit: [flex-falcon] [refs/heads/develop] - re-fix FLEX-34771 in defineProp and add test
Date Wed, 08 Apr 2015 23:05:22 GMT
re-fix FLEX-34771 in defineProp and add test


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

Branch: refs/heads/develop
Commit: 6e79a10d3b44c29fb393d67a603810d0717cd1c6
Parents: 4d501de
Author: Alex Harui <aharui@apache.org>
Authored: Wed Apr 8 08:01:20 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Apr 8 08:01:20 2015 -0700

----------------------------------------------------------------------
 .../internal/codegen/mxml/TestMXMLScript.java   |  1 -
 .../mxml/flexjs/TestFlexJSMXMLScript.java       | 51 ++++++++++++++++++++
 .../compiler/internal/test/FlexJSTestBase.java  |  2 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  6 +++
 .../internal/codegen/js/goog/JSGoogEmitter.java | 13 ++++-
 5 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
index 9b03d9a..3e49131 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
@@ -103,5 +103,4 @@ public class TestMXMLScript extends MXMLTestBase
 //
 //        assertOut("<script><![CDATA[\n\tvar n:int = 3;\n\tfor (var i:int = 0;
i < n; i++) {\n\tAlert.show(\"Hi\");\n};\n]]></script>");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
new file mode 100644
index 0000000..8984cd4
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
@@ -0,0 +1,51 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
+import org.apache.flex.compiler.internal.test.FlexJSTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.junit.Test;
+
+public class TestFlexJSMXMLScript extends FlexJSTestBase
+{
+
+    @Test
+    public void testSuperInScript()
+    {
+        String code = "" + "<fx:Script><![CDATA["
+                + "    override public function addedToParent():void {"
+                + "    super.addedToParent();}"
+                + "]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, FlexJSTestBase.WRAP_LEVEL_DOCUMENT);
+
+        IMXMLDocumentNode dnode = (IMXMLDocumentNode) node
+        	.getAncestorOfType(IMXMLDocumentNode.class);
+        ((JSFlexJSEmitter)(mxmlBlockWalker.getASEmitter())).thisClass = dnode.getDefinition();
+        mxmlBlockWalker.visitDocument(dnode);
+        String appName = dnode.getQualifiedName();
+        String outTemplate = "/**\n * AppName\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n
*/\n\ngoog.provide('AppName');\n\ngoog.require('org_apache_flex_core_Application');\n\n\n\n\n/**\n
* @constructor\n * @extends {org_apache_flex_core_Application}\n */\nAppName = function()
{\n  AppName.base(this, 'constructor');\n  \n  /**\n   * @private\n   * @type {Array}\n  
*/\n  this.mxmldd;\n  \n  /**\n   * @private\n   * @type {Array}\n   */\n  this.mxmldp;\n};\ngoog.inherits(AppName,
org_apache_flex_core_Application);\n\n\n/**\n * Metadata\n *\n * @type {Object.<string,
Array.<Object>>}\n */\nAppName.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'AppName',
qName: 'AppName' }] };\n\n\n/**\n * @expose\n * @override\n */\nAppName.prototype.addedToParent
= function() {\n  AppName.base(this, 'addedToParent');\n};\n\n\n";
+        	
+        assertOut(outTemplate.replaceAll("AppName", appName));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
index 0f6e6d0..8ce033d 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
@@ -103,7 +103,7 @@ public class FlexJSTestBase extends TestBase
     {
         if (wrapLevel >= WRAP_LEVEL_DOCUMENT)
             code = ""
-                    + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+                    + "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
                     + code + "</basic:Application>";
 
         IMXMLFileNode node = compileMXML(code);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/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 d78c83f..792287b 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
@@ -2160,4 +2160,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     	name = name.replaceAll("\\.", "_");
     	return name;
     }
+    
+    @Override
+    protected IDefinition getClassDefinition()
+    {
+    	return thisClass;
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/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 b253fbc..ebe7c4e 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
@@ -665,7 +665,13 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         IClassNode cnode = (IClassNode) node
                 .getAncestorOfType(IClassNode.class);
 
-        write(formatQualifiedName(cnode.getQualifiedName()));
+        if (cnode == null)
+        {
+        	IDefinition cdef = getClassDefinition();
+            write(formatQualifiedName(cdef.getQualifiedName()));
+        }
+        else
+        	write(formatQualifiedName(cnode.getQualifiedName()));
         write(ASEmitterTokens.MEMBER_ACCESS);
         write(JSGoogEmitterTokens.GOOG_BASE);
         write(ASEmitterTokens.PAREN_OPEN);
@@ -1166,5 +1172,10 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
     {
     	return name;
     }
+    
+    protected IDefinition getClassDefinition()
+    {
+    	return null;
+    }
 
 }


Mime
View raw message