15 Commits

Author SHA1 Message Date
Christoph Nakazawa
2bb2933dea
[helpers] Add a private function name within createSuper (#11514) 2020-05-04 23:30:53 +02:00
Justin Ridgewell
0bbf2da568
Super property eval order (#11480) 2020-04-25 18:34:07 +02:00
Justin Ridgewell
070ec201bb
Speed up the createSuper helper (#11401) 2020-04-10 16:00:20 +02:00
Nicolò Ribaudo
67609a1232
Don't call createSuper in loose mode (it was unused) (#11358)
* Don't call `createSuper` in loose mode (it was unused)

* Update fixtures
2020-04-01 23:08:21 +02:00
Nicolò Ribaudo
f6c7bf36ce
Allow extending untranspiled classes (#8656) 2020-03-16 23:59:15 +01:00
Nicolò Ribaudo
d21e2217d5
Skip newlines around inline #__PURE__ annotations (#11133)
* Skip newlines around #__PURE__ annotations

* Update tests
2020-02-13 19:16:33 +01:00
Justin Ridgewell
2af7a33c4e Fix class inheritance in IE10 (#7969)
* Revert "Move subclass inheritance to end (#7772)"

This reverts commit f8ab9466d331871a90f458af40b14e8d831e0c29.

* Only use getPrototypeOf if setPrototypeOf is implemented

* Update fixtures

* Helpers updates

* Update fixtures

* Fall back to getPrototypeOf

* Update fixtures
2018-05-23 16:21:21 -04:00
Justin Ridgewell
0a257e8972
Move more class state out of replaceSupers (#7750)
Yes, the output is uglier. But, this is necessary for me to refactor
`replaceSupers` for #7733, which is necessary for both #7555 and
https://github.com/babel/babel/pull/7553#issuecomment-381434519.

I'm still in the middle of cleaning up all this code. Don't expect
`transformClass` to survive much longer as it's written currently.
2018-04-21 22:56:14 -04:00
Justin Ridgewell
f8ab9466d3
Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00
Justin Ridgewell
ec3722b3f9
Get set helpers (#7687)
* Improve get/set helper

* fixtures

* Edge cases

* Add loose edge cases

* Spec compliant

* Add issue case

* Even more edge cases!

* Final updates

* Fix name

* Use Reflect.{get, set} when available

* Avoid block scoping in loose

* Remove semicolon

* Do not redefine a non-enumerable

* Get strictness from call site, not helpers

* Add called assertions

* Classes are always strict

* Update test fixture
2018-04-11 11:56:59 -04:00
Markus Török
6597a472b3 Add "use strict" directive (#7411)
* #7349
- Add "use strict" directive to transformed class bodies

* Update tests (#7349)

* Add test for program with use strict directive (#7349)

* Update tests (#7349)

* Update source mapping (#7349)

* Add test for parent blockStatement with use strict directive (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Add test for constructor-only class (#7349)

* Constructor only classes are strict, too

But constructor only that use non-simple parameters must use a strict function wrapper.

* Fix test

* Wrapper not needed if class is already strict

* Revert change to lerna.json
2018-04-10 17:33:38 -04:00
Justin Ridgewell
450a1678f2
Use getProto and setProto helpers (#7675)
Depends on #7674.
2018-04-06 02:54:08 +01:00
Justin Ridgewell
e9ed0f5f21
Split _wrapNativeSuper into helpers (#7674)
These can be reused in a few transforms.
2018-04-06 01:18:44 +01:00
Nicolò Ribaudo
a86d311986 Reuse the assertThisInitialized helper in possibleConstructorReturn (#7493) 2018-03-05 08:11:16 -08:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01:00