Merge branch 'master' into harmony

This commit is contained in:
Richard van Velzen
2016-06-09 22:29:52 +02:00
9 changed files with 142 additions and 6 deletions

View File

@@ -520,7 +520,8 @@ function OutputStream(options) {
PARENS([ AST_Unary, AST_Undefined ], function(output){
var p = output.parent();
return p instanceof AST_PropAccess && p.expression === this;
return p instanceof AST_PropAccess && p.expression === this
|| p instanceof AST_New;
});
PARENS(AST_Seq, function(output){
@@ -1531,7 +1532,12 @@ function OutputStream(options) {
// self should be AST_New. decide if we want to show parens or not.
function no_constructor_parens(self, output) {
return self.args.length == 0 && !output.option("beautify");
return self.args.length == 0 && !output.option("beautify") ||
!(self.expression instanceof AST_SymbolRef ||
self.expression instanceof AST_Call ||
self.expression instanceof AST_Function ||
self.expression instanceof AST_Assign
);
};
function best_of(a) {