summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-01-27 16:35:35 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-01-27 16:38:49 -0800
commitf9f0e5c75c6a6fa32dd91f242c7463d467f6dcd4 (patch)
tree6b205b3136bc009d756e7150f0144c4027ac6508
parent6e53cf8b3fdaf75c39610cdde5cd9b5210157157 (diff)
downloadnode-new-f9f0e5c75c6a6fa32dd91f242c7463d467f6dcd4.tar.gz
Pre-process out assert()
-rw-r--r--src/node.js12
-rw-r--r--wscript1
2 files changed, 8 insertions, 5 deletions
diff --git a/src/node.js b/src/node.js
index a2a5f3f940..0012b40a9d 100644
--- a/src/node.js
+++ b/src/node.js
@@ -86,11 +86,13 @@
return startup._lazyConstants;
};
+ var assert;
startup.processAssert = function() {
- process.assert = function(x, msg) {
- if (!x) {
- throw new Error(msg || 'assertion error');
- }
+ // Note that calls to assert() are pre-processed out by JS2C for the
+ // normal build of node. They persist only in the node_g build.
+ // Similarly for debug().
+ assert = process.assert = function(x, msg) {
+ if (!x) throw new Error(msg || 'assertion error');
};
};
@@ -229,7 +231,7 @@
process.removeListener = function(type, listener) {
var ret = removeListener.apply(this, arguments);
if (isSignal(type)) {
- process.assert(signalWatchers.hasOwnProperty(type));
+ assert(signalWatchers.hasOwnProperty(type));
if (this.listeners(type).length === 0) {
signalWatchers[type].stop();
diff --git a/wscript b/wscript
index bc07ba36e9..2fb8f9ad32 100644
--- a/wscript
+++ b/wscript
@@ -601,6 +601,7 @@ def build(bld):
make_macros(macros_loc_debug, "") # leave debug(x) as is in debug build
# replace debug(x) with nothing in release build
make_macros(macros_loc_default, "macro debug(x) = ;\n")
+ make_macros(macros_loc_default, "macro assert(x) = ;\n")
if not bld.env["USE_DTRACE"]:
make_macros(macros_loc_default, "macro DTRACE_HTTP_SERVER_RESPONSE(x) = ;\n");