google / closure-compiler

A JavaScript checker and optimizer.
https://developers.google.com/closure/compiler/
Apache License 2.0
7.31k stars 1.15k forks source link

Incorrect removal of parentheses #4171

Closed zhantx closed 1 week ago

zhantx commented 2 weeks ago

Closure compiler removes parentheses from class declaration rendering the output code to be illegal input

let _Component;
class Component {}
class P extends (_Component = Component) {}

output

'use strict';
let _Component;
class Component {
}
class P extends _Component = Component {
}
;

The assignment at supercalss must have parentheses

image
brad4d commented 1 week ago

@dloyda is working on this.

dloyda commented 1 week ago

Fixed by https://github.com/google/closure-compiler/commit/5a20d7dc12cf9acad8c84e3fe4e2bf10dec3ed0e