flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1441755 - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/ compiler.jx/src/org/apache/flex/compiler/clients/ compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ compiler.jx/src/org/apache...
Date Sat, 02 Feb 2013 14:42:39 GMT
Author: mschmalle
Date: Sat Feb  2 14:42:39 2013
New Revision: 1441755

URL: http://svn.apache.org/viewvc?rev=1441755&view=rev
Log:
Flex:FalconJx
- Moved the createEmitter() method to public API in IBackend
  - Implications; clients must assemble writer, emitter and visitor

Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestWalkerBase.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASWriter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSWriter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/amd/AMDBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestBase.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestBase.java
Sat Feb  2 14:42:39 2013
@@ -153,6 +153,9 @@ public class TestBase
                 + "\\frameworks\\libs\\rpc.swc")));
         libraries.add(new File(FilenameNormalization.normalize(env.SDK
                 + "\\frameworks\\libs\\spark.swc")));
+        
+        addLibrary(libraries);
+        
         project.setLibraries(libraries);
 
         // Use the MXML 2009 manifest.
@@ -195,6 +198,10 @@ public class TestBase
         return fileNode;
     }
     
+    protected void addLibrary(List<File> libraries)
+    {
+    }
+
     protected String getCodeFromFile(String fileName, boolean isJS)
     {
         String testFileDir = FilenameNormalization.normalize("test-files");

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestWalkerBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestWalkerBase.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestWalkerBase.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/as/codegen/TestWalkerBase.java
Sat Feb  2 14:42:39 2013
@@ -3,8 +3,10 @@ package org.apache.flex.compiler.interna
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertThat;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.clients.IBackend;
 import org.apache.flex.compiler.internal.as.driver.ASBackend;
+import org.apache.flex.compiler.js.codegen.IJSEmitter;
 import org.apache.flex.compiler.visitor.IASBlockVisitor;
 import org.junit.After;
 import org.junit.Ignore;
@@ -15,6 +17,8 @@ public class TestWalkerBase extends Test
     protected IASBlockVisitor visitor;
 
     protected IBackend backend;
+    
+    protected IASEmitter emitter;
 
     private ASFilterWriter writer;
 
@@ -26,8 +30,9 @@ public class TestWalkerBase extends Test
         super.setUp();
 
         backend = createBackend();
-        writer = backend.createFilterWriter(project);
-        visitor = backend.createWalker(project, errors, writer);
+        writer = backend.createWriterBuffer(project);
+        emitter = backend.createEmitter(writer);
+        visitor = backend.createWalker(project, errors, emitter);
     }
 
     @After

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java Sat Feb
 2 14:42:39 2013
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.clients;
 
 import java.io.File;
+import java.io.FilterWriter;
 import java.util.List;
 
 import org.apache.flex.compiler.as.codegen.IASEmitter;
@@ -79,13 +80,15 @@ public interface IBackend
 
     IDocEmitter createDocEmitter(IASEmitter emitter);
 
-    ASFilterWriter createFilterWriter(IASProject project);
+    IASEmitter createEmitter(FilterWriter writer);
+
+    ASFilterWriter createWriterBuffer(IASProject project);
 
     IASWriter createWriter(IASProject project, List<ICompilerProblem> errors,
             ICompilationUnit compilationUnit, boolean enableDebug);
 
     IASBlockWalker createWalker(IASProject project,
-            List<ICompilerProblem> errors, ASFilterWriter writer);
+            List<ICompilerProblem> errors, IASEmitter emitter);
 
     /**
      * Creates an AST walker capable of traversing MXML AST and calling back to

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASBlockWalker.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASBlockWalker.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASBlockWalker.java
Sat Feb  2 14:42:39 2013
@@ -578,7 +578,7 @@ public class ASBlockWalker implements IA
     {
         // (erikdebruin) let's only do this when debugging... or it'll show up
         //               in the stdout on the command line
-        //System.out.println(message);
+        System.out.println(message);
     }
 
     //--------------------------------------------------------------------------

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASWriter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASWriter.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASWriter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASWriter.java
Sat Feb  2 14:42:39 2013
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.internal.js.codegen.JSSharedData;
 import org.apache.flex.compiler.js.codegen.IJSWriter;
 import org.apache.flex.compiler.problems.ICompilerProblem;
@@ -68,10 +69,10 @@ public class ASWriter implements IJSWrit
     public void writeTo(OutputStream out)
     {
         ASFilterWriter writer = JSSharedData.backend
-                .createFilterWriter(project);
-
+                .createWriterBuffer(project);
+        IASEmitter emitter = JSSharedData.backend.createEmitter(writer);
         IASBlockWalker walker = JSSharedData.backend.createWalker(project,
-                problems, writer);
+                problems, emitter);
 
         walker.visitCompilationUnit(compilationUnit);
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
Sat Feb  2 14:42:39 2013
@@ -19,6 +19,7 @@
 
 package org.apache.flex.compiler.internal.as.driver;
 
+import java.io.FilterWriter;
 import java.io.StringWriter;
 import java.util.List;
 
@@ -72,17 +73,16 @@ public class ASBackend implements IBacke
     }
 
     @Override
-    public ITarget createTarget(IASProject project,
-            ITargetSettings settings, ITargetProgressMonitor monitor)
+    public ITarget createTarget(IASProject project, ITargetSettings settings,
+            ITargetProgressMonitor monitor)
     {
         throw new UnsupportedOperationException();
     }
 
     @Override
     public ASBlockWalker createWalker(IASProject project,
-            List<ICompilerProblem> errors, ASFilterWriter out)
+            List<ICompilerProblem> errors, IASEmitter emitter)
     {
-        ASEmitter emitter = new ASEmitter(out);
         ASBlockWalker walker = new ASBlockWalker(errors, project, emitter);
 
         BeforeAfterStrategy strategy = new BeforeAfterStrategy(
@@ -95,7 +95,7 @@ public class ASBackend implements IBacke
     }
 
     @Override
-    public ASFilterWriter createFilterWriter(IASProject project)
+    public ASFilterWriter createWriterBuffer(IASProject project)
     {
         StringWriter out = new StringWriter();
         ASFilterWriter writer = new ASFilterWriter(out);
@@ -103,6 +103,12 @@ public class ASBackend implements IBacke
     }
 
     @Override
+    public IASEmitter createEmitter(FilterWriter writer)
+    {
+        return new ASEmitter(writer);
+    }
+
+    @Override
     public IASWriter createWriter(IASProject project,
             List<ICompilerProblem> problems, ICompilationUnit compilationUnit,
             boolean enableDebug)
@@ -123,4 +129,5 @@ public class ASBackend implements IBacke
         // TODO Auto-generated method stub
         return null;
     }
+
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSWriter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSWriter.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSWriter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSWriter.java
Sat Feb  2 14:42:39 2013
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.js.codegen.IJSWriter;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
@@ -67,15 +68,13 @@ public class JSWriter implements IJSWrit
     public void writeTo(OutputStream out)
     {
         JSFilterWriter writer = (JSFilterWriter) JSSharedData.backend
-                .createFilterWriter(project);
-
+                .createWriterBuffer(project);
+        IASEmitter emitter = JSSharedData.backend.createEmitter(writer);
         IASBlockWalker walker = JSSharedData.backend.createWalker(project,
-                problems, writer);
+                problems, emitter);
 
         walker.visitCompilationUnit(compilationUnit);
 
-        //System.out.println(writer.toString());
-
         try
         {
             out.write(writer.toString().getBytes());

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
Sat Feb  2 14:42:39 2013
@@ -28,10 +28,9 @@ import org.apache.flex.compiler.as.codeg
 import org.apache.flex.compiler.clients.IBackend;
 import org.apache.flex.compiler.clients.JSConfiguration;
 import org.apache.flex.compiler.config.Configurator;
-import org.apache.flex.compiler.internal.as.codegen.ASBlockWalker;
-import org.apache.flex.compiler.internal.as.codegen.ASFilterWriter;
 import org.apache.flex.compiler.internal.as.codegen.ASAfterNodeStrategy;
 import org.apache.flex.compiler.internal.as.codegen.ASBeforeNodeStrategy;
+import org.apache.flex.compiler.internal.as.codegen.ASBlockWalker;
 import org.apache.flex.compiler.internal.as.visitor.ASNodeSwitch;
 import org.apache.flex.compiler.internal.as.visitor.BeforeAfterStrategy;
 import org.apache.flex.compiler.internal.js.codegen.JSDocEmitter;
@@ -89,9 +88,8 @@ public class JSBackend implements IBacke
 
     @Override
     public IASBlockWalker createWalker(IASProject project,
-            List<ICompilerProblem> errors, ASFilterWriter out)
+            List<ICompilerProblem> errors, IASEmitter emitter)
     {
-        IJSEmitter emitter = createEmitter(out);
         ASBlockWalker walker = new ASBlockWalker(errors, project, emitter);
 
         BeforeAfterStrategy strategy = new BeforeAfterStrategy(
@@ -104,7 +102,7 @@ public class JSBackend implements IBacke
     }
 
     @Override
-    public JSFilterWriter createFilterWriter(IASProject project)
+    public JSFilterWriter createWriterBuffer(IASProject project)
     {
         StringWriter out = new StringWriter();
         JSFilterWriter writer = new JSFilterWriter(out);
@@ -125,7 +123,8 @@ public class JSBackend implements IBacke
         return new JSDocEmitter((IJSEmitter) emitter);
     }
 
-    protected IJSEmitter createEmitter(FilterWriter out)
+    @Override
+    public IJSEmitter createEmitter(FilterWriter out)
     {
         return new JSEmitter(out);
     }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/amd/AMDBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/amd/AMDBackend.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/amd/AMDBackend.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/amd/AMDBackend.java
Sat Feb  2 14:42:39 2013
@@ -43,7 +43,7 @@ public class AMDBackend extends JSBacken
     }
 
     @Override
-    protected IJSEmitter createEmitter(FilterWriter out)
+    public IJSEmitter createEmitter(FilterWriter out)
     {
         IJSEmitter emitter = new JSAMDEmitter(out);
         emitter.setDocEmitter(createDocEmitter(emitter));

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java?rev=1441755&r1=1441754&r2=1441755&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java
Sat Feb  2 14:42:39 2013
@@ -52,7 +52,7 @@ public class GoogBackend extends JSBacke
     }
 
     @Override
-    protected IJSEmitter createEmitter(FilterWriter out)
+    public IJSEmitter createEmitter(FilterWriter out)
     {
         IJSEmitter emitter = new JSGoogEmitter(out);
         emitter.setDocEmitter(createDocEmitter(emitter));



Mime
View raw message