flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ftho...@apache.org
Subject [2/6] git commit: [flex-falcon] [refs/heads/JsToAs] - Cleanup.
Date Tue, 01 Sep 2015 20:19:30 GMT
Cleanup.

- Removed useless null check.
- Used contains() instead of indexOf for clarity.


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

Branch: refs/heads/JsToAs
Commit: c6a739fcccc449350a654fb8bab4f9817bc92044
Parents: 5caf88d
Author: Frédéric THOMAS <webdoublefx@gmail.com>
Authored: Tue Sep 1 21:06:32 2015 +0100
Committer: Frédéric THOMAS <webdoublefx@gmail.com>
Committed: Tue Sep 1 21:07:46 2015 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSDocEmitter.java   |  2 +-
 .../codegen/js/jx/PackageHeaderEmitter.java     | 37 +++++++++-----------
 2 files changed, 18 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c6a739fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 681a7df..5d671b5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -206,7 +206,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                             .getDefinition()).resolveReturnType(project);
 
                     String packageName = "";
-                    packageName = tdef.getPackageName();
+                    packageName = tdef != null ? tdef.getPackageName() : "";
 
                     emitReturn(node, packageName);
                 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c6a739fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index f5fe623..2a4b0ba 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -99,27 +99,24 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
         if (typeNode instanceof ClassNode)
         {
             ClassNode classNode = (ClassNode) typeNode;
-            if (classNode != null)
+            ASDocComment asDoc = (ASDocComment) classNode.getASDocComment();
+            if (asDoc != null)
             {
-                ASDocComment asDoc = (ASDocComment) classNode.getASDocComment();
-                if (asDoc != null)
+                String asDocString = asDoc.commentNoEnd();
+                String ignoreToken = JSFlexJSEmitterTokens.IGNORE_IMPORT
+                        .getToken();
+                int ignoreIndex = asDocString.indexOf(ignoreToken);
+                while (ignoreIndex != -1)
                 {
-                    String asDocString = asDoc.commentNoEnd();
-                    String ignoreToken = JSFlexJSEmitterTokens.IGNORE_IMPORT
-                            .getToken();
-                    int ignoreIndex = asDocString.indexOf(ignoreToken);
-                    while (ignoreIndex != -1)
-                    {
-                        String ignorable = asDocString.substring(ignoreIndex
-                                + ignoreToken.length());
-                        int endIndex = ignorable.indexOf("\n");
-                        ignorable = ignorable.substring(0, endIndex);
-                        ignorable = ignorable.trim();
-                        // pretend we've already written the goog.requires for this
-                        writtenRequires.add(ignorable);
-                        ignoreIndex = asDocString.indexOf(ignoreToken,
-                                ignoreIndex + ignoreToken.length());
-                    }
+                    String ignorable = asDocString.substring(ignoreIndex
+                            + ignoreToken.length());
+                    int endIndex = ignorable.indexOf("\n");
+                    ignorable = ignorable.substring(0, endIndex);
+                    ignorable = ignorable.trim();
+                    // pretend we've already written the goog.requires for this
+                    writtenRequires.add(ignorable);
+                    ignoreIndex = asDocString.indexOf(ignoreToken,
+                            ignoreIndex + ignoreToken.length());
                 }
             }
         }
@@ -142,7 +139,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
         {
             for (String imp : requiresList)
             {
-                if (imp.indexOf(JSGoogEmitterTokens.AS3.getToken()) != -1)
+                if (imp.contains(JSGoogEmitterTokens.AS3.getToken()))
                     continue;
 
                 if (imp.equals(cname))


Mime
View raw message