flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject [1/2] git commit: [flex-falcon] [refs/heads/develop] - Cleanup organize.
Date Sun, 31 May 2015 19:30:37 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop c9535aa13 -> 3266a06d8


Cleanup organize.


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

Branch: refs/heads/develop
Commit: ec5fa07ed244af48eea9cbccde15d42ba78e9567
Parents: c9535aa
Author: Michael Schmalle <mschmalle@apache.org>
Authored: Sun May 31 15:16:36 2015 -0400
Committer: Michael Schmalle <mschmalle@apache.org>
Committed: Sun May 31 15:16:36 2015 -0400

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 161 ++++++++++---------
 .../internal/codegen/js/goog/JSGoogEmitter.java |   4 +
 2 files changed, 91 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec5fa07e/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 4463d0a..66a5731 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
@@ -258,35 +258,45 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         methodEmitter.emit(node);
     }
 
+    //--------------------------------------------------------------------------
+    // Statements
+    //--------------------------------------------------------------------------
+
     @Override
     public void emitFunctionCall(IFunctionCallNode node)
     {
         functionCallEmitter.emit(node);
     }
 
+    @Override
+    public void emitForEachLoop(IForLoopNode node)
+    {
+        forEachEmitter.emit(node);
+    }
+
+    //--------------------------------------------------------------------------
+    // Expressions
     //--------------------------------------------------------------------------
 
     @Override
-    protected void emitSelfReference(IFunctionNode node)
+    public void emitSuperCall(IASNode node, String type)
     {
-        // we don't want 'var self = this;' in FlexJS
-        // unless there are anonymous functions
-        if (node.containsAnonymousFunctions())
-            super.emitSelfReference(node);
+        superCallEmitter.emit(node, type);
     }
 
     @Override
-    public void emitIdentifier(IIdentifierNode node)
+    public void emitMemberAccessExpression(IMemberAccessExpressionNode node)
     {
-        identifierEmitter.emit(node);
+        memberAccessEmitter.emit(node);
     }
 
-    //--------------------------------------------------------------------------
-
     @Override
-    public void emitSuperCall(IASNode node, String type)
+    public void emitE4XFilter(IMemberAccessExpressionNode node)
     {
-        superCallEmitter.emit(node, type);
+        // ToDo (erikdebruin): implement E4X replacement !?!
+        write(ASEmitterTokens.SINGLE_QUOTE);
+        write("E4XFilter");
+        write(ASEmitterTokens.SINGLE_QUOTE);
     }
 
     @Override
@@ -295,6 +305,61 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         binaryOperatorEmitter.emit(node);
     }
 
+    @Override
+    public void emitTypedExpression(ITypedExpressionNode node)
+    {
+        write(JSGoogEmitterTokens.ARRAY);
+    }
+
+    @Override
+    public void emitIdentifier(IIdentifierNode node)
+    {
+        identifierEmitter.emit(node);
+    }
+
+    @Override
+    public void emitLiteral(ILiteralNode node)
+    {
+        boolean isWritten = false;
+
+        String s = node.getValue(true);
+        if (!(node instanceof RegExpLiteralNode))
+        {
+            if (node.getLiteralType() == LiteralType.XML)
+            {
+                // ToDo (erikdebruin): VF2JS -> handle XML output properly...
+
+                write("'" + s + "'");
+
+                isWritten = true;
+            }
+            s = s.replaceAll("\n", "__NEWLINE_PLACEHOLDER__");
+            s = s.replaceAll("\r", "__CR_PLACEHOLDER__");
+            s = s.replaceAll("\t", "__TAB_PLACEHOLDER__");
+            s = s.replaceAll("\f", "__FORMFEED_PLACEHOLDER__");
+            s = s.replaceAll("\b", "__BACKSPACE_PLACEHOLDER__");
+            s = s.replaceAll("\\\\\"", "__QUOTE_PLACEHOLDER__");
+            s = s.replaceAll("\\\\", "__ESCAPE_PLACEHOLDER__");
+            //s = "\'" + s.replaceAll("\'", "\\\\\'") + "\'";
+            s = s.replaceAll("__ESCAPE_PLACEHOLDER__", "\\\\\\\\");
+            s = s.replaceAll("__QUOTE_PLACEHOLDER__", "\\\\\"");
+            s = s.replaceAll("__BACKSPACE_PLACEHOLDER__", "\\\\b");
+            s = s.replaceAll("__FORMFEED_PLACEHOLDER__", "\\\\f");
+            s = s.replaceAll("__TAB_PLACEHOLDER__", "\\\\t");
+            s = s.replaceAll("__CR_PLACEHOLDER__", "\\\\r");
+            s = s.replaceAll("__NEWLINE_PLACEHOLDER__", "\\\\n");
+        }
+
+        if (!isWritten)
+        {
+            write(s);
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    // Specific
+    //--------------------------------------------------------------------------
+
     public void emitIsAs(IExpressionNode left, IExpressionNode right,
             ASTNodeID id, boolean coercion)
     {
@@ -302,9 +367,18 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     }
 
     @Override
-    public void emitMemberAccessExpression(IMemberAccessExpressionNode node)
+    protected void emitSelfReference(IFunctionNode node)
     {
-        memberAccessEmitter.emit(node);
+        // we don't want 'var self = this;' in FlexJS
+        // unless there are anonymous functions
+        if (node.containsAnonymousFunctions())
+        {
+            writeToken(ASEmitterTokens.VAR);
+            writeToken(JSGoogEmitterTokens.SELF);
+            writeToken(ASEmitterTokens.EQUAL);
+            write(ASEmitterTokens.THIS);
+            writeNewline(ASEmitterTokens.SEMICOLON);
+        }
     }
 
     @Override
@@ -434,65 +508,4 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         else
             super.emitDefinePropertyFunction(node);
     }
-
-    @Override
-    public void emitForEachLoop(IForLoopNode node)
-    {
-        forEachEmitter.emit(node);
-    }
-
-    @Override
-    public void emitTypedExpression(ITypedExpressionNode node)
-    {
-        write(JSGoogEmitterTokens.ARRAY);
-    }
-
-    @Override
-    public void emitLiteral(ILiteralNode node)
-    {
-        boolean isWritten = false;
-
-        String s = node.getValue(true);
-        if (!(node instanceof RegExpLiteralNode))
-        {
-            if (node.getLiteralType() == LiteralType.XML)
-            {
-                // ToDo (erikdebruin): VF2JS -> handle XML output properly...
-
-                write("'" + s + "'");
-
-                isWritten = true;
-            }
-            s = s.replaceAll("\n", "__NEWLINE_PLACEHOLDER__");
-            s = s.replaceAll("\r", "__CR_PLACEHOLDER__");
-            s = s.replaceAll("\t", "__TAB_PLACEHOLDER__");
-            s = s.replaceAll("\f", "__FORMFEED_PLACEHOLDER__");
-            s = s.replaceAll("\b", "__BACKSPACE_PLACEHOLDER__");
-            s = s.replaceAll("\\\\\"", "__QUOTE_PLACEHOLDER__");
-            s = s.replaceAll("\\\\", "__ESCAPE_PLACEHOLDER__");
-            //s = "\'" + s.replaceAll("\'", "\\\\\'") + "\'";
-            s = s.replaceAll("__ESCAPE_PLACEHOLDER__", "\\\\\\\\");
-            s = s.replaceAll("__QUOTE_PLACEHOLDER__", "\\\\\"");
-            s = s.replaceAll("__BACKSPACE_PLACEHOLDER__", "\\\\b");
-            s = s.replaceAll("__FORMFEED_PLACEHOLDER__", "\\\\f");
-            s = s.replaceAll("__TAB_PLACEHOLDER__", "\\\\t");
-            s = s.replaceAll("__CR_PLACEHOLDER__", "\\\\r");
-            s = s.replaceAll("__NEWLINE_PLACEHOLDER__", "\\\\n");
-        }
-
-        if (!isWritten)
-        {
-            write(s);
-        }
-    }
-
-    @Override
-    public void emitE4XFilter(IMemberAccessExpressionNode node)
-    {
-        // ToDo (erikdebruin): implement E4X replacement !?!
-        write(ASEmitterTokens.SINGLE_QUOTE);
-        write("E4XFilter");
-        write(ASEmitterTokens.SINGLE_QUOTE);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec5fa07e/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 40453ec..df64740 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
@@ -640,6 +640,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         emitDefaultParameterCodeBlock(node);
     }
 
+    // XXX Dead
     protected void emitSelfReference(IFunctionNode node)
     {
         writeToken(ASEmitterTokens.VAR);
@@ -649,6 +650,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         writeNewline(ASEmitterTokens.SEMICOLON);
     }
 
+    // XXX Dead
     protected void emitSuperCall(IASNode node, String type)
     {
         IFunctionNode fnode = (node instanceof IFunctionNode) ? (IFunctionNode) node
@@ -874,6 +876,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         getWalker().walk(node.getCollectionNode());
     }
 
+    // XXX Dead
     @Override
     public void emitForEachLoop(IForLoopNode node)
     {
@@ -999,6 +1002,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         emitBinaryOperator(node);
     }
 
+    // XXX Dead
     @Override
     public void emitBinaryOperator(IBinaryOperatorNode node)
     {


Mime
View raw message