flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [04/13] git commit: Refactored 'stringifyNode' method
Date Fri, 22 Mar 2013 07:05:29 GMT
Refactored 'stringifyNode' method

The 'stringifyNode' method is moved to the IEmitter interface and implemented in the various
emitters. The raised visibility allows for access to this method from any instance of the
emitter, enabling the MXMLEmitters to get at a stringified representation of AS code embedded
in MXML nodes.


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

Branch: refs/heads/develop
Commit: 4bd37a8bc94e78edc273e919cc9fc59412abed44
Parents: ff40046
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Tue Mar 12 13:50:10 2013 +0100
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Tue Mar 12 13:50:10 2013 +0100

----------------------------------------------------------------------
 .../org/apache/flex/compiler/codegen/IEmitter.java |   13 +++++++++++++
 .../flex/compiler/internal/codegen/Emitter.java    |    2 +-
 .../compiler/internal/codegen/as/ASEmitter.java    |   12 +-----------
 .../compiler/internal/codegen/js/JSDocEmitter.java |    9 ++++++++-
 4 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4bd37a8b/compiler.jx/src/org/apache/flex/compiler/codegen/IEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/IEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/IEmitter.java
index f8ef245..5e2e596 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/IEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/IEmitter.java
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.codegen;
 
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.tree.as.IASNode;
 
 /**
  * @author Michael Schmalle
@@ -97,4 +98,16 @@ public interface IEmitter
 
     void writeToken(String value);
 
+    /**
+     * Takes the node argument and created a String representation if it using
+     * the buffer temporarily.
+     * <p>
+     * Note; This method is still beta, it need more logic if an emitter is
+     * actually using the buffer!
+     * 
+     * @param node The node walk and create a String for.
+     * @return The node's output.
+     */
+    String stringifyNode(IASNode node);
+    
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4bd37a8b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/Emitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/Emitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/Emitter.java
index b8067b3..82d7163 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/Emitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/Emitter.java
@@ -222,7 +222,7 @@ public class Emitter implements IEmitter
      * @param node The node walk and create a String for.
      * @return The node's output.
      */
-    protected String stringifyNode(IASNode node)
+    public String stringifyNode(IASNode node)
     {
         setBufferWrite(true);
         getWalker().walk(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4bd37a8b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index ececdfd..e15da37 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -1421,17 +1421,7 @@ public class ASEmitter implements IASEmitter, IEmitter
     {
     }
 
-    /**
-     * Takes the node argument and created a String representation if it using
-     * the buffer temporarily.
-     * <p>
-     * Note; This method is still beta, it need more logic if an emitter is
-     * actually using the buffer!
-     * 
-     * @param node The node walk and create a String for.
-     * @return The node's output.
-     */
-    protected String stringifyNode(IASNode node)
+    public String stringifyNode(IASNode node)
     {
         setBufferWrite(true);
         getWalker().walk(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4bd37a8b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSDocEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSDocEmitter.java
index d820443..5dca90a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSDocEmitter.java
@@ -24,6 +24,7 @@ import org.apache.flex.compiler.codegen.IEmitter;
 import org.apache.flex.compiler.codegen.IEmitterTokens;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.tree.as.IASNode;
 
 @SuppressWarnings("unused")
 public class JSDocEmitter implements IDocEmitter, IEmitter
@@ -126,5 +127,11 @@ public class JSDocEmitter implements IDocEmitter, IEmitter
         write(ASEmitterTokens.SPACE);
         writeNewline(JSDocEmitterTokens.JSDOC_CLOSE);
     }
-
+    
+    @Override
+    public String stringifyNode(IASNode node)
+    {
+        return "";
+    }
+    
 }


Mime
View raw message