Commit graph

9 commits

Author SHA1 Message Date
Martin Probst f0826cfeaa Per-property super accessors in async functions.
TypeScript must hoist accessors for super properties when converting
async method bodies to the `__awaiter` pattern for targets before
ES2016.

Previously, TypeScript would reify all property accesses into element
accesses, i.e. convert the property name into a string parameter and
pass it to `super[...]`. That breaks optimizers like Closure Compiler or
Uglify in advanced mode, when property renaming is enabled, as it mixes
quoted and un-quoted property access (`super['x']` vs just `x` at the
declaration site).

This change creates a variable `_superProps` that contains accessors for
each property accessed on super within the async method. This allows
accessing the properties by name (instead of quoted string), which fixes
the quoted/unquoted confusion. The change keeps the generic accessor for
element access statements to match quoting behaviour.

Fixes #21088.
2018-10-03 15:46:04 +02:00
Ron Buckton 2b4569c04f Fix prologue order in async function 2018-06-07 13:34:16 -07:00
Ron Buckton 6736ced51d Fix duplicate label in es2017 async function 2018-02-12 12:30:29 -08:00
Ron Buckton 1785d87fda Fix temp variable emit for names used in nested classes 2018-01-16 12:33:55 -08:00
Ron Buckton 644e4dacaf Added es5 conformance tests for async arrow functions, add error for referencing 'arguments' in a generator. 2016-06-27 17:34:19 -07:00
Ron Buckton 203dab4412 Added additional es5 conformance tests, better emit for functions returning global promise, pass this to __generator 2016-06-27 17:12:24 -07:00
Ron Buckton 0c647c3d14 Added es5 conformance tests for awaiting a call 2016-06-27 15:34:15 -07:00
Ron Buckton 48a9562e41 Added es5 conformance tests for async function declarations. Add ability to treat some statements as if they were prologue directives. 2016-06-27 15:26:33 -07:00
Ron Buckton 5b2e11c5d0 Added es5 conformance tests for await in binary. 2016-06-27 14:08:36 -07:00