flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1447198 - in /flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler: as/codegen/ASTokens.java internal/as/codegen/ASEmitter.java
Date Mon, 18 Feb 2013 11:16:30 GMT
Author: mschmalle
Date: Mon Feb 18 11:16:30 2013
New Revision: 1447198

URL: http://svn.apache.org/r1447198
Log:
Flex:FalconJx
- remove a couple junk methods from ASEmitter and added a stringifyNode method

Modified:
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/ASTokens.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/ASTokens.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/ASTokens.java?rev=1447198&r1=1447197&r2=1447198&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/ASTokens.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/ASTokens.java Mon
Feb 18 11:16:30 2013
@@ -40,13 +40,19 @@ public interface ASTokens
     public static final String BRACE_CLOSE = "}";
 
     public static final String COLON = ":";
-
+    
+    public static final String SEMICOLON = ";";
+    
     public static final String COMMA = ",";
 
     public static final String FUNCTION = "function";
 
     public static final String EQUAL = "=";
 
+    public static final String FOR = "for";
+
+    public static final String THIS = "this";
+
     //    int EOF = 1;
     //    int NULL_TREE_LOOKAHEAD = 3;
     //    int HIDDEN_TOKEN_COMMENT = 4;

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java?rev=1447198&r1=1447197&r2=1447198&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
Mon Feb 18 11:16:30 2013
@@ -269,7 +269,7 @@ public class ASEmitter implements IASEmi
     {
         write(value);
     }
-    
+
     @Override
     public void writeToken(String value)
     {
@@ -1455,33 +1455,23 @@ public class ASEmitter implements IASEmi
     {
     }
 
-    //--------------------------------------------------------------------------
-    // TODO (mschmalle) These are here to remind me I did the newline push backwards, needs
to be fixed
-    //--------------------------------------------------------------------------
-
-    protected void loopIndent(int i, int len, boolean hasIndent)
-    {
-        if (i < len - 1)
-        {
-            writeNewline();
-        }
-        else
-        {
-            if (hasIndent)
-                indentPop();
-            writeNewline();
-        }
-    }
-
-    protected boolean maybeIndent(int len)
+    /**
+     * 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)
     {
-        if (len > 0 && getCurrentIndent() == 0)
-        {
-            indentPush();
-            write(getIndent(getCurrentIndent()));
-            return true;
-        }
-        return false;
+        setBufferWrite(true);
+        getWalker().walk(node);
+        String result = getBuilder().toString();
+        getBuilder().setLength(0);
+        setBufferWrite(false);
+        return result;
     }
-
 }



Mime
View raw message