dev_compiler
dev_compiler copied to clipboard
Support "simple" Closure compilation mode
The Closure Compiler can almost consume the output of DDC with --language_in=ECMASCRIPT6_STRICT -O SIMPLE (and output ES5 code).
Here are some blockers:
-
(fixed by https://github.com/google/closure-compiler/commit/3f54e473500ee54a4aa5c264dbe6f61d82586a8d) ~~
supergetter calls aren't supported yet (https://github.com/google/closure-compiler/issues/1089).~~ -
(fixed) ~~
supermethod calls make the compiler to crash (https://github.com/google/closure-compiler/issues/1125).~~ -
supermethod calls on computed properties crash the compiler (https://github.com/google/closure-compiler/issues/1184) -
Cannot (re)define local
Object,Errorclasses incore.js. This can be worked around by attaching the classes to some namespace (see branch closure-qualify):core.Object = class Object { ... }; core.Deprecated = class Deprecated extends core.Object { ... }; -
(fixed) ~~
letoften makes the compiler to crash (https://github.com/google/closure-compiler/issues/1124). Could be somehow worked around by using var everywhere, but then the hand-written parts of the runtime are an issue.~~ -
(fixed by e693a004a7421a1d226123ecb246804d2b393ddf) ~~"The class in an extends clause must be a qualified name" (see workaround in branch closure-annotations-alias-parent).~~
-
Cycles in ES6 module imports crash Closure. This can be worked around by using rollup.js to unfold the imports (fixed one blocker in 0.25.4), then running Closure on the result.
Other annoying non-blockers:
- (fixed) ~~Misplaced annotations warning with computed properties (https://github.com/google/closure-compiler/issues/1126)~~
(Note: "ADVANCED" optimizations are filed under #311)
thanks for collecting all of these!
Cannot (re)define local Object, Error classes in core.js. This can be worked around by attaching the classes to some namespace (here core is the current exports var):
Nice! Yeah that would work & also would simplify our JsSymbol/Symbol issues.
let often makes the compiler to crash (google/closure-compiler#1124). Could be somehow worked around by using var everywhere, but then the hand-written parts of the runtime are an issue.
note: let is needed for correct behavior (e.g. closures in loops), so we can't compile to var as a workaround. Hopefully they can get that crashing bug fixed...