aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Wolff <dan.d.wolff@gmail.com>2012-11-11 15:53:34 +0200
committerDan Wolff <dan.d.wolff@gmail.com>2012-11-11 15:53:34 +0200
commitb49230ab8d717d91710d8c383c79ded77c78a39e (patch)
treea3e8e0ae60cc249ed8f70ec04c8d1ec8b4a0b4b6 /lib
parent78856a3dabffb5e22431ee5c14656d3a64076540 (diff)
downloadtracifyjs-b49230ab8d717d91710d8c383c79ded77c78a39e.tar.gz
tracifyjs-b49230ab8d717d91710d8c383c79ded77c78a39e.zip
convert x.toString() to ""+x instead of x+""
In some places this can save one byte in whitespace, e.g. after return. Example: function f(arg) { // return""+arg - no space between return and "" return arg.toString(); }
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 469ee6e2..9400b864 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1413,9 +1413,9 @@ merge(Compressor.prototype, {
}
else if (exp instanceof AST_Dot && exp.property == "toString" && self.args.length == 0) {
return make_node(AST_Binary, self, {
- left: exp.expression,
+ left: make_node(AST_String, self, { value: "" }),
operator: "+",
- right: make_node(AST_String, self, { value: "" })
+ right: exp.expression
}).transform(compressor);
}
}