Skip to content

Commit

Permalink
String(a) => a+"" (with --unsafe)
Browse files Browse the repository at this point in the history
fixes #254
  • Loading branch information
mishoo committed Nov 21, 2011
1 parent 4f97733 commit e751e36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/squeeze-more.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ function ast_squeeze_more(ast) {
// foo.toString() ==> foo+""
return [ "binary", "+", expr[1], [ "string", "" ]];
}
if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) {
return [ "array", args ];
if (expr[0] == "name") {
if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) {
return [ "array", args ];
}
if (expr[1] == "String" && !scope.has("String")) {
return [ "binary", "+", args[0], [ "string", "" ]];
}
}
}
}, function() {
Expand Down

0 comments on commit e751e36

Please sign in to comment.