From b49230ab8d717d91710d8c383c79ded77c78a39e Mon Sep 17 00:00:00 2001 From: Dan Wolff Date: Sun, 11 Nov 2012 15:53:34 +0200 Subject: [PATCH] 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(); } --- lib/compress.js | 4 ++-- 1 file 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); } } -- 2.34.1