diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.js b/packages/babel-helper-create-class-features-plugin/src/fields.js index 9706039ecb..185da71b5b 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.js +++ b/packages/babel-helper-create-class-features-plugin/src/fields.js @@ -625,46 +625,34 @@ function buildPrivateMethodDeclaration( static: isStatic, } = privateName; const { params, body, generator, async } = prop.node; - const methodValue = t.functionExpression( - methodId, - params, - body, - generator, - async, - ); const isGetter = getId && !getterDeclared && params.length === 0; const isSetter = setId && !setterDeclared && params.length > 0; + let declId = methodId; + if (isGetter) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, getterDeclared: true, }); - return t.variableDeclaration("var", [ - t.variableDeclarator(getId, methodValue), - ]); - } - if (isSetter) { + declId = getId; + } else if (isSetter) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, setterDeclared: true, }); - return t.variableDeclaration("var", [ - t.variableDeclarator(setId, methodValue), - ]); - } - if (isStatic && !privateFieldsAsProperties) { - return t.variableDeclaration("var", [ - t.variableDeclarator( - t.cloneNode(id), - t.functionExpression(id, params, body, generator, async), - ), - ]); + declId = setId; + } else if (isStatic && !privateFieldsAsProperties) { + declId = id; } - return t.variableDeclaration("var", [ - t.variableDeclarator(t.cloneNode(methodId), methodValue), - ]); + return t.functionDeclaration( + t.cloneNode(declId), + params, + body, + generator, + async, + ); } const thisContextVisitor = traverse.visitors.merge([ @@ -710,9 +698,11 @@ export function buildFieldsInitNodes( privateFieldsAsProperties, constantSuper, ) { + let needsClassRef = false; const staticNodes = []; const instanceNodes = []; - let needsClassRef = false; + // These nodes are pure and can be moved to the closest statement position + const pureStaticNodes = []; for (const prop of props) { ts.assertFieldTransformed(prop); @@ -780,7 +770,7 @@ export function buildFieldsInitNodes( privateNamesMap, ), ); - staticNodes.push( + pureStaticNodes.push( buildPrivateMethodDeclaration( prop, privateNamesMap, @@ -796,7 +786,7 @@ export function buildFieldsInitNodes( privateNamesMap, ), ); - staticNodes.push( + pureStaticNodes.push( buildPrivateMethodDeclaration( prop, privateNamesMap, @@ -809,7 +799,7 @@ export function buildFieldsInitNodes( staticNodes.unshift( buildPrivateStaticFieldInitSpec(prop, privateNamesMap), ); - staticNodes.unshift( + pureStaticNodes.push( buildPrivateMethodDeclaration( prop, privateNamesMap, @@ -827,7 +817,7 @@ export function buildFieldsInitNodes( privateNamesMap, ), ); - staticNodes.unshift( + pureStaticNodes.push( buildPrivateMethodDeclaration( prop, privateNamesMap, @@ -851,6 +841,7 @@ export function buildFieldsInitNodes( return { staticNodes: staticNodes.filter(Boolean), instanceNodes: instanceNodes.filter(Boolean), + pureStaticNodes: pureStaticNodes.filter(Boolean), wrapClass(path) { for (const prop of props) { prop.remove(); diff --git a/packages/babel-helper-create-class-features-plugin/src/index.js b/packages/babel-helper-create-class-features-plugin/src/index.js index 7e08d2b264..5aa2db7235 100644 --- a/packages/babel-helper-create-class-features-plugin/src/index.js +++ b/packages/babel-helper-create-class-features-plugin/src/index.js @@ -198,10 +198,10 @@ export function createClassFeaturePlugin({ state, ); - let keysNodes, staticNodes, instanceNodes, wrapClass; + let keysNodes, staticNodes, pureStaticNodes, instanceNodes, wrapClass; if (isDecorated) { - staticNodes = keysNodes = []; + staticNodes = pureStaticNodes = keysNodes = []; ({ instanceNodes, wrapClass } = buildDecoratedClass( ref, path, @@ -210,7 +210,12 @@ export function createClassFeaturePlugin({ )); } else { keysNodes = extractComputedKeys(ref, path, computedPaths, this.file); - ({ staticNodes, instanceNodes, wrapClass } = buildFieldsInitNodes( + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( ref, path.node.superClass, props, @@ -239,7 +244,14 @@ export function createClassFeaturePlugin({ path = wrapClass(path); path.insertBefore([...privateNamesNodes, ...keysNodes]); - path.insertAfter(staticNodes); + if (staticNodes.length > 0) { + path.insertAfter(staticNodes); + } + if (pureStaticNodes.length > 0) { + path + .find(parent => parent.isStatement() || parent.isDeclaration()) + .insertAfter(pureStaticNodes); + } }, PrivateName(path) { diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/output.js index 97681be69a..c137eb6f8e 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/output.js +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/output.js @@ -7,6 +7,6 @@ class X { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/output.js index 5e71555c1e..e4a5f492a1 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/output.js +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/output.js @@ -9,6 +9,6 @@ class X { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/replace-supers/method/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/replace-supers/method/output.js index a897d25593..2c03af5e9a 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/replace-supers/method/output.js +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/replace-supers/method/output.js @@ -9,8 +9,8 @@ class A extends B { } -var _foo2 = function _foo2() { +function _foo2() { let _A; babelHelpers.get(babelHelpers.getPrototypeOf(A.prototype), "x", this); -}; +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/async-generators/class-private-method/output.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/async-generators/class-private-method/output.js index e7d3cfbe56..49eb3ac98d 100644 --- a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/async-generators/class-private-method/output.js +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/async-generators/class-private-method/output.js @@ -7,7 +7,7 @@ class C { } -var _g2 = function _g2() { +function _g2() { var _this = this; return babelHelpers.wrapAsyncGenerator(function* () { @@ -16,4 +16,4 @@ var _g2 = function _g2() { yield 2; return 3; })(); -}; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js index 989d968638..d788b217f8 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js @@ -1,18 +1,18 @@ -var _class, _descriptor, _descriptor2, _temp; +var _class, _descriptor, _descriptor2; function dec() {} // Create a local function binding so babel has to change the name of the helper function _defineProperty() {} -let A = (_class = (_temp = function A() { +let A = (_class = function A() { "use strict"; babelHelpers.classCallCheck(this, A); babelHelpers.initializerDefineProperty(this, "a", _descriptor, this); babelHelpers.initializerDefineProperty(this, "b", _descriptor2, this); babelHelpers.defineProperty(this, "c", 456); -}, _temp), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { +}, (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { configurable: true, enumerable: true, writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js index 9487447b01..6f2b94d6db 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js @@ -1,15 +1,15 @@ -var _class, _descriptor, _descriptor2, _temp; +var _class, _descriptor, _descriptor2; function dec() {} -let A = (_class = (_temp = function A() { +let A = (_class = function A() { "use strict"; babelHelpers.classCallCheck(this, A); babelHelpers.initializerDefineProperty(this, "a", _descriptor, this); babelHelpers.initializerDefineProperty(this, "b", _descriptor2, this); this.c = 456; -}, _temp), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { +}, (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { configurable: true, enumerable: true, writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js index 0d1d71eabe..befa7315ec 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js @@ -1,15 +1,15 @@ -var _class, _descriptor, _descriptor2, _temp; +var _class, _descriptor, _descriptor2; function dec() {} -let A = (_class = (_temp = function A() { +let A = (_class = function A() { "use strict"; babelHelpers.classCallCheck(this, A); babelHelpers.initializerDefineProperty(this, "a", _descriptor, this); babelHelpers.initializerDefineProperty(this, "b", _descriptor2, this); babelHelpers.defineProperty(this, "c", 456); -}, _temp), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { +}, (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { configurable: true, enumerable: true, writable: true, diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js index 3e918afbbc..1e1dcda7c6 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed-redeclared/output.js @@ -14,7 +14,7 @@ var Foo = /*#__PURE__*/function () { babelHelpers.createClass(Foo, [{ key: "test", value: function test() { - var _foo3, _temp; + var _foo3; var _babelHelpers$classPr; @@ -38,7 +38,7 @@ var Foo = /*#__PURE__*/function () { } return Nested; - }((_temp = (_foo3 = babelHelpers.classPrivateFieldLooseKey("foo"), _babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo3)[_foo3], /*#__PURE__*/function () { + }((_foo3 = babelHelpers.classPrivateFieldLooseKey("foo"), _babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo3)[_foo3], /*#__PURE__*/function () { function _class2() { babelHelpers.classCallCheck(this, _class2); Object.defineProperty(this, _foo3, { @@ -49,7 +49,7 @@ var Foo = /*#__PURE__*/function () { } return _class2; - }()), _temp)); + }())); } }]); return Foo; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js index 8966dc48e4..d9117e0e11 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private-loose/nested-class-extends-computed/output.js @@ -14,8 +14,6 @@ var Foo = /*#__PURE__*/function () { babelHelpers.createClass(Foo, [{ key: "test", value: function test() { - var _temp; - var _babelHelpers$classPr; var _foo2 = babelHelpers.classPrivateFieldLooseKey("foo"); @@ -38,14 +36,14 @@ var Foo = /*#__PURE__*/function () { } return Nested; - }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo], /*#__PURE__*/function () { + }((_babelHelpers$classPr = babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo], /*#__PURE__*/function () { function _class2() { babelHelpers.classCallCheck(this, _class2); this[_babelHelpers$classPr] = 2; } return _class2; - }()), _temp)); + }())); } }]); return Foo; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js index a825258c20..42fd4e9547 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed-redeclared/output.js @@ -15,7 +15,7 @@ var Foo = /*#__PURE__*/function () { babelHelpers.createClass(Foo, [{ key: "test", value: function test() { - var _foo3, _temp; + var _foo3; var _babelHelpers$classPr; @@ -41,7 +41,7 @@ var Foo = /*#__PURE__*/function () { } return Nested; - }((_temp = (_foo3 = new WeakMap(), _babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo3), /*#__PURE__*/function () { + }((_foo3 = new WeakMap(), _babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo3), /*#__PURE__*/function () { function _class2() { babelHelpers.classCallCheck(this, _class2); @@ -54,7 +54,7 @@ var Foo = /*#__PURE__*/function () { } return _class2; - }()), _temp)); + }())); } }]); return Foo; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js index f66b7b3e5a..32e75135ea 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/private/nested-class-extends-computed/output.js @@ -15,8 +15,6 @@ var Foo = /*#__PURE__*/function () { babelHelpers.createClass(Foo, [{ key: "test", value: function test() { - var _temp; - var _babelHelpers$classPr; var _foo2 = new WeakMap(); @@ -41,14 +39,14 @@ var Foo = /*#__PURE__*/function () { } return Nested; - }((_temp = (_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo), /*#__PURE__*/function () { + }((_babelHelpers$classPr = babelHelpers.classPrivateFieldGet(this, _foo), /*#__PURE__*/function () { function _class2() { babelHelpers.classCallCheck(this, _class2); babelHelpers.defineProperty(this, _babelHelpers$classPr, 2); } return _class2; - }()), _temp)); + }())); } }]); return Foo; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js index 1ced958305..c7f53a4755 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/public/computed-without-block/output.js @@ -1,9 +1,7 @@ var createClass = k => { - var _temp; - var _k; - return _temp = (_k = k(), /*#__PURE__*/function () { + return _k = k(), /*#__PURE__*/function () { "use strict"; function _class2() { @@ -12,5 +10,5 @@ var createClass = k => { } return _class2; - }()), _temp; + }(); }; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js index e020b504c9..63c65192b6 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js @@ -1,10 +1,10 @@ let _Symbol$search; -var _class, _descriptor, _temp; +var _class, _descriptor; function dec() {} -let A = (_class = (_temp = (_Symbol$search = Symbol.search, /*#__PURE__*/function () { +let A = (_class = (_Symbol$search = Symbol.search, /*#__PURE__*/function () { "use strict"; function A() { @@ -17,7 +17,7 @@ let A = (_class = (_temp = (_Symbol$search = Symbol.search, /*#__PURE__*/functio value: function () {} }]); return A; -}()), _temp), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { +}()), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "a", [dec], { configurable: true, enumerable: true, writable: true, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/basic/output.js index e450d62cb5..77463ece9e 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/basic/output.js @@ -25,10 +25,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js index b68476be96..c98b43005c 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js @@ -17,6 +17,6 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/reassignment/output.js index 1f11f3b3e9..4d4038b1c5 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/reassignment/output.js @@ -13,6 +13,6 @@ class Foo { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js index b729b1e848..932304f692 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js @@ -18,6 +18,6 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/updates/output.js index b9fb372f9b..c28fd1253d 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/updates/output.js @@ -46,10 +46,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/basic/output.js index e450d62cb5..77463ece9e 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/basic/output.js @@ -25,10 +25,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/get-only-setter/output.js index b68476be96..c98b43005c 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/get-only-setter/output.js @@ -17,6 +17,6 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/set-only-getter/output.js index b729b1e848..932304f692 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/set-only-getter/output.js @@ -18,6 +18,6 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/updates/output.js index b9fb372f9b..c28fd1253d 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-privateFieldsAsProperties/updates/output.js @@ -46,10 +46,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField] = newValue; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/basic/output.js index 8671d4a51d..97c18b66fc 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/basic/output.js @@ -27,10 +27,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldGet(this, _privateField); -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldSet(this, _privateField, newValue); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js index 6d4429a6d3..44182ac5e6 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js @@ -19,6 +19,6 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldSet(this, _privateField, newValue); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/reassignment/output.js index fde918b03f..19fc2b357a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/reassignment/output.js @@ -19,6 +19,6 @@ class Foo { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js index 28258522e2..998614b922 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js @@ -25,8 +25,8 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldGet(this, _privateField); -}; +} var cl = new Cl(); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/updates/output.js index 11206cd9ee..54afa98088 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/updates/output.js @@ -50,10 +50,10 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldGet(this, _privateField); -}; +} -var _set_privateFieldValue = function (newValue) { +function _set_privateFieldValue(newValue) { babelHelpers.classPrivateFieldSet(this, _privateField, newValue); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/assumption-constantSuper/private-method-super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/assumption-constantSuper/private-method-super/output.js index 6c26d54af7..b27add84eb 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/assumption-constantSuper/private-method-super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/assumption-constantSuper/private-method-super/output.js @@ -24,6 +24,6 @@ class Sub extends Base { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return Base.prototype.superMethod.call(this); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-set/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-set/output.js index bd17b6c85b..5836631255 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-set/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-set/output.js @@ -17,10 +17,10 @@ class Cl { } -var _get_getSet = function () { +function _get_getSet() { return babelHelpers.classPrivateFieldGet(this, _privateField); -}; +} -var _set_getSet = function (newValue) { +function _set_getSet(newValue) { babelHelpers.classPrivateFieldSet(this, _privateField, newValue); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-get/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-get/output.js index 5574379b99..cac35a8db3 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-get/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-get/output.js @@ -17,10 +17,10 @@ class Cl { } -var _set_getSet = function (newValue) { +function _set_getSet(newValue) { babelHelpers.classPrivateFieldSet(this, _privateField, newValue); -}; +} -var _get_getSet = function () { +function _get_getSet() { return babelHelpers.classPrivateFieldGet(this, _privateField); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/assignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/assignment/output.js index e85cf49ca0..897f052cd4 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/assignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/assignment/output.js @@ -10,6 +10,6 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/async/output.js index 2b437a303f..1ae55ce6cb 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/async/output.js @@ -13,6 +13,6 @@ class Cl { } -var _foo2 = async function _foo2() { +async function _foo2() { return 2; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/before-fields/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/before-fields/output.js index 289e9d87b5..8c43d19a9a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/before-fields/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/before-fields/output.js @@ -20,6 +20,6 @@ class Cl { } -var _method2 = function _method2(x) { +function _method2(x) { return x; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/input.js new file mode 100644 index 0000000000..e180867063 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/output.js new file mode 100644 index 0000000000..ff898d7d6e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/class-expression/output.js @@ -0,0 +1,16 @@ +var _foo; + +console.log((_foo = babelHelpers.classPrivateFieldLooseKey("foo"), class A { + constructor() { + Object.defineProperty(this, _foo, { + value: _foo2 + }); + } + + method() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo](); + } + +})); + +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/context/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/context/output.js index 8cfe20d838..2960e45fa6 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/context/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/context/output.js @@ -35,6 +35,6 @@ class Foo { } -var _getStatus2 = function _getStatus2() { +function _getStatus2() { return this.status; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/exfiltrated/output.js index 533735a6fc..ff76ee756f 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/exfiltrated/output.js @@ -15,4 +15,4 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() {}; +function _privateMethod2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/generator/output.js index ead1fffcb5..4f1bca35bf 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/generator/output.js @@ -13,7 +13,7 @@ class Cl { } -var _foo2 = function* _foo2() { +function* _foo2() { yield 2; return 3; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/reassignment/output.js index fc2edb845b..319626f6ff 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/reassignment/output.js @@ -12,6 +12,6 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/super/output.js index 41de8ee02a..7f8aa27309 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/super/output.js @@ -25,6 +25,6 @@ class Sub extends Base { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return Base.prototype.superMethod.call(this); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/assignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/assignment/output.js index e85cf49ca0..897f052cd4 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/assignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/assignment/output.js @@ -10,6 +10,6 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/async/output.js index 2b437a303f..1ae55ce6cb 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/async/output.js @@ -13,6 +13,6 @@ class Cl { } -var _foo2 = async function _foo2() { +async function _foo2() { return 2; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/before-fields/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/before-fields/output.js index 2618032e66..f3ac631a5a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/before-fields/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/before-fields/output.js @@ -20,6 +20,6 @@ class Cl { } -var _method2 = function _method2(x) { +function _method2(x) { return x; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/input.js new file mode 100644 index 0000000000..e180867063 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/output.js new file mode 100644 index 0000000000..ff898d7d6e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/class-expression/output.js @@ -0,0 +1,16 @@ +var _foo; + +console.log((_foo = babelHelpers.classPrivateFieldLooseKey("foo"), class A { + constructor() { + Object.defineProperty(this, _foo, { + value: _foo2 + }); + } + + method() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo](); + } + +})); + +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/context/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/context/output.js index b1c396755f..9e744365c3 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/context/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/context/output.js @@ -35,6 +35,6 @@ class Foo { } -var _getStatus2 = function _getStatus2() { +function _getStatus2() { return this.status; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/exfiltrated/output.js index 100562baf5..20aabf9d90 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/exfiltrated/output.js @@ -15,4 +15,4 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() {}; +function _privateMethod2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/generator/output.js index ead1fffcb5..4f1bca35bf 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/generator/output.js @@ -13,7 +13,7 @@ class Cl { } -var _foo2 = function* _foo2() { +function* _foo2() { yield 2; return 3; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/super/output.js index 1a0d87d98e..135e85a475 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-privateFieldsAsProperties/super/output.js @@ -25,6 +25,6 @@ class Sub extends Base { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return babelHelpers.get(babelHelpers.getPrototypeOf(Sub.prototype), "superMethod", this).call(this); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/assignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/assignment/output.js index 9d2267d3a1..287035cd1b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/assignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/assignment/output.js @@ -9,6 +9,6 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/async/output.js index fac63df805..18681ae3c9 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/async/output.js @@ -11,6 +11,6 @@ class Cl { } -var _foo2 = async function _foo2() { +async function _foo2() { return 2; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/before-fields/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/before-fields/output.js index d5b9f3f508..9efe6b690e 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/before-fields/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/before-fields/output.js @@ -20,6 +20,6 @@ class Cl { } -var _method2 = function _method2(x) { +function _method2(x) { return x; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/input.js new file mode 100644 index 0000000000..e180867063 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/output.js new file mode 100644 index 0000000000..2c128cc199 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/class-expression/output.js @@ -0,0 +1,14 @@ +var _foo; + +console.log((_foo = new WeakSet(), class A { + constructor() { + _foo.add(this); + } + + method() { + babelHelpers.classPrivateMethodGet(this, _foo, _foo2).call(this); + } + +})); + +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/context/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/context/output.js index 1bb1b7ce25..a771a166fa 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/context/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/context/output.js @@ -33,6 +33,6 @@ class Foo { } -var _getStatus2 = function _getStatus2() { +function _getStatus2() { return this.status; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/exfiltrated/output.js index 0bf21759ea..6501d6da34 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/exfiltrated/output.js @@ -13,4 +13,4 @@ class Foo { } -var _privateMethod2 = function _privateMethod2() {}; +function _privateMethod2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/generator/output.js index 45680cfbe2..aceb5e4475 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/generator/output.js @@ -11,7 +11,7 @@ class Cl { } -var _foo2 = function* _foo2() { +function* _foo2() { yield 2; return 3; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/read-only/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/read-only/output.js index a4e3bed68f..b45320ca4a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/read-only/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/read-only/output.js @@ -16,4 +16,4 @@ class A { } -var _method2 = function _method2() {}; +function _method2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/reassignment/output.js index f4e9be344c..d0dbda0511 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/reassignment/output.js @@ -16,6 +16,6 @@ class Foo { } -var _privateFieldValue2 = function _privateFieldValue2() { +function _privateFieldValue2() { return 42; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/super/output.js index ebd62c2a5a..7bcd4ac7ef 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-method/super/output.js @@ -24,6 +24,6 @@ class Sub extends Base { } -var _privateMethod2 = function _privateMethod2() { +function _privateMethod2() { return babelHelpers.get(babelHelpers.getPrototypeOf(Sub.prototype), "superMethod", this).call(this); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/async/output.js index d21e2139e8..d9ba9e11c1 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/async/output.js @@ -5,9 +5,9 @@ class Cl { } -var _privateStaticMethod = async function _privateStaticMethod() { +async function _privateStaticMethod() { return 2; -}; +} return new Cl().test().then(val => { expect(val).toBe(2); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/basic/output.js index c62177365e..8b6f957e0b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/basic/output.js @@ -23,9 +23,9 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() { +function _privateStaticMethod2() { return 1017; -}; +} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-check/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-check/output.js index 353da8ad4f..8ff4aacd7a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-check/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-check/output.js @@ -7,7 +7,7 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() {}; +function _privateStaticMethod2() {} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/input.js new file mode 100644 index 0000000000..1106a11b73 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + static #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/output.js new file mode 100644 index 0000000000..cfff4ef1bc --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/class-expression/output.js @@ -0,0 +1,12 @@ +var _class, _foo, _temp; + +console.log((_temp = (_foo = babelHelpers.classPrivateFieldLooseKey("foo"), _class = class A { + method() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo](); + } + +}), Object.defineProperty(_class, _foo, { + value: _foo2 +}), _temp)); + +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/exfiltrated/output.js index 1216761ab5..f8cc8e9d65 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/exfiltrated/output.js @@ -11,9 +11,9 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() { +function _privateStaticMethod2() { return 1017; -}; +} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/generator/output.js index 464971ea79..095f86b0ef 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/generator/output.js @@ -7,10 +7,10 @@ class Cl { } -var _foo2 = function* _foo2() { +function* _foo2() { yield 2; return 3; -}; +} Object.defineProperty(Cl, _foo, { value: _foo2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/reassignment/output.js index 5b3fae07d0..7ba99ec7c2 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/reassignment/output.js @@ -7,7 +7,7 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() {}; +function _privateStaticMethod2() {} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/super/output.js index 7c93e1917f..9232666b00 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/super/output.js @@ -18,9 +18,9 @@ class Sub extends Base { } -var _subStaticPrivateMethod2 = function _subStaticPrivateMethod2() { +function _subStaticPrivateMethod2() { return Base.basePublicStaticMethod.call(this); -}; +} Object.defineProperty(Sub, _subStaticPrivateMethod, { value: _subStaticPrivateMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js index 14ebbe1ff0..ed8fac6d2b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js @@ -20,18 +20,17 @@ class B extends A { } -var _getB2 = function _getB2() { +function _getA2() { + return A.a; +} + +function _getB2() { return this.b; -}; +} Object.defineProperty(B, _getB, { value: _getB2 }); - -var _getA2 = function _getA2() { - return A.a; -}; - Object.defineProperty(B, _getA, { value: _getA2 }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/async/output.js index 9d5595eaaf..8910dd1b8e 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/async/output.js @@ -7,9 +7,9 @@ class Cl { } -var _privateStaticMethod2 = async function _privateStaticMethod2() { +async function _privateStaticMethod2() { return 2; -}; +} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/basic/output.js index c62177365e..8b6f957e0b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/basic/output.js @@ -23,9 +23,9 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() { +function _privateStaticMethod2() { return 1017; -}; +} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-check/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-check/output.js index 353da8ad4f..8ff4aacd7a 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-check/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-check/output.js @@ -7,7 +7,7 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() {}; +function _privateStaticMethod2() {} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/input.js new file mode 100644 index 0000000000..1106a11b73 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + static #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/output.js new file mode 100644 index 0000000000..cfff4ef1bc --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/class-expression/output.js @@ -0,0 +1,12 @@ +var _class, _foo, _temp; + +console.log((_temp = (_foo = babelHelpers.classPrivateFieldLooseKey("foo"), _class = class A { + method() { + babelHelpers.classPrivateFieldLooseBase(this, _foo)[_foo](); + } + +}), Object.defineProperty(_class, _foo, { + value: _foo2 +}), _temp)); + +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/exfiltrated/output.js index c6a5a2dc80..55fb8eed2b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/exfiltrated/output.js @@ -11,9 +11,9 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() { +function _privateStaticMethod2() { return 1017; -}; +} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/generator/output.js index 464971ea79..095f86b0ef 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/generator/output.js @@ -7,10 +7,10 @@ class Cl { } -var _foo2 = function* _foo2() { +function* _foo2() { yield 2; return 3; -}; +} Object.defineProperty(Cl, _foo, { value: _foo2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/reassignment/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/reassignment/output.js index 5b3fae07d0..7ba99ec7c2 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/reassignment/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/reassignment/output.js @@ -7,7 +7,7 @@ class Cl { } -var _privateStaticMethod2 = function _privateStaticMethod2() {}; +function _privateStaticMethod2() {} Object.defineProperty(Cl, _privateStaticMethod, { value: _privateStaticMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/super/output.js index ae589469ca..3a734d066f 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/super/output.js @@ -18,9 +18,9 @@ class Sub extends Base { } -var _subStaticPrivateMethod2 = function _subStaticPrivateMethod2() { +function _subStaticPrivateMethod2() { return babelHelpers.get(babelHelpers.getPrototypeOf(Sub), "basePublicStaticMethod", this).call(this); -}; +} Object.defineProperty(Sub, _subStaticPrivateMethod, { value: _subStaticPrivateMethod2 diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/this/output.js index 1dc2a3c09f..c73cb416d5 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-privateFieldsAsProperties/this/output.js @@ -20,18 +20,17 @@ class B extends A { } -var _getB2 = function _getB2() { +function _getA2() { + return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); +} + +function _getB2() { return this.b; -}; +} Object.defineProperty(B, _getB, { value: _getB2 }); - -var _getA2 = function _getA2() { - return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); -}; - Object.defineProperty(B, _getA, { value: _getA2 }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/async/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/async/output.js index d21e2139e8..d9ba9e11c1 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/async/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/async/output.js @@ -5,9 +5,9 @@ class Cl { } -var _privateStaticMethod = async function _privateStaticMethod() { +async function _privateStaticMethod() { return 2; -}; +} return new Cl().test().then(val => { expect(val).toBe(2); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/basic/output.js index 2c56c6dedc..bedb9b04c1 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/basic/output.js @@ -21,6 +21,6 @@ class Cl { } -var _privateStaticMethod = function _privateStaticMethod() { +function _privateStaticMethod() { return 1017; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-check/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-check/output.js index 06b25f9a78..c5d560b2e5 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-check/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-check/output.js @@ -5,4 +5,4 @@ class Cl { } -var _privateStaticMethod = function _privateStaticMethod() {}; +function _privateStaticMethod() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/input.js new file mode 100644 index 0000000000..1106a11b73 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/input.js @@ -0,0 +1,7 @@ +console.log(class A { + static #foo() {} + + method() { + this.#foo(); + } +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/output.js new file mode 100644 index 0000000000..f2c8f2005d --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/class-expression/output.js @@ -0,0 +1,10 @@ +var _class; + +console.log(_class = class A { + method() { + babelHelpers.classStaticPrivateMethodGet(this, _class, _foo).call(this); + } + +}); + +function _foo() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/exfiltrated/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/exfiltrated/output.js index 6edcd3d51a..0ba9433fd3 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/exfiltrated/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/exfiltrated/output.js @@ -9,6 +9,6 @@ class Cl { } -var _privateStaticMethod = function _privateStaticMethod() { +function _privateStaticMethod() { return 1017; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/generator/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/generator/output.js index be6d0e6bf2..73e7267375 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/generator/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/generator/output.js @@ -5,7 +5,7 @@ class Cl { } -var _foo = function* _foo() { +function* _foo() { yield 2; return 3; -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/read-only/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/read-only/output.js index 11ad335c52..2a8601c11b 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/read-only/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/read-only/output.js @@ -6,4 +6,4 @@ class A { } -var _method = function _method() {}; +function _method() {} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/super/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/super/output.js index b9cdbb4d24..cc15e95fca 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/super/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/super/output.js @@ -16,6 +16,6 @@ class Sub extends Base { } -var _subStaticPrivateMethod = function _subStaticPrivateMethod() { +function _subStaticPrivateMethod() { return babelHelpers.get(babelHelpers.getPrototypeOf(Sub), "basePublicStaticMethod", this).call(this); -}; +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js index 49a4f4a7c6..76e84ed084 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js @@ -16,12 +16,12 @@ class B extends A { } -var _getB = function _getB() { - return this.b; -}; - -var _getA = function _getA() { +function _getA() { return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); -}; +} + +function _getB() { + return this.b; +} var [getA, getB] = B.extract(); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js index 2a8caf1e7f..105cdd7da0 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js @@ -13,13 +13,13 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { - babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; -}; - -var _get_privateStaticFieldValue = function () { +function _get_privateStaticFieldValue() { return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; -}; +} + +function _set_privateStaticFieldValue(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; +} Object.defineProperty(Cl, _privateStaticFieldValue, { get: _get_privateStaticFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/destructure-set/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/destructure-set/output.js index 85649bc4c2..4b48880d23 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/destructure-set/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/destructure-set/output.js @@ -9,9 +9,9 @@ class C { } -var _set_p = function (v) { +function _set_p(v) { babelHelpers.classPrivateFieldLooseBase(C, _q)[_q] = v; -}; +} Object.defineProperty(C, _p, { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js index d906744628..6ec9998a56 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js @@ -9,9 +9,9 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { +function _set_privateStaticFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = newValue; -}; +} Object.defineProperty(Cl, _privateStaticFieldValue, { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js index 65d4054179..66d4f85877 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js @@ -10,9 +10,9 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} Object.defineProperty(Cl, _privateFieldValue, { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js index a0d3b6f81f..9cc25d1c8c 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js @@ -34,13 +34,13 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { - babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; -}; - -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField]; -}; +} + +function _set_privateFieldValue(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; +} Object.defineProperty(Cl, _privateFieldValue, { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/basic/output.js index 2a8caf1e7f..105cdd7da0 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/basic/output.js @@ -13,13 +13,13 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { - babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; -}; - -var _get_privateStaticFieldValue = function () { +function _get_privateStaticFieldValue() { return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; -}; +} + +function _set_privateStaticFieldValue(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; +} Object.defineProperty(Cl, _privateStaticFieldValue, { get: _get_privateStaticFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/destructure-set/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/destructure-set/output.js index 85649bc4c2..4b48880d23 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/destructure-set/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/destructure-set/output.js @@ -9,9 +9,9 @@ class C { } -var _set_p = function (v) { +function _set_p(v) { babelHelpers.classPrivateFieldLooseBase(C, _q)[_q] = v; -}; +} Object.defineProperty(C, _p, { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/get-only-setter/output.js index d906744628..6ec9998a56 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/get-only-setter/output.js @@ -9,9 +9,9 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { +function _set_privateStaticFieldValue(newValue) { babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = newValue; -}; +} Object.defineProperty(Cl, _privateStaticFieldValue, { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/set-only-getter/output.js index a2ebe5bfad..62e5992370 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/set-only-getter/output.js @@ -10,9 +10,9 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(this, _privateField)[_privateField]; -}; +} Object.defineProperty(Cl, _privateFieldValue, { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/updates/output.js index 26a81c480c..3d9711b788 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-privateFieldsAsProperties/updates/output.js @@ -34,13 +34,13 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { - babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; -}; - -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField]; -}; +} + +function _set_privateFieldValue(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; +} Object.defineProperty(Cl, _privateFieldValue, { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js index 392f438e9d..974af17a66 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js @@ -9,13 +9,13 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { - babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, `Updated: ${newValue}`); -}; - -var _get_privateStaticFieldValue = function () { +function _get_privateStaticFieldValue() { return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _PRIVATE_STATIC_FIELD); -}; +} + +function _set_privateStaticFieldValue(newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, `Updated: ${newValue}`); +} var _privateStaticFieldValue = { get: _get_privateStaticFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/destructure-set/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/destructure-set/output.js index 03dde3c120..11497bc263 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/destructure-set/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/destructure-set/output.js @@ -5,9 +5,9 @@ class C { } -var _set_p = function (v) { +function _set_p(v) { babelHelpers.classStaticPrivateFieldSpecSet(C, C, _q, v); -}; +} var _p = { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js index 90b72b2736..ef6f5e5a0e 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js @@ -5,9 +5,9 @@ class Cl { } -var _set_privateStaticFieldValue = function (newValue) { +function _set_privateStaticFieldValue(newValue) { babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, newValue); -}; +} var _privateStaticFieldValue = { get: void 0, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js index 024f699c63..0d69b5c36d 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js @@ -6,9 +6,9 @@ class Cl { } -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classStaticPrivateFieldSpecGet(this, Cl, _privateField); -}; +} var _privateFieldValue = { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js index 5e94a82a58..d019caca57 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js @@ -32,13 +32,13 @@ class Cl { } -var _set_privateFieldValue = function (newValue) { - babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, newValue); -}; - -var _get_privateFieldValue = function () { +function _get_privateFieldValue() { return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateField); -}; +} + +function _set_privateFieldValue(newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, newValue); +} var _privateFieldValue = { get: _get_privateFieldValue, diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/accessor/output.js index 9d2a42925d..40db38108d 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/accessor/output.js @@ -14,4 +14,4 @@ class Foo { } -var _get_foo = function () {}; +function _get_foo() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/method/output.js index aebc5e5ffa..6bde632989 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/method/output.js @@ -13,4 +13,4 @@ class Foo { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-accessor/output.js index 3f5bbb4c84..0f063078b1 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-accessor/output.js @@ -7,7 +7,7 @@ class Foo { } -var _get_foo = function () {}; +function _get_foo() {} Object.defineProperty(Foo, _foo, { get: _get_foo, diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-method/output.js index e6af49be3a..09ee6ad805 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/assumption-privateFieldsAsProperties/static-method/output.js @@ -7,7 +7,7 @@ class Foo { } -var _foo2 = function _foo2() {}; +function _foo2() {} Object.defineProperty(Foo, _foo, { value: _foo2 diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/accessor/output.js index 2774c64d82..a3d6297345 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/accessor/output.js @@ -20,4 +20,4 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _get_foo = function () {}; +function _get_foo() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/method/output.js index 0928379305..45362fb301 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/method/output.js @@ -19,4 +19,4 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-accessor/output.js index f82bb847e2..0e511d0f4e 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-accessor/output.js @@ -16,7 +16,7 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _get_foo = function () {}; +function _get_foo() {} Object.defineProperty(Foo, _foo, { get: _get_foo, diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-method/output.js index 7de7e3f745..2eacb6470e 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private-loose/static-method/output.js @@ -16,7 +16,7 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _foo2 = function _foo2() {}; +function _foo2() {} Object.defineProperty(Foo, _foo, { value: _foo2 diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/accessor/output.js index d78e57a24a..5154c49e47 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/accessor/output.js @@ -21,4 +21,4 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _get_foo = function () {}; +function _get_foo() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/method/output.js index 4135c76074..6e418ceb51 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/method/output.js @@ -18,4 +18,4 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-accessor/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-accessor/output.js index e29d7e1009..810276221b 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-accessor/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-accessor/output.js @@ -14,7 +14,7 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _get_foo = function () {}; +function _get_foo() {} var _foo = { get: _get_foo, diff --git a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-method/output.js b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-method/output.js index f97846c679..efde0032c5 100644 --- a/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-method/output.js +++ b/packages/babel-plugin-proposal-private-property-in-object/test/fixtures/private/static-method/output.js @@ -14,4 +14,4 @@ let Foo = /*#__PURE__*/function () { return Foo; }(); -var _foo = function _foo() {}; +function _foo() {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/output.js index 2fe46d31a1..31c5d16757 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/decorated-declare-properties/output.js @@ -1,11 +1,11 @@ -var _class, _descriptor, _temp; +var _class, _descriptor; -let Foo = (_class = (_temp = class Foo { +let Foo = (_class = class Foo { constructor() { babelHelpers.initializerDefineProperty(this, "bar", _descriptor, this); } -}, _temp), (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "bar", [decorator], { +}, (_descriptor = babelHelpers.applyDecoratedDescriptor(_class.prototype, "bar", [decorator], { configurable: true, enumerable: true, writable: true, diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/methods-loose-preset-not-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/methods-loose-preset-not-loose/output.js index 4baaa28201..2b545a555f 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/methods-loose-preset-not-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/methods-loose-preset-not-loose/output.js @@ -10,4 +10,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-loose-no-plugins/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-loose-no-plugins/output.js index 4baaa28201..2b545a555f 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-loose-no-plugins/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-loose-no-plugins/output.js @@ -10,4 +10,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-not-loose-no-plugins/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-not-loose-no-plugins/output.js index d5242cc50c..80ef2f6606 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-not-loose-no-plugins/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/preset-not-loose-no-plugins/output.js @@ -9,4 +9,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-loose-preset-not-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-loose-preset-not-loose/output.js index 4baaa28201..2b545a555f 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-loose-preset-not-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-loose-preset-not-loose/output.js @@ -10,4 +10,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-not-loose-preset-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-not-loose-preset-loose/output.js index d5242cc50c..80ef2f6606 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-not-loose-preset-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-and-methods-not-loose-preset-loose/output.js @@ -9,4 +9,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-loose/output.js index 4baaa28201..2b545a555f 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-loose/output.js @@ -10,4 +10,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-not-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-not-loose/output.js index 4baaa28201..2b545a555f 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-not-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-loose-preset-not-loose/output.js @@ -10,4 +10,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {} diff --git a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-not-loose-preset-loose/output.js b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-not-loose-preset-loose/output.js index d5242cc50c..80ef2f6606 100644 --- a/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-not-loose-preset-loose/output.js +++ b/packages/babel-preset-env/test/fixtures/loose-class-features-precedence/properties-not-loose-preset-loose/output.js @@ -9,4 +9,4 @@ class A { } -var _foo2 = function _foo2() {}; +function _foo2() {}