flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [2/3] git commit: [flex-falcon] [refs/heads/develop] - Adopt FalconJX to the new '[qname].base' instead of the 'goog.base' calls, so the output JS is more ES5 strict mode compliant.
Date Wed, 25 Jun 2014 15:38:44 GMT
Adopt FalconJX to the new '[qname].base' instead of the 'goog.base' calls, so the output JS
is more ES5 strict mode compliant.

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 507d5eb8f5fb6d49f0886e45c5bf73c4243eda1b
Parents: 013211f
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Wed Jun 25 17:32:12 2014 +0200
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Wed Jun 25 17:32:12 2014 +0200

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 20 +++++++++++++++++++-
 .../internal/codegen/js/goog/JSGoogEmitter.java | 13 +++++++++++++
 .../codegen/js/goog/JSGoogEmitterTokens.java    |  3 ++-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 10 ++++++++--
 4 files changed, 42 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/507d5eb8/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 cf3d43b..73b7d4b 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
@@ -79,6 +79,7 @@ import org.apache.flex.compiler.tree.as.IIdentifierNode;
 import org.apache.flex.compiler.tree.as.IInterfaceNode;
 import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode.LiteralType;
 import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.ISetterNode;
@@ -86,7 +87,6 @@ import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IVariableExpressionNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
-import org.apache.flex.compiler.tree.as.ILiteralNode.LiteralType;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.utils.ASNodeUtils;
 import org.apache.flex.compiler.utils.NativeUtils;
@@ -754,6 +754,11 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             if (parentNode.getNodeID() == ASTNodeID.MemberAccessExpressionID
                     && parentNode.getChild(0).getNodeID() == ASTNodeID.SuperID)
             {
+                IClassNode cnode = (IClassNode) node
+                        .getAncestorOfType(IClassNode.class);
+
+                write(cnode.getQualifiedName());
+                write(ASEmitterTokens.MEMBER_ACCESS);
                 write(JSGoogEmitterTokens.GOOG_BASE);
                 write(ASEmitterTokens.PAREN_OPEN);
                 write(ASEmitterTokens.THIS);
@@ -817,10 +822,23 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
             return;
 
+        IClassNode cnode = (IClassNode) node
+                .getAncestorOfType(IClassNode.class);
+
+        write(cnode.getQualifiedName());
+        write(ASEmitterTokens.MEMBER_ACCESS);
         write(JSGoogEmitterTokens.GOOG_BASE);
         write(ASEmitterTokens.PAREN_OPEN);
         write(ASEmitterTokens.THIS);
 
+        if (fnode != null && fnode.isConstructor())
+        {
+            writeToken(ASEmitterTokens.COMMA);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(JSGoogEmitterTokens.GOOG_CONSTRUCTOR);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+        }
+
         if (fnode != null && !fnode.isConstructor())
         {
             writeToken(ASEmitterTokens.COMMA);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/507d5eb8/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 4f7cb56..94e971a 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
@@ -655,10 +655,23 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         if (fnode.isConstructor() && !hasSuperClass(fnode))
             return;
 
+        IClassNode cnode = (IClassNode) node
+                .getAncestorOfType(IClassNode.class);
+
+        write(cnode.getQualifiedName());
+        write(ASEmitterTokens.MEMBER_ACCESS);
         write(JSGoogEmitterTokens.GOOG_BASE);
         write(ASEmitterTokens.PAREN_OPEN);
         write(ASEmitterTokens.THIS);
 
+        if (fnode.isConstructor())
+        {
+            writeToken(ASEmitterTokens.COMMA);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(JSGoogEmitterTokens.GOOG_CONSTRUCTOR);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+        }
+
         if (fnode != null && !fnode.isConstructor())
         {
             writeToken(ASEmitterTokens.COMMA);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/507d5eb8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
index 9380cf6..d6012d0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
@@ -24,8 +24,9 @@ public enum JSGoogEmitterTokens implements IEmitterTokens
 {
     AS3("__AS3__"),
     GOOG_ARRAY_FOREACH("goog.array.forEach"),
-    GOOG_BASE("goog.base"),
+    GOOG_BASE("base"),
     GOOG_BIND("goog.bind"),
+    GOOG_CONSTRUCTOR("constructor"),
     GOOG_INHERITS("goog.inherits"),
     GOOG_PROVIDE("goog.provide"),
     GOOG_REQUIRE("goog.require"),

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/507d5eb8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index cd66409..6b1d341 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -281,9 +281,15 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         if (indent)
             indentPush();
         writeNewline(ASEmitterTokens.BLOCK_OPEN, true);
+        write(cname);
+        write(ASEmitterTokens.MEMBER_ACCESS);
         write(JSGoogEmitterTokens.GOOG_BASE);
         write(ASEmitterTokens.PAREN_OPEN);
         write(ASEmitterTokens.THIS);
+        writeToken(ASEmitterTokens.COMMA);
+        write(ASEmitterTokens.SINGLE_QUOTE);
+        write(JSGoogEmitterTokens.GOOG_CONSTRUCTOR);
+        write(ASEmitterTokens.SINGLE_QUOTE);
         write(ASEmitterTokens.PAREN_CLOSE);
         writeNewline(ASEmitterTokens.SEMICOLON);
     }
@@ -754,7 +760,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             indentPush();
             writeNewline("{");
             writeNewline("/** @type {Array} */");
-            writeNewline("var arr = goog.base(this, 'get_MXMLDescriptor');");
+            writeNewline("var arr = " + cname + ".base(this, 'get_MXMLDescriptor');");
             writeNewline("/** @type {Array} */");
             indentPop();
             indentPop();
@@ -796,7 +802,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             indentPush();
             writeNewline("{");
             writeNewline("/** @type {Array} */");
-            writeNewline("var arr = goog.base(this, 'get_MXMLProperties');");
+            writeNewline("var arr = " + cname + ".base(this, 'get_MXMLProperties');");
             writeNewline("/** @type {Array} */");
             indentPop();
             indentPop();


Mime
View raw message