flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [2/3] git commit: [flex-falcon] [refs/heads/develop] - compiler-jx: import statements are not output in JS (they were previously if they appeared in a function)
Date Fri, 14 Oct 2016 18:56:28 GMT
compiler-jx: import statements are not output in JS (they were previously if they appeared
in a function)


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

Branch: refs/heads/develop
Commit: a96509461b45e143baf52423552a0990a3821824
Parents: 680c335
Author: Josh Tynjala <joshtynjala@gmail.com>
Authored: Fri Oct 14 10:42:26 2016 -0700
Committer: Josh Tynjala <joshtynjala@gmail.com>
Committed: Fri Oct 14 10:42:26 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/codegen/js/JSEmitter.java   |  7 +++++++
 .../internal/codegen/js/jx/StatementEmitter.java       |  6 ++++++
 .../codegen/js/flexjs/TestFlexJSStatements.java        | 13 +++++++++++++
 3 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a9650946/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 237c430..7824a87 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -69,6 +69,7 @@ import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.IImportNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
 import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
 import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
@@ -340,6 +341,12 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     }
 
     @Override
+    public void emitImport(IImportNode node)
+    {
+        // do nothing
+    }
+
+    @Override
     public void emitWhileLoop(IWhileLoopNode node)
     {
         whileLoopEmitter.emit(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a9650946/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
index 1f4eb4d..40e933e 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
@@ -39,6 +39,12 @@ public class StatementEmitter extends JSSubEmitter implements
     {
         getWalker().walk(node);
 
+        if(node.getNodeID() == ASTNodeID.ImportID)
+        {
+            //imports aren't emitted, so don't emit anything here either
+            return;
+        }
+
         // XXX (mschmalle) this should be in the after handler?
         if (node.getParent().getNodeID() != ASTNodeID.LabledStatementID
                 && node.getNodeID() != ASTNodeID.ConfigBlockID

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a9650946/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
index 733973e..604d0f1 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
@@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.IImportNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.ISwitchNode;
 import org.apache.flex.compiler.tree.as.ITryNode;
@@ -470,6 +471,18 @@ public class TestFlexJSStatements extends TestGoogStatements
         assertOut("with (a)\n  b;");
     }
 
+    //----------------------------------
+    // import a.b.C
+    //----------------------------------
+
+    @Test
+    public void testVisitImport()
+    {
+        IImportNode node = (IImportNode) getNode("import flash.events.EventDispatcher;",
IImportNode.class);
+        asBlockWalker.visitImport(node);
+        assertOut("");
+    }
+
     @Override
     @Test
     public void testVisit()


Mime
View raw message