[gjs] coverage: s/warning/log



commit 72f0a8a1c8ee410cec95bf5261fcb73a602b0c44
Author: Sam Spilsbury <smspillaz gmail com>
Date:   Fri Jul 3 03:13:32 2015 +0800

    coverage: s/warning/log
    
    We used to distinguish between coverage warnings and log
    messages, however coverage warnings have essentially just
    become log messages. There is no point having the difference
    and taking on the maintenance burden of having one defined
    in the tests but not the other.

 gjs/coverage.cpp    |   12 ++++++------
 modules/coverage.js |   28 +++++++++++++---------------
 2 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 569177a..8547979 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1345,9 +1345,9 @@ gjs_context_eval_file_in_compartment(GjsContext *context,
 }
 
 static JSBool
-coverage_warning(JSContext *context,
-                 unsigned   argc,
-                 jsval     *vp)
+coverage_log(JSContext *context,
+             unsigned   argc,
+             jsval     *vp)
 {
     JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
     char *s;
@@ -1355,7 +1355,7 @@ coverage_warning(JSContext *context,
     JSString *jstr;
 
     if (argc != 1) {
-        gjs_throw(context, "Must pass a single argument to warning()");
+        gjs_throw(context, "Must pass a single argument to log()");
         return JS_FALSE;
     }
 
@@ -1380,7 +1380,7 @@ coverage_warning(JSContext *context,
         return JS_FALSE;
     }
 
-    g_message("JS COVERAGE WARNING: %s", s);
+    g_message("JS COVERAGE MESSAGE: %s", s);
     g_free(s);
 
     JS_EndRequest(context);
@@ -1522,7 +1522,7 @@ coverage_get_file_contents(JSContext *context,
 }
 
 static JSFunctionSpec coverage_funcs[] = {
-    { "warning", JSOP_WRAPPER(coverage_warning), 1, GJS_MODULE_PROP_FLAGS },
+    { "log", JSOP_WRAPPER(coverage_log), 1, GJS_MODULE_PROP_FLAGS },
     { "getFileContents", JSOP_WRAPPER(coverage_get_file_contents), 1, GJS_MODULE_PROP_FLAGS },
     { "getFileModificationTime", JSOP_WRAPPER(coverage_get_file_modification_time), 1, GJS_MODULE_PROP_FLAGS 
},
     { "getFileChecksum", JSOP_WRAPPER(coverage_get_file_checksum), 1, GJS_MODULE_PROP_FLAGS },
diff --git a/modules/coverage.js b/modules/coverage.js
index 9dcd962..9d41178 100644
--- a/modules/coverage.js
+++ b/modules/coverage.js
@@ -561,7 +561,7 @@ function _incrementExpressionCounters(expressionCounters,
      * mean that the reflection machinery is not doing its job, so we should
      * print a debug message about it in case someone is interested.
      *
-     * The reason why we don't have a proper warning is because it
+     * The reason why we don't have a proper log is because it
      * is difficult to determine what the SpiderMonkey program counter
      * will actually pass over, especially function declarations for some
      * reason:
@@ -576,9 +576,7 @@ function _incrementExpressionCounters(expressionCounters,
      * and BlockStatement, neither of which would ordinarily be
      * executed */
     if (expressionCounters[offsetLine] === undefined) {
-        if (reporter !== undefined)
-            reporter(offsetLine);
-
+        reporter(offsetLine);
         expressionCounters[offsetLine] = 0;
     }
 
@@ -831,15 +829,15 @@ function CoverageStatistics(prefixes, cache) {
             }
         } catch (e) {
             /* We don't care about this frame, return */
-            warning(e.message + " " + e.stack);
+            log(e.message + " " + e.stack);
             return undefined;
         }
 
         function _logExceptionAndReset(exception, callee, line) {
-            warning(exception.fileName + ":" + exception.lineNumber + " (processing " +
-                    frame.script.url + ":" + callee + ":" + line + ") - " +
-                    exception.message);
-            warning("Will not log statistics for this file");
+            log(exception.fileName + ":" + exception.lineNumber +
+                " (processing " + frame.script.url + ":" + callee + ":" +
+                line + ") - " + exception.message);
+            log("Will not log statistics for this file");
             frame.onStep = undefined;
             frame._branchTracker = undefined;
             deleteStatistics(frame.script.url);
@@ -878,12 +876,12 @@ function CoverageStatistics(prefixes, cache) {
                 _incrementExpressionCounters(statistics.expressionCounters,
                                              offsetLine,
                                              function(line) {
-                                                 warning("executed " +
-                                                         frame.script.url +
-                                                         ":" +
-                                                         line +
-                                                         " which we thought" +
-                                                         " wasn't executable");
+                                                 log("executed " +
+                                                     frame.script.url +
+                                                     ":" +
+                                                     line +
+                                                     " which we thought" +
+                                                     " wasn't executable");
                                              });
                 this._branchTracker.incrementBranchCounters(offsetLine);
             } catch (e) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]