flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - Fixed up the logging to use a hack DebugLogUtil, the console isn't spammed now.
Date Sat, 13 Jun 2015 18:33:29 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 2c827a2a0 -> 00db22b88


Fixed up the logging to use a hack DebugLogUtil, the console isn't spammed now.


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

Branch: refs/heads/develop
Commit: 00db22b887f9875a63cac4ea6b0c328c8446525f
Parents: 2c827a2
Author: Michael Schmalle <mschmalle@apache.org>
Authored: Sat Jun 13 14:33:03 2015 -0400
Committer: Michael Schmalle <mschmalle@apache.org>
Committed: Sat Jun 13 14:33:03 2015 -0400

----------------------------------------------------------------------
 .../externals/pass/AbstractCompilerPass.java    | 19 ++++++-
 .../codegen/externals/pass/AddMemberPass.java   | 21 ++++----
 .../externals/pass/CollectTypesPass.java        |  4 --
 .../externals/pass/NamespaceResolutionPass.java | 16 +-----
 .../externals/reference/ReferenceModel.java     | 48 +++++++++++++-----
 .../codegen/externals/utils/DebugLogUtils.java  | 52 ++++++++++++++++++++
 6 files changed, 115 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AbstractCompilerPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AbstractCompilerPass.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AbstractCompilerPass.java
index 9253f29..e82ac12 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AbstractCompilerPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AbstractCompilerPass.java
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.internal.codegen.externals.pass;
 
 import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
+import org.apache.flex.compiler.internal.codegen.externals.utils.DebugLogUtils;
 
 import com.google.javascript.jscomp.AbstractCompiler;
 import com.google.javascript.jscomp.CompilerPass;
@@ -32,6 +33,9 @@ public abstract class AbstractCompilerPass implements CompilerPass, Callback
     protected ReferenceModel model;
     protected AbstractCompiler compiler;
 
+    protected boolean logEnabled;
+    protected boolean errEnabled;
+
     public AbstractCompilerPass(ReferenceModel model, AbstractCompiler compiler)
     {
         this.model = model;
@@ -45,13 +49,24 @@ public abstract class AbstractCompilerPass implements CompilerPass, Callback
         NodeTraversal.traverseRoots(compiler, this, externs, root);
     }
 
+    protected void log(Node n)
+    {
+        DebugLogUtils.err(n);
+    }
+
+    protected void err(Node n)
+    {
+        DebugLogUtils.err(n);
+    }
+
     protected void log(String message)
     {
-        System.out.println(message);
+        DebugLogUtils.log(message);
     }
 
     protected void err(String message)
     {
-        System.err.println(message);
+        DebugLogUtils.err(message);
     }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AddMemberPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AddMemberPass.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AddMemberPass.java
index 46b2377..7213b5a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AddMemberPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/AddMemberPass.java
@@ -75,8 +75,8 @@ public class AddMemberPass extends AbstractCompilerPass
             }
             else if (n.isGetProp())
             {
-                //System.err.println(n.toStringTree());
-                System.err.println(n.getQualifiedName());
+                //log(n.toStringTree());
+                log(n.getQualifiedName());
 
                 String qName = n.getQualifiedName();
                 // Port.prototype.name
@@ -88,7 +88,7 @@ public class AddMemberPass extends AbstractCompilerPass
                     String className = qName.substring(0, protoType);
                     String memberName = qName.substring(protoType + 11,
                             qName.length());
-                    System.err.println("Prototype:: className [" + className
+                    log("Prototype:: className [" + className
                             + "] memberName [" + memberName + "]");
                     model.addField(n, className, memberName);
                 }
@@ -98,8 +98,8 @@ public class AddMemberPass extends AbstractCompilerPass
                             qName.lastIndexOf("."));
                     String memberName = qName.substring(
                             qName.lastIndexOf(".") + 1, qName.length());
-                    System.err.println("className [" + className
-                            + "] memberName [" + memberName + "]");
+                    log("className [" + className + "] memberName ["
+                            + memberName + "]");
                     model.addStaticField(n, className, memberName);
                 }
 
@@ -249,8 +249,8 @@ public class AddMemberPass extends AbstractCompilerPass
             else
             {
 
-                System.err.println(">>>> {AddMemberPass.addMethod()} Class ["
-                        + className + "] not found in " + n.getSourceFileName());
+                err(">>>> {AddMemberPass.addMethod()} Class [" + className
+                        + "] not found in " + n.getSourceFileName());
             }
         }
         else if (getProp.getFirstChild().isName())
@@ -267,13 +267,10 @@ public class AddMemberPass extends AbstractCompilerPass
             }
             else
             {
-                System.err.println(">>>> {AddMemberPass.addMethod()} Class ["
-                        + className + "] not found in " + n.getSourceFileName());
+                err(">>>> {AddMemberPass.addMethod()} Class [" + className
+                        + "] not found in " + n.getSourceFileName());
             }
-
         }
-
-        //System.out.println(n.toStringTree());
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
index 7bceca5..028e114 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectTypesPass.java
@@ -46,9 +46,6 @@ public class CollectTypesPass extends AbstractCompilerPass
 
         for (Node child : n.children())
         {
-            //System.out.println("==================================");
-            //System.out.println(child.toStringTree());
-
             if (child.isVar())
             {
                 visitVar(child);
@@ -94,7 +91,6 @@ public class CollectTypesPass extends AbstractCompilerPass
                 {
                     model.addClass(container, left.getQualifiedName());
                 }
-                //    System.out.println(child.toStringTree());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/NamespaceResolutionPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/NamespaceResolutionPass.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/NamespaceResolutionPass.java
index 00f44fd..6944d63 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/NamespaceResolutionPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/NamespaceResolutionPass.java
@@ -42,18 +42,6 @@ public class NamespaceResolutionPass extends AbstractCompilerPass
         return n.isBlock() || n.isScript();
     }
 
-    private void print(Node n)
-    {
-        System.out.println("-------------------------------------");
-        System.out.println(n.toStringTree());
-    }
-
-    private void print(String qualifiedName)
-    {
-        // TODO Auto-generated method stub
-        System.out.println(qualifiedName);
-    }
-
     @Override
     public void visit(NodeTraversal t, Node n, Node parent)
     {
@@ -111,8 +99,8 @@ public class NamespaceResolutionPass extends AbstractCompilerPass
                         }
                         else
                         {
-                            print("Unhandled expression result:");
-                            print(child);
+                            err("Unhandled expression result:");
+                            err(child);
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
index 9319153..7751f4b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
@@ -26,6 +26,7 @@ import java.util.List;
 
 import org.apache.flex.compiler.clients.ExternCConfiguration;
 import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
+import org.apache.flex.compiler.internal.codegen.externals.utils.DebugLogUtils;
 
 import com.google.javascript.jscomp.Compiler;
 import com.google.javascript.jscomp.NodeUtil;
@@ -105,7 +106,7 @@ public class ReferenceModel
         reference = possibleClasses.get(qName);
         if (reference != null)
         {
-            System.err.println(">>>> {ReferenceModel} Found class ["
+            err(">>>> {ReferenceModel} Found class ["
                     + qName
                     + "] in possible classes from namespace, promoting to class in "
                     + reference.getNode().getSourceFileName());
@@ -126,14 +127,14 @@ public class ReferenceModel
 
         if (node.getJSDocInfo().isConstant())
         {
-            System.out.println("Model.addPossibleClass(" + qName + ")");
+            err("Model.addPossibleClass(" + qName + ")");
             ClassReference reference = new ClassReference(this, node, qName);
             reference.setFinal(true);
             possibleClasses.put(qName, reference);
         }
         else
         {
-            System.out.println("Model.addNamespace(" + qName + ")");
+            log("Model.addNamespace(" + qName + ")");
         }
 
         namespaces.add(qName);
@@ -147,7 +148,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addClass(" + qName + ")");
+        log("Model.addClass(" + qName + ")");
 
         ClassReference reference = new ClassReference(this, node, qName);
         classes.put(qName, reference);
@@ -161,7 +162,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addTypeDef(" + qName + ")");
+        log("Model.addTypeDef(" + qName + ")");
 
         ClassReference reference = new ClassReference(this, node, qName);
         typedefs.put(qName, reference);
@@ -175,7 +176,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addInterface(" + qName + ")");
+        log("Model.addInterface(" + qName + ")");
 
         ClassReference reference = new ClassReference(this, node, qName);
         classes.put(qName, reference);
@@ -189,7 +190,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addFinalClass(" + qName + ")");
+        log("Model.addFinalClass(" + qName + ")");
 
         ClassReference reference = new ClassReference(this, node, qName);
         reference.setFinal(true);
@@ -204,7 +205,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addFunction(" + qName + ")");
+        log("Model.addFunction(" + qName + ")");
         //System.err.println(node.toStringTree());
         FunctionReference reference = new FunctionReference(this, node, qName,
                 node.getJSDocInfo());
@@ -229,7 +230,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addConstant(" + qName + ")");
+        log("Model.addConstant(" + qName + ")");
 
         ConstantReference reference = new ConstantReference(this, node, qName,
                 node.getJSDocInfo());
@@ -244,7 +245,7 @@ public class ReferenceModel
             return;
         }
 
-        System.out.println("Model.addConstantType(" + qName + ")");
+        log("Model.addConstantType(" + qName + ")");
 
         ConstantReference reference = new ConstantReference(this, node, qName,
                 node.getJSDocInfo(), type);
@@ -271,12 +272,12 @@ public class ReferenceModel
         }
         else
         {
-            System.err.println(">>>> {ReferenceModel} Class [" + className
-                    + "] not found in " + node.getSourceFileName());
+            err(">>>> {ReferenceModel} Class [" + className + "] not found in
"
+                    + node.getSourceFileName());
         }
     }
 
-    //----------------------------------------------------
+    //--------------------------------------------------------------------------
 
     public ExcludedMemeber isExcludedClass(ClassReference classReference)
     {
@@ -290,4 +291,25 @@ public class ReferenceModel
                 memberReference);
     }
 
+    //--------------------------------------------------------------------------
+
+    protected void log(Node n)
+    {
+        DebugLogUtils.err(n);
+    }
+
+    protected void err(Node n)
+    {
+        DebugLogUtils.err(n);
+    }
+
+    protected void log(String message)
+    {
+        DebugLogUtils.log(message);
+    }
+
+    protected void err(String message)
+    {
+        DebugLogUtils.err(message);
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00db22b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/DebugLogUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/DebugLogUtils.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/DebugLogUtils.java
new file mode 100644
index 0000000..5dcdc48
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/DebugLogUtils.java
@@ -0,0 +1,52 @@
+/*
+ *
+ *  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.externals.utils;
+
+import com.google.javascript.rhino.Node;
+
+public final class DebugLogUtils
+{
+    private static boolean logEnabled = false;
+    private static boolean errEnabled = false;
+
+    public static void log(Node n)
+    {
+        log("StringTree -------------------------------------");
+        log(n.toStringTree());
+    }
+
+    public static void log(String message)
+    {
+        if (logEnabled)
+            System.out.println(message);
+    }
+
+    public static void err(String message)
+    {
+        if (errEnabled)
+            System.err.println(message);
+    }
+
+    public static void err(Node n)
+    {
+        err("StringTree -------------------------------------");
+        err(n.toStringTree());
+    }
+}


Mime
View raw message