27 Commits

Author SHA1 Message Date
Logan Smyth
158e9fbfd7 Represent helpers as simple modules. 2017-09-12 22:15:16 -07:00
Logan Smyth
1e750a945c Convert CommonJS to use new shared implementation. 2017-09-12 17:17:41 -07:00
Ben Newman
c4f6a7a06f Add failing test case for object rest after array rest, and fix it. (#6213)
* Add failing test case for object rest after array rest.

Discovered while upgrading https://github.com/meteor/babel to Babel 7.

The error is:

  1) babel-plugin-transform-object-rest-spread/object rest with array rest:
     TypeError: /Users/ben/dev/babel/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/with-array-rest/actual.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got null
      at Object.validate (packages/babel-types/lib/definitions/index.js:73:13)
      at validate (packages/babel-types/lib/index.js:460:9)
      at Object.builder (packages/babel-types/lib/index.js:428:7)
      at Object.RestElement (packages/babel-plugin-transform-object-rest-spread/lib/index.js:157:41)
      at NodePath._call (packages/babel-traverse/lib/path/context.js:53:20)
      at NodePath.call (packages/babel-traverse/lib/path/context.js:40:17)
      at NodePath.visit (packages/babel-traverse/lib/path/context.js:84:12)
      ...

* Fix object rest following array rest. (#6213)

* Avoid treating array ...rest elements as object ...rest properties.

* Also avoid treating ...rest parameters as object ...rest properties.

Returning early if the parent was an ArrayPattern was not quite enough,
since a RestElement can appear as a parameter in a Function as well.

* Move RestElement parent check earlier in visitor method.
2017-09-11 11:16:14 -04:00
Justin Ridgewell
3e487f89ab Don't merge test options. (#6157)
* Don't merge test options.

Particularly, I don't want `lodash/merge` to merge my specific plugins
with the general test plugins. It led to odd behavior where I could
enable a loose transform in my specific test, just to have it overridden
by the test fixture's general options.

* Need options
2017-08-28 13:36:03 -06:00
Mateusz Burzyński
3c4f19a28d Adjusted Object Rest/Spread tests to use only allowed syntax from the latest spec (#6102) 2017-08-24 15:50:43 -04:00
Brian Ng
9dd65c809f
fixes 2017-08-03 22:27:30 -05:00
Henry Zhu
0f823beeb1 Newlines in fixtures (#6044)
* write newlines for fixtures

* rerun fixtures
2017-08-02 15:35:29 -04:00
Peeyush Kushwaha
4a35243118 Non string computed keys in object-rest-spread (#5757) 2017-07-25 09:46:52 -05:00
Justin Ridgewell
63204ae51e Remove maybePopFromStatements (#5945)
It prevented you from pushing into the `params` of a function.

```js
fnpath.pushContainer("params", t.identifier("memo"))
```
2017-07-18 14:55:33 -04:00
Daniel Tschinder
b3372a572d Remove whitespace generation (#5833)
* Remove whitespace generation and rely on default printing

Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines

* Fix a few more fixtures
2017-06-27 21:57:02 -05:00
Henry Zhu
123dce5fcd Hardcode to double quotes, indent to 2 spaces (#5824) 2017-06-05 22:14:37 -05:00
Brian Ng
32c4cdf016
339-spread-obj-pattern-assignable 2017-05-23 08:43:15 -05:00
Brian Ng
79c1eed8c1 Fix incorrect property ordering with obj rest spread on nested (#5685) 2017-05-02 14:04:37 -04:00
Christopher Karper
14ed03127c Fix object destructuring in param arrays (#5650) 2017-04-20 10:45:45 -04:00
Daniel Tschinder
7c62278dcd [7.0] Change for-await to use new AST (#5321) 2017-02-15 17:29:09 -05:00
Erik Desjardins
bca170ad79 Avoid duplicating impure expressions in object rest destructuring (#5151)
* avoid duplicating impure initializers in object rest destructuring

* reuse existing VariableDeclarations in object rest destructuring, to fix two issues:

1. inserting an additional VariableDeclaration after the current one may change order of operations, which is unsafe if a future VariableDeclarator refers to a destructured variable.

2. The entire VariableDeclaration is removed when all properties are rest properties, indiscriminately removing other variables
2017-01-18 21:32:44 -05:00
Sergey Rubanov
292c3ca206 Refactor test packages to use ES modules instead of CJS (#5138) 2017-01-16 11:25:04 -05:00
Christophe Hurpeau
4a1965511f fix: plugin-transform-object-rest-spread param with default value 2017-01-15 14:02:08 -08:00
Henry Zhu
cfc1e5cb38 fix object spread (#4976) 2016-12-08 20:13:57 -05:00
Henry Zhu
88bc28c414 Fix nested object spread (#4974) 2016-12-08 19:30:50 -05:00
Christophe Hurpeau
81575bcdfe Fix for object-rest with parameters destructuring nested rest (#4883) 2016-12-01 23:58:07 -05:00
Henry Zhu
19bb830c50 use *, add test for assign-expression in parameter (#4865) 2016-11-19 10:45:00 -05:00
Henry Zhu
cd041541b8 Fix bug + Generate test fixtures if no expected.js (#4858) 2016-11-17 17:53:46 -05:00
Henry Zhu
5e0508d57c object rest - fix when destructuring in variables/parameters (#4755)
* object rest - fix when destructuring in variables/parameters

* fixes + ExportNamedDeclaration support

* Account for CatchClause

* support ForXStatement

* support assignment expression? + PR fixes
2016-11-15 11:31:03 -05:00
Henry Zhu
d2d34ba8e7 object rest spread useBuiltIns option (#4491)
* feat(transform-object-rest-spread): add polyfill=false option to avoid extends helper

* object-rest-spread: add useBuiltIns option

* add test for invalid option
2016-09-09 18:38:50 -04:00
Logan Smyth
305252d335 Recognize object rest properties as binding identifiers - fixes T7178 2016-03-03 08:58:22 -08:00
Sebastian McKenzie
15969a0904 move all plugin tests out of babel-core and into their appropriate folders 2015-11-08 23:04:10 -08:00