diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-20 18:13:03 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-20 18:13:03 -0700 |
commit | 45bcf3ad360c950765db789bdd54d111d044ffc5 (patch) | |
tree | 13ca2b7b7c88165e9f191cde549f883f420d633f /src/jsifier.js | |
parent | 410a632a1888bde9b78d574aa682f4dc48fb488f (diff) |
make library and gl debug configurable at runtime, and share the pretty printing code
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 904517e1..70fe0991 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -408,8 +408,8 @@ function JSify(data, functionsOnly, givenFunctions) { // name the function; overwrite if it's already named snippet = snippet.replace(/function(?:\s+([^(]+))?\s*\(/, 'function _' + ident + '('); if (LIBRARY_DEBUG) { - snippet = snippet.replace('{', '{ var ret = (function() {Module.printErr("[library call:' + ident + ': " + Array.prototype.slice.call(arguments) + "]"); '); - snippet = snippet.substr(0, snippet.length-1) + '}).apply(this, arguments); Module.printErr(" [ return:" + ret); return ret; }'; + snippet = snippet.replace('{', '{ var ret = (function() { if (Runtime.debug) Module.printErr("[library call:' + ident + ': " + Array.prototype.slice.call(arguments).map(Runtime.prettyPrint) + "]"); '); + snippet = snippet.substr(0, snippet.length-1) + '}).apply(this, arguments); if (Runtime.debug && typeof ret !== "undefined") Module.printErr(" [ return:" + Runtime.prettyPrint(ret)); return ret; }'; } } |