You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2016/04/30 01:18:48 UTC
[1/8] git commit: [flex-falcon] [refs/heads/develop] - JSEmitter:
sub-emitters typed with interfaces to make it easier to override in
subclasses, if needed
Repository: flex-falcon
Updated Branches:
refs/heads/develop e44aa18be -> 590d813d9
JSEmitter: sub-emitters typed with interfaces to make it easier to override in subclasses, if needed
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0286cac4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0286cac4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0286cac4
Branch: refs/heads/develop
Commit: 0286cac4510153bcaa6ce9b8beada2c2881a79e1
Parents: f4f1179
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 13:21:23 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 13:21:23 2016 -0700
----------------------------------------------------------------------
.../compiler/internal/codegen/js/JSEmitter.java | 50 ++++++++++----------
1 file changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0286cac4/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 463a2fc..ece92d7 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
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
+import org.apache.flex.compiler.codegen.ISubEmitter;
import org.apache.flex.compiler.codegen.js.IJSEmitter;
import org.apache.flex.compiler.common.ASModifier;
import org.apache.flex.compiler.common.ISourceLocation;
@@ -74,6 +75,7 @@ import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
import org.apache.flex.compiler.tree.as.IPackageNode;
import org.apache.flex.compiler.tree.as.IParameterNode;
import org.apache.flex.compiler.tree.as.IReturnNode;
+import org.apache.flex.compiler.tree.as.IStatementNode;
import org.apache.flex.compiler.tree.as.ISwitchNode;
import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
import org.apache.flex.compiler.tree.as.IThrowNode;
@@ -92,30 +94,30 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
{
private JSSessionModel model;
- public BlockOpenEmitter blockOpenEmitter;
- public BlockCloseEmitter blockCloseEmitter;
- public NumericLiteralEmitter numericLiteralEmitter;
- public ParametersEmitter parametersEmitter;
- public ParameterEmitter parameterEmitter;
- public FunctionCallArgumentsEmitter functionCallArgumentsEmitter;
- public LiteralContainerEmitter literalContainerEmitter;
- public ObjectLiteralValuePairEmitter objectLiteralValuePairEmitter;
- public ReturnEmitter returnEmitter;
- public DynamicAccessEmitter dynamicAccessEmitter;
- public UnaryOperatorEmitter unaryOperatorEmitter;
- public TernaryOperatorEmitter ternaryOperatorEmitter;
- public MemberKeywordEmitter memberKeywordEmitter;
- public IfEmitter ifEmitter;
- public SwitchEmitter switchEmitter;
- public WhileLoopEmitter whileLoopEmitter;
- public DoWhileLoopEmitter doWhileLoopEmitter;
- public ForLoopEmitter forLoopEmitter;
- public IterationFlowEmitter interationFlowEmitter;
- public TryEmitter tryEmitter;
- public CatchEmitter catchEmitter;
- public ThrowEmitter throwEmitter;
- public StatementEmitter statementEmitter;
- public LanguageIdentifierEmitter languageIdentifierEmitter;
+ public ISubEmitter<IContainerNode> blockOpenEmitter;
+ public ISubEmitter<IContainerNode> blockCloseEmitter;
+ public ISubEmitter<INumericLiteralNode> numericLiteralEmitter;
+ public ISubEmitter<IContainerNode> parametersEmitter;
+ public ISubEmitter<IParameterNode> parameterEmitter;
+ public ISubEmitter<IContainerNode> functionCallArgumentsEmitter;
+ public ISubEmitter<ILiteralContainerNode> literalContainerEmitter;
+ public ISubEmitter<IObjectLiteralValuePairNode> objectLiteralValuePairEmitter;
+ public ISubEmitter<IReturnNode> returnEmitter;
+ public ISubEmitter<IDynamicAccessNode> dynamicAccessEmitter;
+ public ISubEmitter<IUnaryOperatorNode> unaryOperatorEmitter;
+ public ISubEmitter<ITernaryOperatorNode> ternaryOperatorEmitter;
+ public ISubEmitter<IDefinitionNode> memberKeywordEmitter;
+ public ISubEmitter<IIfNode> ifEmitter;
+ public ISubEmitter<ISwitchNode> switchEmitter;
+ public ISubEmitter<IWhileLoopNode> whileLoopEmitter;
+ public ISubEmitter<IWhileLoopNode> doWhileLoopEmitter;
+ public ISubEmitter<IForLoopNode> forLoopEmitter;
+ public ISubEmitter<IIterationFlowNode> interationFlowEmitter;
+ public ISubEmitter<ITryNode> tryEmitter;
+ public ISubEmitter<ICatchNode> catchEmitter;
+ public ISubEmitter<IThrowNode> throwEmitter;
+ public ISubEmitter<IASNode> statementEmitter;
+ public ISubEmitter<ILanguageIdentifierNode> languageIdentifierEmitter;
public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
@Override
[5/8] git commit: [flex-falcon] [refs/heads/develop] - fixed typo in
test class names
Posted by jo...@apache.org.
fixed typo in test class names
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/6993a66e
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/6993a66e
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/6993a66e
Branch: refs/heads/develop
Commit: 6993a66e29c9de4658dfed68ae4dca4ba0b7c70c
Parents: b20a5d5
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 14:44:32 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 14:44:32 2016 -0700
----------------------------------------------------------------------
.../internal/codegen/js/amd/TestAMDEmiter.java | 144 --------
.../internal/codegen/js/amd/TestAMDEmitter.java | 144 ++++++++
.../codegen/js/flexjs/TestFlexJSEmiter.java | 364 -------------------
.../codegen/js/flexjs/TestFlexJSEmitter.java | 364 +++++++++++++++++++
.../codegen/js/goog/TestGoogEmiter.java | 153 --------
.../codegen/js/goog/TestGoogEmitter.java | 153 ++++++++
6 files changed, 661 insertions(+), 661 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java
deleted file mode 100644
index 71e35dc..0000000
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.js.amd;
-
-import org.apache.flex.compiler.driver.IBackend;
-import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
-import org.apache.flex.compiler.internal.test.ASTestBase;
-import org.junit.Test;
-
-/**
- * This class tests the production of 'AMD' JavaScript output.
- * <p>
- * Note; this is a complete prototype more used in figuring out where
- * abstraction and indirection is needed concerning the AS -> JS translations.
- *
- * @author Michael Schmalle
- */
-public class TestAMDEmiter extends ASTestBase
-{
- // TODO (mschmalle) these tests were all ignored... ?
-
- @Test
- public void testSimple()
- {
-// String code = "package com.example.components {"
-// + "import org.apache.flex.html.staticControls.TextButton;"
-// + "public class MyTextButton extends TextButton {"
-// + "public function MyTextButton() {if (foo() != 42) { bar(); } }"
-// + "private var _privateVar:String = \"do \";"
-// + "public var publicProperty:Number = 100;"
-// + "public function myFunction(value: String): String{"
-// + "return \"Don't \" + _privateVar + value; }";
-// IFileNode node = compileAS(code);
-// asBlockWalker.visitFile(node);
-// assertOut("package com.example.components {\n\tpublic class MyTextButton extends TextButton {\n\t\tcom.example.components.MyTextButton = function() {\n\t\t\tif (foo() != 42) {\n\t\t\t\tbar();\n\t\t\t}\n\t\t}\n\t\tprivate var _privateVar:String = \"do \";\n\t\tpublic var publicProperty:Number = 100;\n\t\tcom.example.components.MyTextButton.prototype.myFunction = function(value) {\n\t\t\treturn \"Don't \" + _privateVar + value;\n\t\t}\n\t}\n}");
- }
-
- @Test
- public void testSimpleMethod()
- {
-// IFunctionNode node = getMethod("function method1():void{\n}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function() {\n}");
- }
-
- @Test
- public void testSimpleParameterReturnType()
- {
-// IFunctionNode node = getMethod("function method1(bar:int):int{\n}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function(bar) {\n}");
- }
-
- @Test
- public void testSimpleMultipleParameter()
- {
-// IFunctionNode node = getMethod("function method1(bar:int, baz:String, goo:A):void{\n}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Test
- public void testDefaultParameter()
- {
-// /*
-// foo.bar.A.method1 = function(p1, p2, p3, p4) {
-// if (arguments.length < 4) {
-// if (arguments.length < 3) {
-// p3 = 3;
-// }
-// p4 = 4;
-// }
-// return p1 + p2 + p3 + p4;
-// }
-// */
-// IFunctionNode node = getMethod("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function(p1, p2, p3, p4) {\n\tif (arguments.length < 4) "
-// + "{\n\t\tif (arguments.length < 3) {\n\t\t\tp3 = 3;\n\t\t}\n\t\tp4 = 4;\n\t}"
-// + "\n\treturn p1 + p2 + p3 + p4;\n}");
- }
-
- @Test
- public void testDefaultParameter_Body()
- {
-// /*
-// foo.bar.A.method1 = function(bar, bax) {
-// if (arguments.length < 2) {
-// if (arguments.length < 1) {
-// bar = 42;
-// }
-// bax = 4;
-// }
-// }
-// */
-// IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
-// + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n\t"
-// + "if (a)\n\t\tfoo();\n}");
- }
-
- @Test
- public void testDefaultParameter_NoBody_Alternate()
- {
-// /*
-// foo.bar.A.method1 = function(bar, bax) {
-// if (arguments.length < 2) {
-// if (arguments.length < 1) {
-// bar = 42;
-// }
-// bax = 4;
-// }
-// }
-// */
-// IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{\n}");
-// asBlockWalker.visitFunction(node);
-// assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
-// + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n}");
- }
-
- @Override
- protected IBackend createBackend()
- {
- return new AMDBackend();
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmitter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmitter.java
new file mode 100644
index 0000000..dd7e5eb
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmitter.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.amd;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.junit.Test;
+
+/**
+ * This class tests the production of 'AMD' JavaScript output.
+ * <p>
+ * Note; this is a complete prototype more used in figuring out where
+ * abstraction and indirection is needed concerning the AS -> JS translations.
+ *
+ * @author Michael Schmalle
+ */
+public class TestAMDEmitter extends ASTestBase
+{
+ // TODO (mschmalle) these tests were all ignored... ?
+
+ @Test
+ public void testSimple()
+ {
+// String code = "package com.example.components {"
+// + "import org.apache.flex.html.staticControls.TextButton;"
+// + "public class MyTextButton extends TextButton {"
+// + "public function MyTextButton() {if (foo() != 42) { bar(); } }"
+// + "private var _privateVar:String = \"do \";"
+// + "public var publicProperty:Number = 100;"
+// + "public function myFunction(value: String): String{"
+// + "return \"Don't \" + _privateVar + value; }";
+// IFileNode node = compileAS(code);
+// asBlockWalker.visitFile(node);
+// assertOut("package com.example.components {\n\tpublic class MyTextButton extends TextButton {\n\t\tcom.example.components.MyTextButton = function() {\n\t\t\tif (foo() != 42) {\n\t\t\t\tbar();\n\t\t\t}\n\t\t}\n\t\tprivate var _privateVar:String = \"do \";\n\t\tpublic var publicProperty:Number = 100;\n\t\tcom.example.components.MyTextButton.prototype.myFunction = function(value) {\n\t\t\treturn \"Don't \" + _privateVar + value;\n\t\t}\n\t}\n}");
+ }
+
+ @Test
+ public void testSimpleMethod()
+ {
+// IFunctionNode node = getMethod("function method1():void{\n}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function() {\n}");
+ }
+
+ @Test
+ public void testSimpleParameterReturnType()
+ {
+// IFunctionNode node = getMethod("function method1(bar:int):int{\n}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function(bar) {\n}");
+ }
+
+ @Test
+ public void testSimpleMultipleParameter()
+ {
+// IFunctionNode node = getMethod("function method1(bar:int, baz:String, goo:A):void{\n}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Test
+ public void testDefaultParameter()
+ {
+// /*
+// foo.bar.A.method1 = function(p1, p2, p3, p4) {
+// if (arguments.length < 4) {
+// if (arguments.length < 3) {
+// p3 = 3;
+// }
+// p4 = 4;
+// }
+// return p1 + p2 + p3 + p4;
+// }
+// */
+// IFunctionNode node = getMethod("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function(p1, p2, p3, p4) {\n\tif (arguments.length < 4) "
+// + "{\n\t\tif (arguments.length < 3) {\n\t\t\tp3 = 3;\n\t\t}\n\t\tp4 = 4;\n\t}"
+// + "\n\treturn p1 + p2 + p3 + p4;\n}");
+ }
+
+ @Test
+ public void testDefaultParameter_Body()
+ {
+// /*
+// foo.bar.A.method1 = function(bar, bax) {
+// if (arguments.length < 2) {
+// if (arguments.length < 1) {
+// bar = 42;
+// }
+// bax = 4;
+// }
+// }
+// */
+// IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
+// + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n\t"
+// + "if (a)\n\t\tfoo();\n}");
+ }
+
+ @Test
+ public void testDefaultParameter_NoBody_Alternate()
+ {
+// /*
+// foo.bar.A.method1 = function(bar, bax) {
+// if (arguments.length < 2) {
+// if (arguments.length < 1) {
+// bar = 42;
+// }
+// bax = 4;
+// }
+// }
+// */
+// IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{\n}");
+// asBlockWalker.visitFunction(node);
+// assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
+// + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n}");
+ }
+
+ @Override
+ protected IBackend createBackend()
+ {
+ return new AMDBackend();
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
deleted file mode 100644
index c02200e..0000000
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.js.flexjs;
-
-import org.apache.flex.compiler.clients.MXMLJSC;
-import org.apache.flex.compiler.driver.IBackend;
-import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogEmiter;
-import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
-import org.apache.flex.compiler.internal.parsing.as.FlexJSASDocDelegate;
-import org.apache.flex.compiler.internal.projects.FlexJSProject;
-import org.apache.flex.compiler.tree.as.IFileNode;
-import org.apache.flex.compiler.tree.as.IFunctionNode;
-import org.junit.Test;
-
-/**
- * @author Erik de Bruin
- */
-public class TestFlexJSEmiter extends TestGoogEmiter
-{
- @Override
- public void setUp()
- {
- project = new FlexJSProject(workspace);
-
- super.setUp();
- }
-
- @Override
- @Test
- public void testSimple()
- {
- String code = "package com.example.components {"
- + "import goog.events.EventTarget;"
- + "public class MyEventTarget extends EventTarget {"
- + "public function MyEventTarget() {if (foo() != 42) { bar(); } }"
- + "private var _privateVar:String = \"do \";"
- + "public var publicProperty:Number = 100;"
- + "public function myFunction(value: String): String{"
- + "return \"Don't \" + _privateVar + value; }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOutWithMetadata("/**\n" +
- " * com.example.components.MyEventTarget\n" +
- " *\n" +
- " * @fileoverview\n" +
- " *\n" +
- " * @suppress {checkTypes|accessControls}\n" +
- " */\n" +
- "\n" +
- "goog.provide('com.example.components.MyEventTarget');\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @constructor\n" +
- " * @extends {goog.events.EventTarget}\n" +
- " */\n" +
- "com.example.components.MyEventTarget = function() {\n" +
- " com.example.components.MyEventTarget.base(this, 'constructor');\n" +
- " if (foo() != 42) {\n" +
- " bar();\n" +
- " }\n" +
- "};\n" +
- "goog.inherits(com.example.components.MyEventTarget, goog.events.EventTarget);\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @private\n" +
- " * @type {string}\n" +
- " */\n" +
- "com.example.components.MyEventTarget.prototype._privateVar = \"do \";\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @export\n" +
- " * @type {number}\n" +
- " */\n" +
- "com.example.components.MyEventTarget.prototype.publicProperty = 100;\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @export\n" +
- " * @param {string} value\n" +
- " * @return {string}\n" +
- " */\n" +
- "com.example.components.MyEventTarget.prototype.myFunction = function(value) {\n" +
- " return \"Don't \" + this._privateVar + value;\n" +
- "};\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Metadata\n" +
- " *\n" +
- " * @type {Object.<string, Array.<Object>>}\n" +
- " */\n" +
- "com.example.components.MyEventTarget.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'MyEventTarget', qName: 'com.example.components.MyEventTarget'}] };\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Prevent renaming of class. Needed for reflection.\n" +
- " */\n" +
- "goog.exportSymbol('com.example.components.MyEventTarget', com.example.components.MyEventTarget);\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Reflection\n" +
- " *\n" +
- " * @return {Object.<string, Function>}\n" +
- " */\n" +
- "com.example.components.MyEventTarget.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
- " return {\n" +
- " variables: function () {\n" +
- " return {\n" +
- " 'publicProperty': { type: 'Number'}\n" +
- " };\n" +
- " },\n" +
- " accessors: function () {\n" +
- " return {\n" +
- " };\n" +
- " },\n" +
- " methods: function () {\n" +
- " return {\n" +
- " 'MyEventTarget': { type: '', declaredBy: 'com.example.components.MyEventTarget'},\n" +
- " 'myFunction': { type: 'String', declaredBy: 'com.example.components.MyEventTarget'}\n" +
- " };\n" +
- " }\n" +
- " };\n" +
- "};\n");
- }
-
- @Override
- @Test
- public void testSimpleInterface()
- {
- String code = "package com.example.components {"
- + "public interface TestInterface { } }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOutWithMetadata("/**\n" +
- " * com.example.components.TestInterface\n" +
- " *\n" +
- " * @fileoverview\n" +
- " *\n" +
- " * @suppress {checkTypes|accessControls}\n" +
- " */\n" +
- "\n" +
- "goog.provide('com.example.components.TestInterface');\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @interface\n" +
- " */\ncom.example.components.TestInterface = function() {\n" +
- "};\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Metadata\n" +
- " *\n" +
- " * @type {Object.<string, Array.<Object>>}\n" +
- " */\n" +
- "com.example.components.TestInterface.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'TestInterface', qName: 'com.example.components.TestInterface'}] };\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Reflection\n" +
- " *\n" +
- " * @return {Object.<string, Function>}\n" +
- " */\n" +
- "com.example.components.TestInterface.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
- " return {\n" +
- " variables: function () {\n" +
- " return {\n" +
- " };\n" +
- " },\n" +
- " accessors: function () {\n" +
- " return {\n" +
- " };\n" +
- " },\n" +
- " methods: function () {\n" +
- " return {\n" +
- " };\n" +
- " }\n" +
- " };\n" +
- "};\n");
- }
-
- @Override
- @Test
- public void testSimpleClass()
- {
- String code = "package com.example.components {"
- + "public class TestClass { } }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOutWithMetadata("/**\n" +
- " * com.example.components.TestClass\n" +
- " *\n" +
- " * @fileoverview\n" +
- " *\n" +
- " * @suppress {checkTypes|accessControls}\n" +
- " */\n" +
- "\n" +
- "goog.provide('com.example.components.TestClass');\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * @constructor\n" +
- " */\n" +
- "com.example.components.TestClass = function() {\n" +
- "};\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Metadata\n" +
- " *\n" +
- " * @type {Object.<string, Array.<Object>>}\n" +
- " */\n" +
- "com.example.components.TestClass.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'TestClass', qName: 'com.example.components.TestClass'}] };\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Prevent renaming of class. Needed for reflection.\n" +
- " */\n" +
- "goog.exportSymbol('com.example.components.TestClass', com.example.components.TestClass);\n" +
- "\n" +
- "\n" +
- "\n" +
- "/**\n" +
- " * Reflection\n" +
- " *\n" +
- " * @return {Object.<string, Function>}\n" +
- " */\n" +
- "com.example.components.TestClass.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
- " return {\n" +
- " variables: function () {\n" +
- " return {\n" +
- " };\n" +
- " },\n" +
- " accessors: function () {\n" +
- " return {\n" +
- " };\n" +
- " },\n" +
- " methods: function () {\n" +
- " return {\n" +
- " };\n" +
- " }\n" +
- " };\n" +
- "};\n");
- }
-
-
- @Override
- @Test
- public void testDefaultParameter()
- {
- IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
- + " p3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
- + " p4 = typeof p4 !== 'undefined' ? p4 : 4;\n"
- + " return p1 + p2 + p3 + p4;\n}");
- }
-
- @Override
- @Test
- public void testDefaultParameter_Body()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number=} bar\n * @param {number=} bax\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, bax) {\n"
- + " bar = typeof bar !== 'undefined' ? bar : 42;\n"
- + " bax = typeof bax !== 'undefined' ? bax : 4;\n"
- + " if (a)\n foo();\n}");
- }
-
- @Override
- @Test
- public void testDefaultParameter_NoBody()
- {
- IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
- + " p3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
- + " p4 = typeof p4 !== 'undefined' ? p4 : 4;\n}");
- }
-
- @Override
- @Test
- public void testSimpleParameterReturnType()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int):int{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} bar\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar) {\n}");
- }
-
- @Override
- @Test
- public void testSimpleMultipleParameter()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Override
- @Test
- public void testSimpleMultipleParameter_JSDoc()
- {
- IFunctionNode node = getMethodWithPackage("/**\n * This is copied from ASDoc.\n */\nfunction method1(bar:int, baz:String, goo:Array):void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * This is copied from ASDoc.\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Test
- public void testSimpleMultipleParameter_JSDocSingleLine()
- {
- IFunctionNode node = getMethodWithPackage("/** This is copied from ASDoc. */\nfunction method1(bar:int, baz:String, goo:Array):void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/** This is copied from ASDoc. \n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Override
- protected IBackend createBackend()
- {
- return new FlexJSBackend();
- }
-
- @Override
- protected void addDependencies()
- {
- super.addDependencies();
- workspace.setASDocDelegate(new FlexJSASDocDelegate());
- MXMLJSC.keepASDoc = true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmitter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmitter.java
new file mode 100644
index 0000000..013d930
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmitter.java
@@ -0,0 +1,364 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.flexjs;
+
+import org.apache.flex.compiler.clients.MXMLJSC;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogEmitter;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.parsing.as.FlexJSASDocDelegate;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.junit.Test;
+
+/**
+ * @author Erik de Bruin
+ */
+public class TestFlexJSEmitter extends TestGoogEmitter
+{
+ @Override
+ public void setUp()
+ {
+ project = new FlexJSProject(workspace);
+
+ super.setUp();
+ }
+
+ @Override
+ @Test
+ public void testSimple()
+ {
+ String code = "package com.example.components {"
+ + "import goog.events.EventTarget;"
+ + "public class MyEventTarget extends EventTarget {"
+ + "public function MyEventTarget() {if (foo() != 42) { bar(); } }"
+ + "private var _privateVar:String = \"do \";"
+ + "public var publicProperty:Number = 100;"
+ + "public function myFunction(value: String): String{"
+ + "return \"Don't \" + _privateVar + value; }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOutWithMetadata("/**\n" +
+ " * com.example.components.MyEventTarget\n" +
+ " *\n" +
+ " * @fileoverview\n" +
+ " *\n" +
+ " * @suppress {checkTypes|accessControls}\n" +
+ " */\n" +
+ "\n" +
+ "goog.provide('com.example.components.MyEventTarget');\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @constructor\n" +
+ " * @extends {goog.events.EventTarget}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget = function() {\n" +
+ " com.example.components.MyEventTarget.base(this, 'constructor');\n" +
+ " if (foo() != 42) {\n" +
+ " bar();\n" +
+ " }\n" +
+ "};\n" +
+ "goog.inherits(com.example.components.MyEventTarget, goog.events.EventTarget);\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @private\n" +
+ " * @type {string}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget.prototype._privateVar = \"do \";\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @export\n" +
+ " * @type {number}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget.prototype.publicProperty = 100;\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @export\n" +
+ " * @param {string} value\n" +
+ " * @return {string}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget.prototype.myFunction = function(value) {\n" +
+ " return \"Don't \" + this._privateVar + value;\n" +
+ "};\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Metadata\n" +
+ " *\n" +
+ " * @type {Object.<string, Array.<Object>>}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'MyEventTarget', qName: 'com.example.components.MyEventTarget'}] };\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Prevent renaming of class. Needed for reflection.\n" +
+ " */\n" +
+ "goog.exportSymbol('com.example.components.MyEventTarget', com.example.components.MyEventTarget);\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Reflection\n" +
+ " *\n" +
+ " * @return {Object.<string, Function>}\n" +
+ " */\n" +
+ "com.example.components.MyEventTarget.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
+ " return {\n" +
+ " variables: function () {\n" +
+ " return {\n" +
+ " 'publicProperty': { type: 'Number'}\n" +
+ " };\n" +
+ " },\n" +
+ " accessors: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " },\n" +
+ " methods: function () {\n" +
+ " return {\n" +
+ " 'MyEventTarget': { type: '', declaredBy: 'com.example.components.MyEventTarget'},\n" +
+ " 'myFunction': { type: 'String', declaredBy: 'com.example.components.MyEventTarget'}\n" +
+ " };\n" +
+ " }\n" +
+ " };\n" +
+ "};\n");
+ }
+
+ @Override
+ @Test
+ public void testSimpleInterface()
+ {
+ String code = "package com.example.components {"
+ + "public interface TestInterface { } }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOutWithMetadata("/**\n" +
+ " * com.example.components.TestInterface\n" +
+ " *\n" +
+ " * @fileoverview\n" +
+ " *\n" +
+ " * @suppress {checkTypes|accessControls}\n" +
+ " */\n" +
+ "\n" +
+ "goog.provide('com.example.components.TestInterface');\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @interface\n" +
+ " */\ncom.example.components.TestInterface = function() {\n" +
+ "};\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Metadata\n" +
+ " *\n" +
+ " * @type {Object.<string, Array.<Object>>}\n" +
+ " */\n" +
+ "com.example.components.TestInterface.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'TestInterface', qName: 'com.example.components.TestInterface'}] };\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Reflection\n" +
+ " *\n" +
+ " * @return {Object.<string, Function>}\n" +
+ " */\n" +
+ "com.example.components.TestInterface.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
+ " return {\n" +
+ " variables: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " },\n" +
+ " accessors: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " },\n" +
+ " methods: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " }\n" +
+ " };\n" +
+ "};\n");
+ }
+
+ @Override
+ @Test
+ public void testSimpleClass()
+ {
+ String code = "package com.example.components {"
+ + "public class TestClass { } }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOutWithMetadata("/**\n" +
+ " * com.example.components.TestClass\n" +
+ " *\n" +
+ " * @fileoverview\n" +
+ " *\n" +
+ " * @suppress {checkTypes|accessControls}\n" +
+ " */\n" +
+ "\n" +
+ "goog.provide('com.example.components.TestClass');\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * @constructor\n" +
+ " */\n" +
+ "com.example.components.TestClass = function() {\n" +
+ "};\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Metadata\n" +
+ " *\n" +
+ " * @type {Object.<string, Array.<Object>>}\n" +
+ " */\n" +
+ "com.example.components.TestClass.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'TestClass', qName: 'com.example.components.TestClass'}] };\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Prevent renaming of class. Needed for reflection.\n" +
+ " */\n" +
+ "goog.exportSymbol('com.example.components.TestClass', com.example.components.TestClass);\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "/**\n" +
+ " * Reflection\n" +
+ " *\n" +
+ " * @return {Object.<string, Function>}\n" +
+ " */\n" +
+ "com.example.components.TestClass.prototype.FLEXJS_REFLECTION_INFO = function () {\n" +
+ " return {\n" +
+ " variables: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " },\n" +
+ " accessors: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " },\n" +
+ " methods: function () {\n" +
+ " return {\n" +
+ " };\n" +
+ " }\n" +
+ " };\n" +
+ "};\n");
+ }
+
+
+ @Override
+ @Test
+ public void testDefaultParameter()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
+ + " p3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
+ + " p4 = typeof p4 !== 'undefined' ? p4 : 4;\n"
+ + " return p1 + p2 + p3 + p4;\n}");
+ }
+
+ @Override
+ @Test
+ public void testDefaultParameter_Body()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number=} bar\n * @param {number=} bax\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, bax) {\n"
+ + " bar = typeof bar !== 'undefined' ? bar : 42;\n"
+ + " bax = typeof bax !== 'undefined' ? bax : 4;\n"
+ + " if (a)\n foo();\n}");
+ }
+
+ @Override
+ @Test
+ public void testDefaultParameter_NoBody()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
+ + " p3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
+ + " p4 = typeof p4 !== 'undefined' ? p4 : 4;\n}");
+ }
+
+ @Override
+ @Test
+ public void testSimpleParameterReturnType()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int):int{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} bar\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar) {\n}");
+ }
+
+ @Override
+ @Test
+ public void testSimpleMultipleParameter()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Override
+ @Test
+ public void testSimpleMultipleParameter_JSDoc()
+ {
+ IFunctionNode node = getMethodWithPackage("/**\n * This is copied from ASDoc.\n */\nfunction method1(bar:int, baz:String, goo:Array):void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * This is copied from ASDoc.\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Test
+ public void testSimpleMultipleParameter_JSDocSingleLine()
+ {
+ IFunctionNode node = getMethodWithPackage("/** This is copied from ASDoc. */\nfunction method1(bar:int, baz:String, goo:Array):void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/** This is copied from ASDoc. \n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Override
+ protected IBackend createBackend()
+ {
+ return new FlexJSBackend();
+ }
+
+ @Override
+ protected void addDependencies()
+ {
+ super.addDependencies();
+ workspace.setASDocDelegate(new FlexJSASDocDelegate());
+ MXMLJSC.keepASDoc = true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
deleted file mode 100644
index 21a9c90..0000000
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.js.goog;
-
-import org.apache.flex.compiler.driver.IBackend;
-import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
-import org.apache.flex.compiler.internal.test.ASTestBase;
-import org.apache.flex.compiler.tree.as.IFileNode;
-import org.apache.flex.compiler.tree.as.IFunctionNode;
-import org.junit.Test;
-
-/**
- * This class tests the production of 'goog' JavaScript output.
- * <p>
- * Note; this is a complete prototype more used in figuring out where
- * abstraction and indirection is needed concerning the AS -> JS translations.
- *
- * @author Michael Schmalle
- */
-public class TestGoogEmiter extends ASTestBase
-{
-
- @Test
- public void testSimple()
- {
- String code = "package com.example.components {"
- + "import goog.events.EventTarget;"
- + "public class MyEventTarget extends EventTarget {"
- + "public function MyEventTarget() {if (foo() != 42) { bar(); } }"
- + "private var _privateVar:String = \"do \";"
- + "public var publicProperty:Number = 100;"
- + "public function myFunction(value: String): String{"
- + "return \"Don't \" + _privateVar + value; }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOut("goog.provide('com.example.components.MyEventTarget');\n\ngoog.require('goog.events.EventTarget');\n\n/**\n * @constructor\n * @extends {goog.events.EventTarget}\n */\ncom.example.components.MyEventTarget = function() {\n\tvar self = this;\n\tcom.example.components.MyEventTarget.base(this, 'constructor');\n\tif (foo() != 42) {\n\t\tbar();\n\t}\n};\ngoog.inherits(com.example.components.MyEventTarget, goog.events.EventTarget);\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyEventTarget.prototype._privateVar = \"do \";\n\n/**\n * @type {number}\n */\ncom.example.components.MyEventTarget.prototype.publicProperty = 100;\n\n/**\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyEventTarget.prototype.myFunction = function(value) {\n\tvar self = this;\n\treturn \"Don't \" + self._privateVar + value;\n};");
- }
-
- @Test
- public void testSimpleInterface()
- {
- String code = "package com.example.components {"
- + "public interface TestInterface { } }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOut("goog.provide('com.example.components.TestInterface');\n\n/**\n * @interface\n */\ncom.example.components.TestInterface = function() {\n};");
- }
-
- @Test
- public void testSimpleClass()
- {
- String code = "package com.example.components {"
- + "public class TestClass { } }";
- IFileNode node = compileAS(code);
- asBlockWalker.visitFile(node);
- assertOut("goog.provide('com.example.components.TestClass');\n\n/**\n * @constructor\n */\ncom.example.components.TestClass = function() {\n};");
- }
-
- @Test
- public void testSimpleMethod()
- {
- IFunctionNode node = getMethod("function method1():void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("FalconTest_A.prototype.method1 = function() {\n}");
- }
-
- @Test
- public void testSimpleParameterReturnType()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int):int{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} bar\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar) {\n}");
- }
-
- @Test
- public void testSimpleMultipleParameter()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Test
- public void testSimpleMultipleParameter_JSDoc()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
- }
-
- @Test
- public void testDefaultParameter()
- {
- IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
- + "\tvar self = this;\n"
- + "\tp3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
- + "\tp4 = typeof p4 !== 'undefined' ? p4 : 4;\n"
- + "\treturn p1 + p2 + p3 + p4;\n}");
- }
-
- @Test
- public void testDefaultParameter_Body()
- {
- IFunctionNode node = getMethodWithPackage("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number=} bar\n * @param {number=} bax\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(bar, bax) {\n"
- + "\tvar self = this;\n"
- + "\tbar = typeof bar !== 'undefined' ? bar : 42;\n"
- + "\tbax = typeof bax !== 'undefined' ? bax : 4;\n"
- + "\tif (a)\n\t\tfoo();\n}");
- }
-
- @Test
- public void testDefaultParameter_NoBody()
- {
- IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{}");
- asBlockWalker.visitFunction(node);
- assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
- + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
- + "\tp3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
- + "\tp4 = typeof p4 !== 'undefined' ? p4 : 4;\n}");
- }
-
- @Override
- protected IBackend createBackend()
- {
- return new GoogBackend();
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6993a66e/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmitter.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmitter.java
new file mode 100644
index 0000000..92f0ecb
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmitter.java
@@ -0,0 +1,153 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.goog;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of 'goog' JavaScript output.
+ * <p>
+ * Note; this is a complete prototype more used in figuring out where
+ * abstraction and indirection is needed concerning the AS -> JS translations.
+ *
+ * @author Michael Schmalle
+ */
+public class TestGoogEmitter extends ASTestBase
+{
+
+ @Test
+ public void testSimple()
+ {
+ String code = "package com.example.components {"
+ + "import goog.events.EventTarget;"
+ + "public class MyEventTarget extends EventTarget {"
+ + "public function MyEventTarget() {if (foo() != 42) { bar(); } }"
+ + "private var _privateVar:String = \"do \";"
+ + "public var publicProperty:Number = 100;"
+ + "public function myFunction(value: String): String{"
+ + "return \"Don't \" + _privateVar + value; }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOut("goog.provide('com.example.components.MyEventTarget');\n\ngoog.require('goog.events.EventTarget');\n\n/**\n * @constructor\n * @extends {goog.events.EventTarget}\n */\ncom.example.components.MyEventTarget = function() {\n\tvar self = this;\n\tcom.example.components.MyEventTarget.base(this, 'constructor');\n\tif (foo() != 42) {\n\t\tbar();\n\t}\n};\ngoog.inherits(com.example.components.MyEventTarget, goog.events.EventTarget);\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyEventTarget.prototype._privateVar = \"do \";\n\n/**\n * @type {number}\n */\ncom.example.components.MyEventTarget.prototype.publicProperty = 100;\n\n/**\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyEventTarget.prototype.myFunction = function(value) {\n\tvar self = this;\n\treturn \"Don't \" + self._privateVar + value;\n};");
+ }
+
+ @Test
+ public void testSimpleInterface()
+ {
+ String code = "package com.example.components {"
+ + "public interface TestInterface { } }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOut("goog.provide('com.example.components.TestInterface');\n\n/**\n * @interface\n */\ncom.example.components.TestInterface = function() {\n};");
+ }
+
+ @Test
+ public void testSimpleClass()
+ {
+ String code = "package com.example.components {"
+ + "public class TestClass { } }";
+ IFileNode node = compileAS(code);
+ asBlockWalker.visitFile(node);
+ assertOut("goog.provide('com.example.components.TestClass');\n\n/**\n * @constructor\n */\ncom.example.components.TestClass = function() {\n};");
+ }
+
+ @Test
+ public void testSimpleMethod()
+ {
+ IFunctionNode node = getMethod("function method1():void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("FalconTest_A.prototype.method1 = function() {\n}");
+ }
+
+ @Test
+ public void testSimpleParameterReturnType()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int):int{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} bar\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar) {\n}");
+ }
+
+ @Test
+ public void testSimpleMultipleParameter()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Test
+ public void testSimpleMultipleParameter_JSDoc()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, baz, goo) {\n}");
+ }
+
+ @Test
+ public void testDefaultParameter()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
+ + "\tvar self = this;\n"
+ + "\tp3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
+ + "\tp4 = typeof p4 !== 'undefined' ? p4 : 4;\n"
+ + "\treturn p1 + p2 + p3 + p4;\n}");
+ }
+
+ @Test
+ public void testDefaultParameter_Body()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number=} bar\n * @param {number=} bax\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(bar, bax) {\n"
+ + "\tvar self = this;\n"
+ + "\tbar = typeof bar !== 'undefined' ? bar : 42;\n"
+ + "\tbax = typeof bax !== 'undefined' ? bax : 4;\n"
+ + "\tif (a)\n\t\tfoo();\n}");
+ }
+
+ @Test
+ public void testDefaultParameter_NoBody()
+ {
+ IFunctionNode node = getMethodWithPackage("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @param {number} p1\n * @param {number} p2\n * @param {number=} p3\n * @param {number=} p4\n * @return {number}\n */\n"
+ + "foo.bar.FalconTest_A.prototype.method1 = function(p1, p2, p3, p4) {\n"
+ + "\tp3 = typeof p3 !== 'undefined' ? p3 : 3;\n"
+ + "\tp4 = typeof p4 !== 'undefined' ? p4 : 4;\n}");
+ }
+
+ @Override
+ protected IBackend createBackend()
+ {
+ return new GoogBackend();
+ }
+}
[8/8] git commit: [flex-falcon] [refs/heads/develop] - Merge branch
'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop
Posted by jo...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/590d813d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/590d813d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/590d813d
Branch: refs/heads/develop
Commit: 590d813d9e9cb9ea748cc8098137d2567263f6ff
Parents: f8fc7fd e44aa18
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 16:18:38 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 16:18:38 2016 -0700
----------------------------------------------------------------------
externs/js/src/main/config/compile-as-config.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
[7/8] git commit: [flex-falcon] [refs/heads/develop] - source maps
for getters and setters
Posted by jo...@apache.org.
source maps for getters and setters
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f8fc7fda
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f8fc7fda
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f8fc7fda
Branch: refs/heads/develop
Commit: f8fc7fda95326cfeba040a6e34183ac9a297a7f5
Parents: 716a788
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 16:07:45 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 16:07:45 2016 -0700
----------------------------------------------------------------------
.../internal/codegen/js/jx/AccessorEmitter.java | 110 ++++++++++++++++---
1 file changed, 94 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f8fc7fda/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
index f2910d7..7440462 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
@@ -107,13 +107,33 @@ public class AccessorEmitter extends JSSubEmitter implements
boolean wroteGetter = false;
PropertyNodes p = getModel().getPropertyMap().get(propName);
+ IGetterNode getterNode = p.getter;
+ ISetterNode setterNode = p.setter;
writeNewline("/** @export */");
+ if (getterNode != null)
+ {
+ startMapping(getterNode);
+ }
+ else
+ {
+ startMapping(setterNode);
+ }
write(propName);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
- writeNewline(ASEmitterTokens.BLOCK_OPEN);
- if (p.getter != null)
+ write(ASEmitterTokens.BLOCK_OPEN);
+ if (getterNode != null)
+ {
+ endMapping(getterNode);
+ }
+ else
+ {
+ endMapping(setterNode);
+ }
+ writeNewline();
+ if (getterNode != null)
{
+ startMapping(getterNode);
write(ASEmitterTokens.GET);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
@@ -129,12 +149,13 @@ public class AccessorEmitter extends JSSubEmitter implements
write(JSDocEmitterTokens.JSDOC_CLOSE);
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.FUNCTION);
- fjs.emitParameters(p.getter.getParametersContainerNode());
+ endMapping(getterNode);
+ fjs.emitParameters(getterNode.getParametersContainerNode());
- fjs.emitDefinePropertyFunction(p.getter);
+ fjs.emitDefinePropertyFunction(getterNode);
wroteGetter = true;
}
- else if (p.setter != null && p.setter.getDefinition().isOverride())
+ else if (setterNode != null && setterNode.getDefinition().isOverride())
{
// see if there is a getter on a base class. If so, we have to
// generate a call to the super from this class because
@@ -187,11 +208,12 @@ public class AccessorEmitter extends JSSubEmitter implements
wroteGetter = true;
}
}
- if (p.setter != null)
+ if (setterNode != null)
{
if (wroteGetter)
writeNewline(ASEmitterTokens.COMMA);
+ startMapping(setterNode);
write(ASEmitterTokens.SET);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
@@ -207,11 +229,12 @@ public class AccessorEmitter extends JSSubEmitter implements
write(JSDocEmitterTokens.JSDOC_CLOSE);
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.FUNCTION);
- fjs.emitParameters(p.setter.getParametersContainerNode());
+ endMapping(setterNode);
+ fjs.emitParameters(setterNode.getParametersContainerNode());
- fjs.emitDefinePropertyFunction(p.setter);
+ fjs.emitDefinePropertyFunction(setterNode);
}
- else if (p.getter != null && p.getter.getDefinition().isOverride())
+ else if (getterNode != null && getterNode.getDefinition().isOverride())
{
// see if there is a getter on a base class. If so, we have to
// generate a call to the super from this class because
@@ -267,7 +290,23 @@ public class AccessorEmitter extends JSSubEmitter implements
write(ASEmitterTokens.BLOCK_CLOSE);
}
}
+ if (getterNode != null)
+ {
+ startMapping(getterNode);
+ }
+ else
+ {
+ startMapping(setterNode);
+ }
write(ASEmitterTokens.BLOCK_CLOSE);
+ if (getterNode != null)
+ {
+ endMapping(getterNode);
+ }
+ else
+ {
+ endMapping(setterNode);
+ }
}
writeNewline(ASEmitterTokens.BLOCK_CLOSE);
write(ASEmitterTokens.PAREN_CLOSE);
@@ -299,35 +338,74 @@ public class AccessorEmitter extends JSSubEmitter implements
PropertyNodes p = getModel().getStaticPropertyMap().get(
propName);
+ IGetterNode getterNode = p.getter;
+ ISetterNode setterNode = p.setter;
writeNewline("/** @export */");
+ if (getterNode != null)
+ {
+ startMapping(getterNode);
+ }
+ else
+ {
+ startMapping(setterNode);
+ }
write(propName);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
- writeNewline(ASEmitterTokens.BLOCK_OPEN);
- if (p.getter != null)
+ write(ASEmitterTokens.BLOCK_OPEN);
+ if (getterNode != null)
+ {
+ endMapping(getterNode);
+ }
+ else
+ {
+ endMapping(setterNode);
+ }
+ writeNewline();
+ if (getterNode != null)
{
+ startMapping(getterNode);
write(ASEmitterTokens.GET);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.FUNCTION);
- fjs.emitParameters(p.getter.getParametersContainerNode());
+ endMapping(getterNode);
+ fjs.emitParameters(getterNode.getParametersContainerNode());
- fjs.emitDefinePropertyFunction(p.getter);
+ fjs.emitDefinePropertyFunction(getterNode);
}
- if (p.setter != null)
+ if (setterNode != null)
{
if (p.getter != null)
writeNewline(ASEmitterTokens.COMMA);
+ startMapping(setterNode);
write(ASEmitterTokens.SET);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.FUNCTION);
- fjs.emitParameters(p.setter.getParametersContainerNode());
+ endMapping(setterNode);
+ fjs.emitParameters(setterNode.getParametersContainerNode());
- fjs.emitDefinePropertyFunction(p.setter);
+ fjs.emitDefinePropertyFunction(setterNode);
+ }
+ if (getterNode != null)
+ {
+ startMapping(getterNode);
+ }
+ else
+ {
+ startMapping(setterNode);
}
write(ASEmitterTokens.BLOCK_CLOSE);
+ if (getterNode != null)
+ {
+ endMapping(getterNode);
+ }
+ else
+ {
+ endMapping(setterNode);
+ }
}
writeNewline(ASEmitterTokens.BLOCK_CLOSE);
write(ASEmitterTokens.PAREN_CLOSE);
[4/8] git commit: [flex-falcon] [refs/heads/develop] - source maps
for with
Posted by jo...@apache.org.
source maps for with
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b20a5d5d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b20a5d5d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b20a5d5d
Branch: refs/heads/develop
Commit: b20a5d5d189e931ff5e63ede5e856e93a250c500
Parents: b0ccb16
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 14:43:47 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 14:43:47 2016 -0700
----------------------------------------------------------------------
.../compiler/internal/codegen/js/JSEmitter.java | 10 ++++
.../internal/codegen/js/jx/WithEmitter.java | 56 ++++++++++++++++++++
.../js/sourcemaps/TestSourceMapStatements.java | 34 ++++++++++++
3 files changed, 100 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b20a5d5d/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 ece92d7..41ea685 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
@@ -56,6 +56,7 @@ import org.apache.flex.compiler.internal.codegen.js.jx.ThrowEmitter;
import org.apache.flex.compiler.internal.codegen.js.jx.TryEmitter;
import org.apache.flex.compiler.internal.codegen.js.jx.UnaryOperatorEmitter;
import org.apache.flex.compiler.internal.codegen.js.jx.WhileLoopEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.WithEmitter;
import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
import org.apache.flex.compiler.internal.tree.as.FunctionNode;
import org.apache.flex.compiler.tree.as.IASNode;
@@ -84,6 +85,7 @@ import org.apache.flex.compiler.tree.as.ITypeNode;
import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
import com.google.debugging.sourcemap.FilePosition;
@@ -116,6 +118,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
public ISubEmitter<ITryNode> tryEmitter;
public ISubEmitter<ICatchNode> catchEmitter;
public ISubEmitter<IThrowNode> throwEmitter;
+ public ISubEmitter<IWithNode> withEmitter;
public ISubEmitter<IASNode> statementEmitter;
public ISubEmitter<ILanguageIdentifierNode> languageIdentifierEmitter;
public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
@@ -166,6 +169,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
tryEmitter = new TryEmitter(this);
catchEmitter = new CatchEmitter(this);
throwEmitter = new ThrowEmitter(this);
+ withEmitter = new WithEmitter(this);
statementEmitter = new StatementEmitter(this);
languageIdentifierEmitter = new LanguageIdentifierEmitter(this);
sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
@@ -264,6 +268,12 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
}
@Override
+ public void emitWith(IWithNode node)
+ {
+ withEmitter.emit(node);
+ }
+
+ @Override
public void emitThrow(IThrowNode node)
{
throwEmitter.emit(node);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b20a5d5d/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/WithEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/WithEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/WithEmitter.java
new file mode 100644
index 0000000..934bfab
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/WithEmitter.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
+
+public class WithEmitter extends JSSubEmitter implements
+ ISubEmitter<IWithNode>
+{
+ public WithEmitter(IJSEmitter emitter)
+ {
+ super(emitter);
+ }
+
+ @Override
+ public void emit(IWithNode node)
+ {
+ IContainerNode cnode = (IContainerNode) node.getChild(1);
+ startMapping(node);
+ writeToken(ASEmitterTokens.WITH);
+ write(ASEmitterTokens.PAREN_OPEN);
+ endMapping(node);
+ IExpressionNode targetNode = node.getTargetNode();
+ getWalker().walk(targetNode);
+ startMapping(node, targetNode);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ if (!EmitterUtils.isImplicit(cnode))
+ write(ASEmitterTokens.SPACE);
+ endMapping(node);
+ getWalker().walk(node.getStatementContentsNode());
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b20a5d5d/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index 629f06a..11d8b4b 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -26,6 +26,7 @@ import org.apache.flex.compiler.tree.as.IIfNode;
import org.apache.flex.compiler.tree.as.ISwitchNode;
import org.apache.flex.compiler.tree.as.ITryNode;
import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
import org.junit.Test;
@@ -572,6 +573,39 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 29, 4, 0, 4, 4); // else
}
+ //----------------------------------
+ // with () {}
+ //----------------------------------
+
+ @Test
+ public void testVisitWith()
+ {
+ IWithNode node = (IWithNode) getNode("with (a) { b; }", IWithNode.class);
+ asBlockWalker.visitWith(node);
+ //with (a) {\n b;\n}
+ assertMapping(node, 0, 0, 0, 0, 0, 6); // with (
+ assertMapping(node, 0, 6, 0, 6, 0, 7); // a
+ assertMapping(node, 0, 7, 0, 7, 0, 9); // )
+ assertMapping(node, 0, 9, 0, 9, 0, 10); // {
+ assertMapping(node, 0, 11, 1, 2, 1, 3); // b
+ assertMapping(node, 0, 12, 1, 3, 1, 4); // ;
+ assertMapping(node, 0, 14, 2, 0, 2, 1); // }
+ }
+
+ @Test
+ public void testVisitWith_1a()
+ {
+ IWithNode node = (IWithNode) getNode("with (a) b;", IWithNode.class);
+ asBlockWalker.visitWith(node);
+ //with (a)\n b;
+ assertMapping(node, 0, 0, 0, 0, 0, 6); // with (
+ assertMapping(node, 0, 6, 0, 6, 0, 7); // a
+ assertMapping(node, 0, 7, 0, 7, 0, 8); // )
+ assertMapping(node, 0, 9, 1, 2, 1, 3); // b
+ assertMapping(node, 0, 10, 1, 3, 1, 4); // ;
+ }
+
+
protected IBackend createBackend()
{
return new FlexJSBackend();
[6/8] git commit: [flex-falcon] [refs/heads/develop] - added some
semi-colon checks in tests for source maps
Posted by jo...@apache.org.
added some semi-colon checks in tests for source maps
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/716a7880
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/716a7880
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/716a7880
Branch: refs/heads/develop
Commit: 716a7880a2071a05d2aaa7046b3b60895890e6bb
Parents: 6993a66
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 15:04:20 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 15:04:20 2016 -0700
----------------------------------------------------------------------
.../js/sourcemaps/TestSourceMapStatements.java | 25 ++++++++++++++++----
1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/716a7880/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index 11d8b4b..fc3dea7 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -187,11 +187,16 @@ public class TestSourceMapStatements extends SourceMapTestBase
"for (var i:int in obj) { break; }", IForLoopNode.class);
asBlockWalker.visitForLoop(node);
//for (var /** @type {number} */ i in obj) {\n break;\n}
- assertMapping(node, 0, 0, 0, 0, 0, 5); // for (
- assertMapping(node, 0, 14, 0, 32, 0, 36); // in
- assertMapping(node, 0, 21, 0, 39, 0, 41); // )
- assertMapping(node, 0, 23, 0, 41, 0, 42); // {
- assertMapping(node, 0, 32, 2, 0, 2, 1); // }
+ assertMapping(node, 0, 0, 0, 0, 0, 5); // for (
+ assertMapping(node, 0, 5, 0, 5, 0, 9); // var
+ assertMapping(node, 0, 9, 0, 31, 0, 32); // i
+ assertMapping(node, 0, 14, 0, 32, 0, 36); // in
+ assertMapping(node, 0, 18, 0, 36, 0, 39); // obj
+ assertMapping(node, 0, 21, 0, 39, 0, 41); // )
+ assertMapping(node, 0, 23, 0, 41, 0, 42); // {
+ assertMapping(node, 0, 25, 1, 2, 1, 7); // break
+ assertMapping(node, 0, 30, 1, 7, 1, 8); // ;
+ assertMapping(node, 0, 32, 2, 0, 2, 1); // }
}
@Test
@@ -224,6 +229,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 22, 3, 8, 3, 42); // foreachiter0_target[foreachiter0];
assertMapping(node, 0, 27, 4, 0, 4, 1); // {
assertMapping(node, 0, 29, 5, 2, 5, 7); // break
+ assertMapping(node, 0, 34, 5, 7, 5, 8); // ;
assertMapping(node, 0, 36, 6, 0, 6, 1); // }
}
@@ -244,6 +250,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 9, 3, 0, 3, 8); // var i =
assertMapping(node, 0, 22, 3, 8, 3, 42); // foreachiter0_target[foreachiter0];
assertMapping(node, 0, 28, 5, 2, 5, 7); // break
+ assertMapping(node, 0, 33, 5, 7, 5, 8); // ;
}
@Test
@@ -266,6 +273,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 22, 3, 8, 3, 42); // foreachiter0_target[foreachiter0];
assertMapping(node, 0, 33, 4, 0, 4, 1); // {
assertMapping(node, 0, 35, 5, 2, 5, 7); // break
+ assertMapping(node, 0, 40, 5, 7, 5, 8); // ;
assertMapping(node, 0, 42, 6, 0, 6, 1); // }
}
@@ -286,6 +294,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 9, 3, 0, 3, 4); // i =
assertMapping(node, 0, 14, 3, 4, 3, 38); // foreachiter0_target[foreachiter0];
assertMapping(node, 0, 20, 5, 2, 5, 7); // break
+ assertMapping(node, 0, 25, 5, 7, 5, 8); // ;
}
//----------------------------------
@@ -395,6 +404,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 15, 1, 7, 1, 8); // 1
assertMapping(node, 0, 16, 1, 8, 1, 9); // :
assertMapping(node, 0, 18, 2, 4, 2, 9); // break
+ assertMapping(node, 0, 23, 2, 9, 2, 10); // ;
assertMapping(node, 0, 24, 3, 0, 3, 1); // }
}
@@ -413,6 +423,7 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 15, 1, 7, 1, 8); // 1
assertMapping(node, 0, 16, 1, 8, 1, 9); // :
assertMapping(node, 0, 20, 2, 4, 2, 9); // break
+ assertMapping(node, 0, 25, 2, 9, 2, 10); // ;
assertMapping(node, 0, 28, 3, 0, 3, 1); // }
}
@@ -431,8 +442,10 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 15, 1, 7, 1, 8); // 1
assertMapping(node, 0, 16, 1, 8, 1, 9); // :
assertMapping(node, 0, 18, 2, 4, 2, 9); // break
+ assertMapping(node, 0, 23, 2, 9, 2, 10); // ;
assertMapping(node, 0, 25, 3, 2, 3, 10); // default:
assertMapping(node, 0, 34, 4, 4, 4, 10); // return
+ assertMapping(node, 0, 40, 4, 10, 4, 11); // ;
assertMapping(node, 0, 41, 5, 0, 5, 1); // }
}
@@ -451,10 +464,12 @@ public class TestSourceMapStatements extends SourceMapTestBase
assertMapping(node, 0, 15, 1, 7, 1, 8); // 1
assertMapping(node, 0, 16, 1, 8, 1, 9); // :
assertMapping(node, 0, 36, 3, 4, 3, 9); // break
+ assertMapping(node, 0, 41, 3, 9, 3, 10); // ;
assertMapping(node, 0, 46, 4, 2, 4, 7); // case
assertMapping(node, 0, 51, 4, 7, 4, 8); // 2
assertMapping(node, 0, 52, 4, 8, 4, 9); // :
assertMapping(node, 0, 72, 6, 4, 6, 9); // break
+ assertMapping(node, 0, 77, 6, 9, 6, 10); // ;
assertMapping(node, 0, 80, 7, 0, 7, 1); // }
}
[2/8] git commit: [flex-falcon] [refs/heads/develop] - compiler-jx:
some extra tests
Posted by jo...@apache.org.
compiler-jx: some extra tests
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/50c093b9
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/50c093b9
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/50c093b9
Branch: refs/heads/develop
Commit: 50c093b9249f3d5851884d459c794fe3ebf8e08b
Parents: 0286cac
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 14:21:24 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 14:21:24 2016 -0700
----------------------------------------------------------------------
.../internal/codegen/as/TestExpressions.java | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50c093b9/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
index ab7d66f..bc15e4b 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
@@ -30,6 +30,7 @@ import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
import org.apache.flex.compiler.tree.as.INamespaceAccessExpressionNode;
import org.apache.flex.compiler.tree.as.IReturnNode;
import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IThrowNode;
import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
import org.apache.flex.compiler.tree.as.IVariableNode;
import org.junit.Test;
@@ -731,7 +732,7 @@ public class TestExpressions extends ASTestBase
}
@Test
- public void testVisitReturn()
+ public void testVisitReturnWithoutValue()
{
IReturnNode node = (IReturnNode) getNode("return", IReturnNode.class);
asBlockWalker.visitReturn(node);
@@ -739,6 +740,22 @@ public class TestExpressions extends ASTestBase
}
@Test
+ public void testVisitReturnWithValue()
+ {
+ IReturnNode node = (IReturnNode) getNode("return a", IReturnNode.class);
+ asBlockWalker.visitReturn(node);
+ assertOut("return a");
+ }
+
+ @Test
+ public void testVisitThrow()
+ {
+ IThrowNode node = (IThrowNode) getNode("throw a", IThrowNode.class);
+ asBlockWalker.visitThrow(node);
+ assertOut("throw a");
+ }
+
+ @Test
public void testVisitFunctionCall_1()
{
IFunctionCallNode node = (IFunctionCallNode) getNode("a()", IFunctionCallNode.class);
[3/8] git commit: [flex-falcon] [refs/heads/develop] - remove console
output
Posted by jo...@apache.org.
remove console output
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b0ccb164
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b0ccb164
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b0ccb164
Branch: refs/heads/develop
Commit: b0ccb164002f252f812d6cf9f32338c98ae73ea8
Parents: 50c093b
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 29 14:21:44 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Fri Apr 29 14:21:44 2016 -0700
----------------------------------------------------------------------
.../internal/codegen/js/sourcemaps/TestSourceMapStatements.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b0ccb164/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index 45187b1..629f06a 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -274,7 +274,6 @@ public class TestSourceMapStatements extends SourceMapTestBase
IForLoopNode node = (IForLoopNode) getNode(
"var i:int; for each(i in obj) break; ", IForLoopNode.class);
asBlockWalker.visitForLoop(node);
- System.out.println(removeGeneratedString(writer.toString()));
//var foreachiter0_target = obj;\nfor (var foreachiter0 in foreachiter0_target) \n{\ni = foreachiter0_target[foreachiter0];\n\n break;}\n
assertMapping(node, 0, 14, 0, 0, 0, 26); // var foreachiter0_target =
assertMapping(node, 0, 14, 0, 26, 0, 29); // obj