You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/12/24 07:03:42 UTC
git commit: [flex-falcon] [refs/heads/develop] - FLEX-34994 handle
single-line asdoc
Repository: flex-falcon
Updated Branches:
refs/heads/develop fe2a00466 -> 9107d0682
FLEX-34994 handle single-line asdoc
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9107d068
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9107d068
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9107d068
Branch: refs/heads/develop
Commit: 9107d0682a4d32e6afebe8b48f50cc6155325220
Parents: fe2a004
Author: Alex Harui <ah...@apache.org>
Authored: Wed Dec 23 22:03:02 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Dec 23 22:03:02 2015 -0800
----------------------------------------------------------------------
.../codegen/js/flexjs/TestFlexJSEmiter.java | 23 ++++++++++++++++++--
.../compiler/asdoc/flexjs/ASDocComment.java | 8 ++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9107d068/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
index 1359fa7..c6aea33 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
@@ -19,9 +19,11 @@
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;
@@ -141,9 +143,18 @@ public class TestFlexJSEmiter extends TestGoogEmiter
@Test
public void testSimpleMultipleParameter_JSDoc()
{
- IFunctionNode node = getMethodWithPackage("function method1(bar:int, baz:String, goo:Array):void{\n}");
+ 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 * @param {number} bar\n * @param {string} baz\n * @param {Array} goo\n */\n"
+ 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}");
}
@@ -152,5 +163,13 @@ public class TestFlexJSEmiter extends TestGoogEmiter
{
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/9107d068/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java b/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java
index eedf79a..5470f47 100644
--- a/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java
+++ b/compiler.jx/src/org/apache/flex/compiler/asdoc/flexjs/ASDocComment.java
@@ -43,9 +43,15 @@ public class ASDocComment implements IASDocComment
String s = token.getText();
String[] lines = s.split("\n");
StringBuilder sb = new StringBuilder();
+ int n = lines.length;
+ if (n == 1)
+ {
+ int c = lines[0].indexOf("*/");
+ if (c != -1)
+ lines[0] = lines[0].substring(0, c);
+ }
sb.append(lines[0]);
sb.append("\n");
- int n = lines.length;
for (int i = 1; i < n - 1; i++)
{
String line = lines[i];