better extends paren fix (#1962)
This commit is contained in:
@@ -644,7 +644,6 @@ function OutputStream(options) {
|
||||
* ==> 20 (side effect, set a := 10 and b := 20) */
|
||||
|| p instanceof AST_Arrow // x => (x, x)
|
||||
|| p instanceof AST_DefaultAssign // x => (x = (0, function(){}))
|
||||
|| (p instanceof AST_Class && p.extends === this) // class D extends (calls++, C) {}
|
||||
;
|
||||
});
|
||||
|
||||
@@ -1474,8 +1473,12 @@ function OutputStream(options) {
|
||||
output.space();
|
||||
}
|
||||
if (self.extends) {
|
||||
var parens = self.extends instanceof AST_Binary ||
|
||||
self.extends instanceof AST_Conditional;
|
||||
var parens = (
|
||||
!(self.extends instanceof AST_SymbolRef)
|
||||
&& !(self.extends instanceof AST_PropAccess)
|
||||
&& !(self.extends instanceof AST_ClassExpression)
|
||||
&& !(self.extends instanceof AST_Function)
|
||||
);
|
||||
output.print("extends");
|
||||
if (parens) {
|
||||
output.print("(");
|
||||
|
||||
Reference in New Issue
Block a user