38 Commits

Author SHA1 Message Date
Ajay Narain Mathur
3cdb7d7f0f added instanceOf plugin to preset es2015 (#6257)
* added instanceOf plugin to preset es2015

* fixed test cases
2017-09-17 17:33:42 -04:00
Logan Smyth
158e9fbfd7 Represent helpers as simple modules. 2017-09-12 22:15:16 -07:00
Mateusz Burzyński
c47258d68c Annotating transformed classes with #__PURE__ comment (#6209) 2017-09-11 11:18:37 -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
Justin Ridgewell
ac6eda2709 Class instance properties define their own context (#6158) 2017-08-28 12:47:17 -06:00
Anup
6ab3b4c0e3 Add 'configurable' property to class fields (#6123) 2017-08-16 10:12:38 -04:00
Brian Ng
9e51038ad9 Fix class prop test fixture (#6090) 2017-08-14 09:20:36 -05:00
Diogo Franco (Kovensky)
cd66657f34 Update outdated test fixture 2017-08-12 14:10:19 +09:00
Andy
9243c78ea2 babel-plugin-transform-class-properties: Ignore type annotations when looking for name collisions (#6082) 2017-08-11 10:27:48 -05:00
Noah Lemen
4fdd75695b Update Class Fields to Stage 3 and change default behavior (#6076)
* add transform-class-properties to stage 3, set spec mode to default

* update readme with examples; use `buildUndefinedNode()`; change behavior to always define both static and nonstatic class properties regardless of spec/loose mode; update tests
2017-08-10 11:19:49 -04:00
Henry Zhu
0f823beeb1 Newlines in fixtures (#6044)
* write newlines for fixtures

* rerun fixtures
2017-08-02 15:35:29 -04:00
Justin Ridgewell
e170e6d760 Fix returning an object in a derived class constructor without super (#5885) 2017-07-11 17:43:19 -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
afe85c11a7
474-transform 2017-05-23 08:08:07 -05:00
Brian Ng
01d5d5ebc7
499-transform 2017-05-23 07:58:22 -05:00
Brian Ng
cd9bb7ba10 Ensure default exported classes keep entry in export table (#5488) 2017-04-09 16:39:15 -07:00
Sergey Rubanov
292c3ca206 Refactor test packages to use ES modules instead of CJS (#5138) 2017-01-16 11:25:04 -05:00
Moti Zilberman
f8ddd80f96 Greater spec compliance for class properties (#4544)
* Desugar class properties to Object.defineProperty per spec
* Define uninitialized static class properties with value=undefined
* Make class-properties increased spec compliance opt-in (spec: true)
2016-11-15 16:35:51 -05:00
Moti Zilberman
03d772c2ec Computed class properties (#4500)
* Support computed class property names (#4499)

** Depends on babel/babylon#121 **

* `babel-types`: Add `computed` field to `ClassProperty`

* `babel-plugin-transform-class-properties`: handle computed property names correctly

* `babel-generator`: add tests for class properties (computed/literal, static/instance)

* doc: Update babel-types with ClassProperty.computed

* chore(package): update babylon to v6.11.0

* babel-types: move ClassProperty.computed to be last builder arg
2016-09-26 17:46:00 +02:00
Daniel Tschinder
10cd6519d8 Fix class inheritance in IE <=10 (T3041) (#3527)
* Fix class inheritance in IE9 & IE10 (T3041)

Internet Explorer 9&10 do not support __proto__ at all, don't have
Object.setPrototypeOf(), but have Object.getPrototypeOf().

Because of this setting the prototype is not possible, which makes the
babelHelpers.inherits() function to set __proto__ although not supported.

Afterwards Object.getPrototypeOf() is used, but this one is not
respecting the "custom" property __proto__ that we set.

The solution is to check for __proto__ first and afterwards fallback to
Object.getPrototypeOf().

* Do the same logic in babel-helper-replace-supers

* Fix tests

* Extract creation of prototype nodes to small helper
2016-08-23 15:08:44 -04:00
Keyan Zhang
879f69f0fb infer class name for classes that have static properties (#3589) 2016-07-22 09:50:03 -04:00
Logan Smyth
61e3b1d314 Remove incorrect function/class check. 2016-06-16 20:31:19 -07:00
Andrew Johnston
f408f28a02 Fix: assign _this to this when there is no Superclass - Fixes T7364
Closes gh-3508
2016-05-28 09:51:28 -04:00
Jhen-Jie Hong
2d7fb9af41 Class properties: Add path.ensureBlock for ArrowFunctionExpression (#3486)
* Class properties: Add path.ensureBlock for ArrowFunctionExpression

* Class properties: Add test case for non-block arrow function
2016-05-13 17:45:15 -04:00
Logan Smyth
63b328ce87 Revert "babylon: throw parse error if class properties do not have a semicolon (fixes T6873)"
This reverts commit 976edfc06740e434d1d5b136e28996a77f909403.
2016-02-06 18:36:31 -08:00
Henry Zhu
976edfc067 babylon: throw parse error if class properties do not have a semicolon (fixes T6873) 2015-12-30 14:01:46 -05:00
Ben Alpert
248f00fe82 Set function names from assignment expressions
Based on http://www.2ality.com/2015/09/function-names-es6.html.
2015-12-27 12:46:56 -08:00
Amjad Masad
0d8e5a9e86 Fix over-parenthesizing of function expressions 2015-12-24 14:55:51 -08:00
Sebastian McKenzie
1fa24b1efd rename babel-plugin-external-helpers-2 to babel-plugin-external-helpers 2015-12-24 03:54:40 +00:00
Henry Zhu
8d78ea4ecf Merge pull request #3112 from phantom10111/fix-es2015-classes
Fix return super(); in class constructor - fixes T2997
2015-12-03 10:34:18 -05:00
Logan Smyth
d71b59d0cc Ensure we always push into a BlockStatement - fixes T3051 2015-12-02 19:41:22 -08:00
phantom10111
36ebe0c939 Fix static class properties in class expressions and anonymous default exported classes - fixes T2983 2015-12-01 17:59:53 +01:00
phantom10111
9a270a3d0a Fix return super(); in class constructor - fixes T2997 2015-11-25 23:53:53 +01:00
Logan Smyth
b3f2ea0aa1 Avoid duplicating traversal of class declarations - fixes T2694 2015-11-19 00:30:56 -08:00
Sebastian McKenzie
9f6dcdbc29 add regression test - fixes #3028 2015-11-13 03:37:43 -08:00
Sebastian McKenzie
54c13eef5c fix exported classes with static class properties - fixes #2868 2015-11-10 15:56: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