Enforce `null` as value for empty initialisation blocks.
fixes #1648
};
OPT(AST_For, function(self, compressor){
+ if (is_empty(self.init)) self.init = null;
if (!compressor.option("loops")) return self;
if (self.condition) {
var cond = self.condition.evaluate(compressor);
output.print("for");
output.space();
output.with_parens(function(){
- if (self.init && !(self.init instanceof AST_EmptyStatement)) {
+ if (self.init) {
if (self.init instanceof AST_Definitions) {
self.init.print(output);
} else {
'}',
]
}
+
+issue_1648: {
+ options = {
+ join_vars: true,
+ loops: true,
+ passes: 2,
+ sequences: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ x();
+ var b = 1;
+ while (1);
+ }
+ }
+ expect_exact: "function f(){for(x();1;);}"
+}