aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-02 16:10:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-02 16:10:03 -0700
commit75c2d2007fd7dc03c69ccaca2d65ab75fe6c3d08 (patch)
treedae52a70cd59588e73783ad899e5450306d6cae5
parent34ddf41a3a5114f292ba3c23cc93ef30a797da71 (diff)
print return values in LIBRARY_DEBUG mode
-rw-r--r--src/jsifier.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 8caab6e2..8e688d8d 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -404,7 +404,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('{', '{ Module.printErr("[library call:' + ident + ': " + Array.prototype.slice.call(arguments) + "]"); ');
+ 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; }';
}
}