27 Commits

Author SHA1 Message Date
Nicolò Ribaudo
6ef7b51a11 Implement assumptions defined in the babel/rfcs#5 RFC
- `mutableTemplateObject` and `ignoreToPrimitiveHint` (#12408)
- `setClassMethods` (#12407)
- `setComputedProperties` (#12490)
- `ignoreFunctionLength` (#12491)
- `noDocumentAll` (#12481)
- `iterableIsArray` and `arrayLikeIsIterable` (#12489)
- `pureGetters` (#12504)
- `skipForOfIteratorClosing` (#12496)
- `objectRestNoSymbols`, `setSpreadProperties` and `pureGetters` (#12505)
- `noNewArrows` (#12613, #12793)
- `setPublicClassFields` and `privateFieldsAsProperties` (#12497)
- `constantReexports` and `enumerableModuleMeta` (#12618)
- `constantSuper`, `superIsCallableConstructor` and `noClassCalls` (#12726)

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Huáng Jùnliàng <JLHwung@users.noreply.github.com>
2021-02-21 17:09:45 +01:00
Justin Ridgewell
a5bc48661b
Isolated exec tests (#11531)
* Run exec tests in fresh contexts

* Reevaluate modules in every context

* Cache module code when running tests

* Eliminate weakmap accesses as much as possible

* Remove old multiline usage

* Using bundled polyfill to significantly increase performance

The individual requires for each file were the part that was sooooo slow.

* Drop LRU cache size

* Fixes

* Fix test

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-08-10 18:57:48 -04:00
Nicolò Ribaudo
93978267ec
Add "allowArrayLike" opt to destructuring and spread transforms (#11265) 2020-05-24 23:00:06 +02:00
Zen
ca096c56aa
fix Incorrect destructuring compilation of `for (let [[x] = [1… (#11360) 2020-04-07 10:10:21 -05:00
Nicolò Ribaudo
1ba41f2084
Throw better errors for non-iterables when Symbol doesn't exist (#11264) 2020-03-16 16:34:33 +01:00
Gerald
8cafd8f820 fix(transform-destructuring): update scope info after replacing 2020-03-05 21:23:50 +01:00
Huáng Jùnliàng
b64cb9aaf1 fix: early return when instance is not iterable (#10396)
* fix: early return when instance is not iterable

* chore: update test fixtures

* fix: gaurd against arguments for old browsers
2019-09-06 18:09:57 +02:00
Tan Li Hau
b6486a22cb fix destructuring rest with template literal (#10013)
* fix destructuring rest with template literal

* update test
2019-05-24 00:03:27 +02:00
Moti Zilberman
1f5444e96a Destructuring: Fix handling of impure computed keys with object rest (#9416) 2019-03-26 19:11:44 -07:00
Moti Zilberman
f7bfc774ba Destructuring: Fix array unpacking assignments with holes on RHS (#9412)
This fixes an issue where destructuring assignments eligible for the "array unpacking" optimization would fail to compile when the array literal on the right-hand side of the expression contained holes.

Example input:
```js
[a, b] = [, 2];
; // Avoid completion record special case
```

The error message was `Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null`.

Now the above code compiles to:
```js
a = void 0;
b = 2;
;
```

This PR also adds a couple of related test cases that were missing, to ensure the change doesn't regress them:
* Normal assignment expression with unpacking
* Declaration with unpacking and a hole on RHS
2019-03-27 01:14:21 +01:00
Moti Zilberman
1452e977a0 Destructuring: Create assignments from ForX non-declaration patterns (#9414) 2019-01-28 09:50:24 +01:00
Daniel Tschinder
47da5cf75a
Correctly transform spreads to use proper concat method (#9108)
* Correctly transform spreads to use proper concat method

* Add tests to ensure array spread clones elements
2018-12-13 23:24:43 -08:00
Ruben Verborgh
9308c870f5 Fix destructuring assignment in arrow functions. (#8916)
Fixes 8912.
2018-11-25 19:29:58 +01:00
Nicolò Ribaudo
38397ce11f Use toPropertyKey in the "decorate" helper
This commit also makes the "toPropertyKey" helper call @@toPrimitive
when needed.
2018-11-02 13:59:57 +01:00
Brian Ng
36d12b5969
Ensure destructuring's computed key handling matches object-rest-spread (#8793) 2018-10-02 20:46:08 -05:00
Nicolò Ribaudo
626f47982e Do not unpack array patterns that update a referenced binding (#8535)
Fixes #8528
2018-09-28 11:45:42 -04:00
Logan Smyth
79b2af5997
Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Mateusz Burzyński
c0c13ae30f Introduce objectWithoutPropertiesLoose helper (#8261) 2018-07-06 15:03:44 -04:00
Deven Bansod
c8d82d6483 Migrate all remaining fixtures to jest expect 2018-03-24 16:22:20 +05:30
Mateusz Burzyński
d682e32529
Favour extends helper over objectWithoutProperties when whole object gets copied anyway (#7390) 2018-03-14 22:59:02 +01:00
Brian Ng
4f4dd3d4a6 Assign another temp var when parsing assignment patterns in destructuring (#7333) 2018-03-09 09:39:25 +01:00
Logan Smyth
7cc00cce0d Require output fixture extension to match sourceType output. 2018-03-04 13:31:33 -08:00
Logan Smyth
beb99dfda1 Rename test fixtures using module syntax to .mjs files. 2018-03-04 13:31:32 -08:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01:00
Anatoli Papirovski
aefbb1380e No unneeded empty arrays in transform spread (#6763)
* No unneeded empty arrays in transform spread

Since Array.prototype.concat creates a new array from inputs, there's
no need to call it from a new empty array ([].concat()).

* [fixup] simplify detection of new array
2017-11-09 14:51:56 -05:00
Henry Zhu
9ac326b075
remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00