fixed tests (need to drop the toplevel block in "expected" if it's a single statement)
This commit is contained in:
@@ -232,9 +232,6 @@ var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent
|
|||||||
}, AST_Block);
|
}, AST_Block);
|
||||||
|
|
||||||
var AST_Toplevel = DEFNODE("Toplevel", null, {
|
var AST_Toplevel = DEFNODE("Toplevel", null, {
|
||||||
initialize: function() {
|
|
||||||
this.required = true;
|
|
||||||
},
|
|
||||||
$documentation: "The toplevel scope"
|
$documentation: "The toplevel scope"
|
||||||
}, AST_Scope);
|
}, AST_Scope);
|
||||||
|
|
||||||
|
|||||||
@@ -473,7 +473,7 @@ function Compressor(options, false_by_default) {
|
|||||||
SQUEEZE(AST_BlockStatement, function(self, compressor){
|
SQUEEZE(AST_BlockStatement, function(self, compressor){
|
||||||
self = self.clone();
|
self = self.clone();
|
||||||
self.body = tighten_body(self.body, compressor);
|
self.body = tighten_body(self.body, compressor);
|
||||||
if (self.body.length == 1 && !self.required)
|
if (self.body.length == 1)
|
||||||
return self.body[0];
|
return self.body[0];
|
||||||
return self;
|
return self;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ function parse_test(file) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
var stat = node.body;
|
var stat = node.body;
|
||||||
if (stat instanceof U.AST_BlockStatement)
|
if (stat instanceof U.AST_BlockStatement && stat.body.length == 1)
|
||||||
stat.required = 1;
|
stat = stat.body[0];
|
||||||
test[node.label.name] = stat;
|
test[node.label.name] = stat;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user