diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js new file mode 100644 index 0000000000..69673b7af6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js @@ -0,0 +1,59 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; + +var _A = /*#__PURE__*/new WeakMap(); + +var _a = /*#__PURE__*/new WeakMap(); + +var _B = /*#__PURE__*/new WeakMap(); + +var _b = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b2, + set: _set_b2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a2, + set: _set_a2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: (_initProto(this), _init_a(this)) + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: _init_b(this, 123) + }); + } + +} + +function _set_a2(v) { + _set_a(this, v); +} + +function _get_a2() { + _get_a(this); +} + +function _set_b2(v) { + _set_b(this, v); +} + +function _get_b2() { + _get_b(this); +} + +(() => { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 1, "a", function () { + return babelHelpers.classPrivateFieldGet(this, _A); + }, function (value) { + babelHelpers.classPrivateFieldSet(this, _A, value); + }], [dec, 1, "b", function () { + return babelHelpers.classPrivateFieldGet(this, _B); + }, function (value) { + babelHelpers.classPrivateFieldSet(this, _B, value); + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js new file mode 100644 index 0000000000..2a6057e84c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js @@ -0,0 +1,58 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initProto; + +_dec = dec +_dec2 = dec +_computedKey = 'c' +_dec3 = dec + +var _A = /*#__PURE__*/new WeakMap(); + +var _B = /*#__PURE__*/new WeakMap(); + +var _C = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: (_initProto(this), _init_a(this)) + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: _init_b(this, 123) + }); + babelHelpers.classPrivateFieldInitSpec(this, _C, { + writable: true, + value: _init_computedKey(this, 456) + }); + } + + get a() { + return babelHelpers.classPrivateFieldGet(this, _A); + } + + set a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); + } + + get b() { + return babelHelpers.classPrivateFieldGet(this, _B); + } + + set b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); + } + + get [_computedKey]() { + return babelHelpers.classPrivateFieldGet(this, _C); + } + + set [_computedKey](v) { + babelHelpers.classPrivateFieldSet(this, _C, v); + } + +} + +(() => { + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(Foo, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js new file mode 100644 index 0000000000..b0ec49e572 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js @@ -0,0 +1,58 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; + +var _a = /*#__PURE__*/new WeakMap(); + +var _b = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b2, + set: _set_b2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a2, + set: _set_a2 + }); + } + +} + +function _set_a2(v) { + _set_a(this, v); +} + +function _get_a2() { + _get_a(this); +} + +function _set_b2(v) { + _set_b(this, v); +} + +function _get_b2() { + _get_b(this); +} + +(() => { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 6, "a", function () { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + }, function (value) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, value); + }], [dec, 6, "b", function () { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + }, function (value) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, value); + }]], []); + + _initStatic(Foo); +})(); + +var _A = { + writable: true, + value: _init_a(Foo) +}; +var _B = { + writable: true, + value: _init_b(Foo, 123) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js new file mode 100644 index 0000000000..c5a6ac47eb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js @@ -0,0 +1,52 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initStatic; + +_dec = dec +_dec2 = dec +_computedKey = 'c' +_dec3 = dec + +class Foo { + static get a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + } + + static set a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + } + + static get b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + } + + static set b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + } + + static get [_computedKey]() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + } + + static set [_computedKey](v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + } + +} + +(() => { + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); + + _initStatic(Foo); +})(); + +var _A = { + writable: true, + value: _init_a(Foo) +}; +var _B = { + writable: true, + value: _init_b(Foo, 123) +}; +var _C = { + writable: true, + value: _init_computedKey(Foo, 456) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js new file mode 100644 index 0000000000..29d3fbd669 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js @@ -0,0 +1,45 @@ +var _A = /*#__PURE__*/new WeakMap(); + +var _a = /*#__PURE__*/new WeakMap(); + +var _B = /*#__PURE__*/new WeakMap(); + +var _b = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b, + set: _set_b + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: _set_a + }); + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: void 0 + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: 123 + }); + } + +} + +function _get_a() { + return babelHelpers.classPrivateFieldGet(this, _A); +} + +function _set_a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); +} + +function _get_b() { + return babelHelpers.classPrivateFieldGet(this, _B); +} + +function _set_b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js new file mode 100644 index 0000000000..6ec6f9255a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js @@ -0,0 +1,47 @@ +var _A = /*#__PURE__*/new WeakMap(); + +var _B = /*#__PURE__*/new WeakMap(); + +var _C = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: void 0 + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: 123 + }); + babelHelpers.classPrivateFieldInitSpec(this, _C, { + writable: true, + value: 456 + }); + } + + get a() { + return babelHelpers.classPrivateFieldGet(this, _A); + } + + set a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); + } + + get b() { + return babelHelpers.classPrivateFieldGet(this, _B); + } + + set b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); + } + + get 'c'() { + return babelHelpers.classPrivateFieldGet(this, _C); + } + + set 'c'(v) { + babelHelpers.classPrivateFieldSet(this, _C, v); + } + +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js new file mode 100644 index 0000000000..51de21b149 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js @@ -0,0 +1,34 @@ +class Foo {} + +function _get_a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); +} + +function _set_a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); +} + +function _get_b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); +} + +function _set_b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); +} + +var _b = { + get: _get_b, + set: _set_b +}; +var _a = { + get: _get_a, + set: _set_a +}; +var _A = { + writable: true, + value: void 0 +}; +var _B = { + writable: true, + value: 123 +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js new file mode 100644 index 0000000000..4fe37de40e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js @@ -0,0 +1,39 @@ +class Foo { + static get a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + } + + static set a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + } + + static get b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + } + + static set b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + } + + static get 'c'() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + } + + static set 'c'(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + } + +} + +var _A = { + writable: true, + value: void 0 +}; +var _B = { + writable: true, + value: 123 +}; +var _C = { + writable: true, + value: 456 +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js index 69673b7af6..c054a28803 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js @@ -1,59 +1,35 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; -var _A = /*#__PURE__*/new WeakMap(); - -var _a = /*#__PURE__*/new WeakMap(); - -var _B = /*#__PURE__*/new WeakMap(); - -var _b = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _b, { - get: _get_b2, - set: _set_b2 - }); - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: _get_a2, - set: _set_a2 - }); - babelHelpers.classPrivateFieldInitSpec(this, _A, { - writable: true, - value: (_initProto(this), _init_a(this)) - }); - babelHelpers.classPrivateFieldInitSpec(this, _B, { - writable: true, - value: _init_b(this, 123) - }); + static { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs(this, [[dec, 1, "a", function () { + return this.#A; + }, function (value) { + this.#A = value; + }], [dec, 1, "b", function () { + return this.#B; + }, function (value) { + this.#B = value; + }]], []); + } + #A = (_initProto(this), _init_a(this)); + + set #a(v) { + _set_a(this, v); + } + + get #a() { + _get_a(this); + } + + #B = _init_b(this, 123); + + set #b(v) { + _set_b(this, v); + } + + get #b() { + _get_b(this); } } - -function _set_a2(v) { - _set_a(this, v); -} - -function _get_a2() { - _get_a(this); -} - -function _set_b2(v) { - _set_b(this, v); -} - -function _get_b2() { - _get_b(this); -} - -(() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 1, "a", function () { - return babelHelpers.classPrivateFieldGet(this, _A); - }, function (value) { - babelHelpers.classPrivateFieldSet(this, _A, value); - }], [dec, 1, "b", function () { - return babelHelpers.classPrivateFieldGet(this, _B); - }, function (value) { - babelHelpers.classPrivateFieldSet(this, _B, value); - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js index 2a6057e84c..0fb94194b1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js @@ -5,54 +5,38 @@ _dec2 = dec _computedKey = 'c' _dec3 = dec -var _A = /*#__PURE__*/new WeakMap(); - -var _B = /*#__PURE__*/new WeakMap(); - -var _C = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _A, { - writable: true, - value: (_initProto(this), _init_a(this)) - }); - babelHelpers.classPrivateFieldInitSpec(this, _B, { - writable: true, - value: _init_b(this, 123) - }); - babelHelpers.classPrivateFieldInitSpec(this, _C, { - writable: true, - value: _init_computedKey(this, 456) - }); + static { + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(this, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); } + #A = (_initProto(this), _init_a(this)); get a() { - return babelHelpers.classPrivateFieldGet(this, _A); + return this.#A; } set a(v) { - babelHelpers.classPrivateFieldSet(this, _A, v); + this.#A = v; } + #B = _init_b(this, 123); + get b() { - return babelHelpers.classPrivateFieldGet(this, _B); + return this.#B; } set b(v) { - babelHelpers.classPrivateFieldSet(this, _B, v); + this.#B = v; } + #C = _init_computedKey(this, 456); + get [_computedKey]() { - return babelHelpers.classPrivateFieldGet(this, _C); + return this.#C; } set [_computedKey](v) { - babelHelpers.classPrivateFieldSet(this, _C, v); + this.#C = v; } } - -(() => { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(Foo, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js index b0ec49e572..ad30531a42 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js @@ -1,58 +1,38 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; -var _a = /*#__PURE__*/new WeakMap(); - -var _b = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _b, { - get: _get_b2, - set: _set_b2 - }); - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: _get_a2, - set: _set_a2 - }); + static { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs(this, [[dec, 6, "a", function () { + return this.#A; + }, function (value) { + this.#A = value; + }], [dec, 6, "b", function () { + return this.#B; + }, function (value) { + this.#B = value; + }]], []); + + _initStatic(this); + + } + static #A = _init_a(this); + + set #a(v) { + _set_a(this, v); + } + + get #a() { + _get_a(this); + } + + static #B = _init_b(this, 123); + + set #b(v) { + _set_b(this, v); + } + + get #b() { + _get_b(this); } } - -function _set_a2(v) { - _set_a(this, v); -} - -function _get_a2() { - _get_a(this); -} - -function _set_b2(v) { - _set_b(this, v); -} - -function _get_b2() { - _get_b(this); -} - -(() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 6, "a", function () { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); - }, function (value) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, value); - }], [dec, 6, "b", function () { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); - }, function (value) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, value); - }]], []); - - _initStatic(Foo); -})(); - -var _A = { - writable: true, - value: _init_a(Foo) -}; -var _B = { - writable: true, - value: _init_b(Foo, 123) -}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js index c5a6ac47eb..471adf36f9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js @@ -6,47 +6,40 @@ _computedKey = 'c' _dec3 = dec class Foo { + static { + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(this, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); + + _initStatic(this); + + } + static #A = _init_a(this); + static get a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + return this.#A; } static set a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + this.#A = v; } + static #B = _init_b(this, 123); + static get b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + return this.#B; } static set b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + this.#B = v; } + static #C = _init_computedKey(this, 456); + static get [_computedKey]() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + return this.#C; } static set [_computedKey](v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + this.#C = v; } } - -(() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); - - _initStatic(Foo); -})(); - -var _A = { - writable: true, - value: _init_a(Foo) -}; -var _B = { - writable: true, - value: _init_b(Foo, 123) -}; -var _C = { - writable: true, - value: _init_computedKey(Foo, 456) -}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js index 29d3fbd669..9eb7268e41 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js @@ -1,45 +1,22 @@ -var _A = /*#__PURE__*/new WeakMap(); - -var _a = /*#__PURE__*/new WeakMap(); - -var _B = /*#__PURE__*/new WeakMap(); - -var _b = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _b, { - get: _get_b, - set: _set_b - }); - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: _get_a, - set: _set_a - }); - babelHelpers.classPrivateFieldInitSpec(this, _A, { - writable: true, - value: void 0 - }); - babelHelpers.classPrivateFieldInitSpec(this, _B, { - writable: true, - value: 123 - }); + #A; + + get #a() { + return this.#A; + } + + set #a(v) { + this.#A = v; + } + + #B = 123; + + get #b() { + return this.#B; + } + + set #b(v) { + this.#B = v; } } - -function _get_a() { - return babelHelpers.classPrivateFieldGet(this, _A); -} - -function _set_a(v) { - babelHelpers.classPrivateFieldSet(this, _A, v); -} - -function _get_b() { - return babelHelpers.classPrivateFieldGet(this, _B); -} - -function _set_b(v) { - babelHelpers.classPrivateFieldSet(this, _B, v); -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js index 6ec6f9255a..f6269be736 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js @@ -1,47 +1,32 @@ -var _A = /*#__PURE__*/new WeakMap(); - -var _B = /*#__PURE__*/new WeakMap(); - -var _C = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _A, { - writable: true, - value: void 0 - }); - babelHelpers.classPrivateFieldInitSpec(this, _B, { - writable: true, - value: 123 - }); - babelHelpers.classPrivateFieldInitSpec(this, _C, { - writable: true, - value: 456 - }); - } + #A; get a() { - return babelHelpers.classPrivateFieldGet(this, _A); + return this.#A; } set a(v) { - babelHelpers.classPrivateFieldSet(this, _A, v); + this.#A = v; } + #B = 123; + get b() { - return babelHelpers.classPrivateFieldGet(this, _B); + return this.#B; } set b(v) { - babelHelpers.classPrivateFieldSet(this, _B, v); + this.#B = v; } + #C = 456; + get 'c'() { - return babelHelpers.classPrivateFieldGet(this, _C); + return this.#C; } set 'c'(v) { - babelHelpers.classPrivateFieldSet(this, _C, v); + this.#C = v; } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js index 51de21b149..04cc0ef030 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js @@ -1,34 +1,22 @@ -class Foo {} +class Foo { + static #A; + + static get #a() { + return this.#A; + } + + static set #a(v) { + this.#A = v; + } + + static #B = 123; + + static get #b() { + return this.#B; + } + + static set #b(v) { + this.#B = v; + } -function _get_a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); } - -function _set_a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); -} - -function _get_b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); -} - -function _set_b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); -} - -var _b = { - get: _get_b, - set: _set_b -}; -var _a = { - get: _get_a, - set: _set_a -}; -var _A = { - writable: true, - value: void 0 -}; -var _B = { - writable: true, - value: 123 -}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js index 4fe37de40e..187ad5214a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js @@ -1,39 +1,32 @@ class Foo { + static #A; + static get a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + return this.#A; } static set a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + this.#A = v; } + static #B = 123; + static get b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + return this.#B; } static set b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + this.#B = v; } + static #C = 456; + static get 'c'() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + return this.#C; } static set 'c'(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + this.#C = v; } } - -var _A = { - writable: true, - value: void 0 -}; -var _B = { - writable: true, - value: 123 -}; -var _C = { - writable: true, - value: 456 -}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-nested-constructor-expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-nested-constructor-expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-accessor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-accessor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-loose/super-in-private-method/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/expressions/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js new file mode 100644 index 0000000000..b0cce043af --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js @@ -0,0 +1,51 @@ +var _initClass, _A, _class, _temp, _initClass2, _C, _class2, _temp2, _initClass3, _D, _class3, _temp3, _initClass4, _decorated_class, _class4, _temp4, _initClass5, _G, _class5, _temp5, _initClass6, _decorated_class2, _class6, _temp6, _initClass7, _H, _class7, _temp7, _initClass8, _K, _class8, _temp8; + +const A = ((_temp = _class = class A {}, (() => { + [_A, _initClass] = babelHelpers.applyDecs(_class, [], [dec]); +})(), (() => { + _initClass(); +})(), _temp), _A); +const B = ((_temp2 = _class2 = class C {}, (() => { + [_C, _initClass2] = babelHelpers.applyDecs(_class2, [], [dec]); +})(), (() => { + _initClass2(); +})(), _temp2), _C); +const D = ((_temp3 = _class3 = class D {}, (() => { + [_D, _initClass3] = babelHelpers.applyDecs(_class3, [], [dec]); +})(), (() => { + _initClass3(); +})(), _temp3), _D); +const E = (((_temp4 = _class4 = class {}, (() => { + [_decorated_class, _initClass4] = babelHelpers.applyDecs(_class4, [], [dec]); +})(), (() => { + _initClass4(); +})(), _temp4), _decorated_class), 123); +const F = [((_temp5 = _class5 = class G {}, (() => { + [_G, _initClass5] = babelHelpers.applyDecs(_class5, [], [dec]); +})(), (() => { + _initClass5(); +})(), _temp5), _G), ((_temp6 = _class6 = class {}, (() => { + [_decorated_class2, _initClass6] = babelHelpers.applyDecs(_class6, [], [dec]); +})(), (() => { + _initClass6(); +})(), _temp6), _decorated_class2)]; +const H = ((_temp7 = _class7 = class H extends I {}, (() => { + [_H, _initClass7] = babelHelpers.applyDecs(_class7, [], [dec]); +})(), (() => { + _initClass7(); +})(), _temp7), _H); +const J = ((_temp8 = _class8 = class K extends L {}, (() => { + [_K, _initClass8] = babelHelpers.applyDecs(_class8, [], [dec]); +})(), (() => { + _initClass8(); +})(), _temp8), _K); + +function classFactory() { + var _initClass9, _decorated_class3, _class9, _temp9; + + return (_temp9 = _class9 = class {}, (() => { + [_decorated_class3, _initClass9] = babelHelpers.applyDecs(_class9, [], [dec]); + })(), (() => { + _initClass9(); + })(), _temp9), _decorated_class3; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/inheritance/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js new file mode 100644 index 0000000000..605270eade --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js @@ -0,0 +1,25 @@ +var _initClass, _initClass2; + +let _Bar; + +class Bar {} + +(() => { + [_Bar, _initClass] = babelHelpers.applyDecs(Bar, [], [dec1]); +})(); + +(() => { + _initClass(); +})(); + +let _Foo; + +class Foo extends _Bar {} + +(() => { + [_Foo, _initClass2] = babelHelpers.applyDecs(Foo, [], [dec2]); +})(); + +(() => { + _initClass2(); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/initializers/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js new file mode 100644 index 0000000000..a197b92f57 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js @@ -0,0 +1,33 @@ +var _initClass, _initClass2; + +let _Foo; + +class Foo {} + +(() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); +})(); + +babelHelpers.defineProperty(Foo, "field", 123); + +(() => { + _initClass(); +})(); + +let _Bar; + +class Bar extends _Foo {} + +(() => { + [_Bar, _initClass2] = babelHelpers.applyDecs(Bar, [], [dec]); +})(); + +(() => { + Bar.otherField = 456; +})(); + +babelHelpers.defineProperty(Bar, "field", 123); + +(() => { + _initClass2(); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/options.json similarity index 53% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/options.json index 18aa205580..69f3e599cf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/options.json @@ -3,6 +3,9 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ] + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement-with-expr/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js new file mode 100644 index 0000000000..f1f8cd9df3 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js @@ -0,0 +1,13 @@ +var _initClass, _Bar, _class, _temp; + +const Foo = ((_temp = _class = class Bar { + constructor() { + babelHelpers.defineProperty(this, "bar", new _Bar()); + } + +}, (() => { + [_Bar, _initClass] = babelHelpers.applyDecs(_class, [], [dec]); +})(), (() => { + _initClass(); +})(), _temp), _Bar); +const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js new file mode 100644 index 0000000000..4a26f8ccd8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js @@ -0,0 +1,17 @@ +var _initClass; + +let _Foo; + +class Foo {} + +(() => { + [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); +})(); + +babelHelpers.defineProperty(Foo, "foo", new _Foo()); + +(() => { + _initClass(); +})(); + +const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js index b0cce043af..146cdb17ca 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js @@ -1,51 +1,87 @@ -var _initClass, _A, _class, _temp, _initClass2, _C, _class2, _temp2, _initClass3, _D, _class3, _temp3, _initClass4, _decorated_class, _class4, _temp4, _initClass5, _G, _class5, _temp5, _initClass6, _decorated_class2, _class6, _temp6, _initClass7, _H, _class7, _temp7, _initClass8, _K, _class8, _temp8; +var _initClass, _A, _initClass2, _C, _initClass3, _D, _initClass4, _decorated_class, _initClass5, _G, _initClass6, _decorated_class2, _initClass7, _H, _initClass8, _K; -const A = ((_temp = _class = class A {}, (() => { - [_A, _initClass] = babelHelpers.applyDecs(_class, [], [dec]); -})(), (() => { - _initClass(); -})(), _temp), _A); -const B = ((_temp2 = _class2 = class C {}, (() => { - [_C, _initClass2] = babelHelpers.applyDecs(_class2, [], [dec]); -})(), (() => { - _initClass2(); -})(), _temp2), _C); -const D = ((_temp3 = _class3 = class D {}, (() => { - [_D, _initClass3] = babelHelpers.applyDecs(_class3, [], [dec]); -})(), (() => { - _initClass3(); -})(), _temp3), _D); -const E = (((_temp4 = _class4 = class {}, (() => { - [_decorated_class, _initClass4] = babelHelpers.applyDecs(_class4, [], [dec]); -})(), (() => { - _initClass4(); -})(), _temp4), _decorated_class), 123); -const F = [((_temp5 = _class5 = class G {}, (() => { - [_G, _initClass5] = babelHelpers.applyDecs(_class5, [], [dec]); -})(), (() => { - _initClass5(); -})(), _temp5), _G), ((_temp6 = _class6 = class {}, (() => { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs(_class6, [], [dec]); -})(), (() => { - _initClass6(); -})(), _temp6), _decorated_class2)]; -const H = ((_temp7 = _class7 = class H extends I {}, (() => { - [_H, _initClass7] = babelHelpers.applyDecs(_class7, [], [dec]); -})(), (() => { - _initClass7(); -})(), _temp7), _H); -const J = ((_temp8 = _class8 = class K extends L {}, (() => { - [_K, _initClass8] = babelHelpers.applyDecs(_class8, [], [dec]); -})(), (() => { - _initClass8(); -})(), _temp8), _K); +const A = (class A { + static { + [_A, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass(); + + } +}, _A); +const B = (class C { + static { + [_C, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass2(); + + } +}, _C); +const D = (class D { + static { + [_D, _initClass3] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass3(); + + } +}, _D); +const E = ((class { + static { + [_decorated_class, _initClass4] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass4(); + + } +}, _decorated_class), 123); +const F = [(class G { + static { + [_G, _initClass5] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass5(); + + } +}, _G), (class { + static { + [_decorated_class2, _initClass6] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass6(); + + } +}, _decorated_class2)]; +const H = (class H extends I { + static { + [_H, _initClass7] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass7(); + + } +}, _H); +const J = (class K extends L { + static { + [_K, _initClass8] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass8(); + + } +}, _K); function classFactory() { - var _initClass9, _decorated_class3, _class9, _temp9; + var _initClass9, _decorated_class3; - return (_temp9 = _class9 = class {}, (() => { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs(_class9, [], [dec]); - })(), (() => { - _initClass9(); - })(), _temp9), _decorated_class3; + return class { + static { + [_decorated_class3, _initClass9] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + _initClass9(); + + } + }, _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js index 605270eade..d7ea9b3516 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js @@ -2,24 +2,24 @@ var _initClass, _initClass2; let _Bar; -class Bar {} +class Bar { + static { + [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec1]); + } + static { + _initClass(); -(() => { - [_Bar, _initClass] = babelHelpers.applyDecs(Bar, [], [dec1]); -})(); - -(() => { - _initClass(); -})(); + } +} let _Foo; -class Foo extends _Bar {} +class Foo extends _Bar { + static { + [_Foo, _initClass2] = babelHelpers.applyDecs(this, [], [dec2]); + } + static { + _initClass2(); -(() => { - [_Foo, _initClass2] = babelHelpers.applyDecs(Foo, [], [dec2]); -})(); - -(() => { - _initClass2(); -})(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js index a197b92f57..c4b21cf992 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js @@ -2,32 +2,29 @@ var _initClass, _initClass2; let _Foo; -class Foo {} +class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + static field = 123; + static { + _initClass(); -(() => { - [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); -})(); - -babelHelpers.defineProperty(Foo, "field", 123); - -(() => { - _initClass(); -})(); + } +} let _Bar; -class Bar extends _Foo {} +class Bar extends _Foo { + static { + [_Bar, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); + } + static { + this.otherField = 456; + } + static field = 123; + static { + _initClass2(); -(() => { - [_Bar, _initClass2] = babelHelpers.applyDecs(Bar, [], [dec]); -})(); - -(() => { - Bar.otherField = 456; -})(); - -babelHelpers.defineProperty(Bar, "field", 123); - -(() => { - _initClass2(); -})(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js index f1f8cd9df3..4c37edebb1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js @@ -1,13 +1,13 @@ -var _initClass, _Bar, _class, _temp; +var _initClass, _Bar; -const Foo = ((_temp = _class = class Bar { - constructor() { - babelHelpers.defineProperty(this, "bar", new _Bar()); +const Foo = (class Bar { + static { + [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec]); } + bar = new _Bar(); + static { + _initClass(); -}, (() => { - [_Bar, _initClass] = babelHelpers.applyDecs(_class, [], [dec]); -})(), (() => { - _initClass(); -})(), _temp), _Bar); + } +}, _Bar); const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js index 4a26f8ccd8..046ba5f9a7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js @@ -2,16 +2,15 @@ var _initClass; let _Foo; -class Foo {} +class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); + } + static foo = new _Foo(); + static { + _initClass(); -(() => { - [_Foo, _initClass] = babelHelpers.applyDecs(Foo, [], [dec]); -})(); - -babelHelpers.defineProperty(Foo, "foo", new _Foo()); - -(() => { - _initClass(); -})(); + } +} const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-ast/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js similarity index 69% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-ast/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 9663aebaf7..a70d24de54 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -6,10 +6,6 @@ _computedKey2 = getKey() _dec2 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); - } - constructor(...args) { _initProto(this); } @@ -23,3 +19,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-value/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js similarity index 69% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-value/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 76d9f05cad..66e2ac318d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -6,10 +6,6 @@ _computedKey2 = getKeyJ() _dec2 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); - } - constructor(...args) { _initProto(this); } @@ -23,3 +19,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/method-and-field/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js new file mode 100644 index 0000000000..fe79aa6320 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js @@ -0,0 +1,16 @@ +var _init_a, _initProto; + +class Foo { + constructor() { + babelHelpers.defineProperty(this, "a", (_initProto(this), _init_a(this, 123))); + } + + a() { + return 1; + } + +} + +(() => { + [_init_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 0, "a"], [dec, 2, "a"]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/methods-with-same-key/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js similarity index 57% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/methods-with-same-key/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js index c4befb4def..6402e1341f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -1,10 +1,6 @@ var _initProto; class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a"], [dec, 2, "a"]], []); - } - constructor(...args) { _initProto(this); } @@ -18,3 +14,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/options.json similarity index 53% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/options.json index 18aa205580..69f3e599cf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/options.json @@ -3,6 +3,9 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ] + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js index a70d24de54..9663aebaf7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js @@ -6,6 +6,10 @@ _computedKey2 = getKey() _dec2 = dec class Foo { + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + } + constructor(...args) { _initProto(this); } @@ -19,7 +23,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js index 66e2ac318d..76d9f05cad 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js @@ -6,6 +6,10 @@ _computedKey2 = getKeyJ() _dec2 = dec class Foo { + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + } + constructor(...args) { _initProto(this); } @@ -19,7 +23,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js index fe79aa6320..cb04e3cc2e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js @@ -1,16 +1,13 @@ var _init_a, _initProto; class Foo { - constructor() { - babelHelpers.defineProperty(this, "a", (_initProto(this), _init_a(this, 123))); + static { + [_init_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 2, "a"]], []); } + a = (_initProto(this), _init_a(this, 123)); a() { return 1; } } - -(() => { - [_init_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 0, "a"], [dec, 2, "a"]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js index 6402e1341f..c4befb4def 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js @@ -1,6 +1,10 @@ var _initProto; class Foo { + static { + [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a"], [dec, 2, "a"]], []); + } + constructor(...args) { _initProto(this); } @@ -14,7 +18,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/options.json similarity index 53% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/options.json index 18aa205580..69f3e599cf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/options.json @@ -3,6 +3,9 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ] + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js new file mode 100644 index 0000000000..af27fce2d2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js @@ -0,0 +1,31 @@ +var _init_a, _init_b; + +var _a = /*#__PURE__*/new WeakMap(); + +var _b = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: _init_a(this) + }); + babelHelpers.classPrivateFieldInitSpec(this, _b, { + writable: true, + value: _init_b(this, 123) + }); + } + +} + +(() => { + [_init_a, _init_b] = babelHelpers.applyDecs(Foo, [[dec, 0, "a", function () { + return babelHelpers.classPrivateFieldGet(this, _a); + }, function (value) { + babelHelpers.classPrivateFieldSet(this, _a, value); + }], [dec, 0, "b", function () { + return babelHelpers.classPrivateFieldGet(this, _b); + }, function (value) { + babelHelpers.classPrivateFieldSet(this, _b, value); + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js new file mode 100644 index 0000000000..481926ddfe --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js @@ -0,0 +1,19 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; + +_dec = dec +_dec2 = dec +_computedKey = 'c' +_dec3 = dec + +class Foo { + constructor() { + babelHelpers.defineProperty(this, "a", _init_a(this)); + babelHelpers.defineProperty(this, "b", _init_b(this, 123)); + babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); + } + +} + +(() => { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js new file mode 100644 index 0000000000..ad619ac7d5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js @@ -0,0 +1,24 @@ +var _init_a, _init_b; + +class Foo {} + +(() => { + [_init_a, _init_b] = babelHelpers.applyDecs(Foo, [[dec, 5, "a", function () { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + }, function (value) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, value); + }], [dec, 5, "b", function () { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _b); + }, function (value) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _b, value); + }]], []); +})(); + +var _a = { + writable: true, + value: _init_a(Foo) +}; +var _b = { + writable: true, + value: _init_b(Foo, 123) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js new file mode 100644 index 0000000000..c5df831438 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js @@ -0,0 +1,16 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; + +_dec = dec +_dec2 = dec +_computedKey = 'c' +_dec3 = dec + +class Foo {} + +(() => { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); +})(); + +babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); +babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); +babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js index af27fce2d2..b72a6d971d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js @@ -1,31 +1,17 @@ var _init_a, _init_b; -var _a = /*#__PURE__*/new WeakMap(); - -var _b = /*#__PURE__*/new WeakMap(); - class Foo { - constructor() { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - writable: true, - value: _init_a(this) - }); - babelHelpers.classPrivateFieldInitSpec(this, _b, { - writable: true, - value: _init_b(this, 123) - }); + static { + [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 0, "a", function () { + return this.#a; + }, function (value) { + this.#a = value; + }], [dec, 0, "b", function () { + return this.#b; + }, function (value) { + this.#b = value; + }]], []); } - + #a = _init_a(this); + #b = _init_b(this, 123); } - -(() => { - [_init_a, _init_b] = babelHelpers.applyDecs(Foo, [[dec, 0, "a", function () { - return babelHelpers.classPrivateFieldGet(this, _a); - }, function (value) { - babelHelpers.classPrivateFieldSet(this, _a, value); - }], [dec, 0, "b", function () { - return babelHelpers.classPrivateFieldGet(this, _b); - }, function (value) { - babelHelpers.classPrivateFieldSet(this, _b, value); - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js index 481926ddfe..06c0434d04 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js @@ -6,14 +6,10 @@ _computedKey = 'c' _dec3 = dec class Foo { - constructor() { - babelHelpers.defineProperty(this, "a", _init_a(this)); - babelHelpers.defineProperty(this, "b", _init_b(this, 123)); - babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); + static { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); } - + a = _init_a(this); + b = _init_b(this, 123); + [_computedKey] = _init_computedKey(this, 456); } - -(() => { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js index ad619ac7d5..cb167ff192 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js @@ -1,24 +1,17 @@ var _init_a, _init_b; -class Foo {} - -(() => { - [_init_a, _init_b] = babelHelpers.applyDecs(Foo, [[dec, 5, "a", function () { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); - }, function (value) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, value); - }], [dec, 5, "b", function () { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _b); - }, function (value) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _b, value); - }]], []); -})(); - -var _a = { - writable: true, - value: _init_a(Foo) -}; -var _b = { - writable: true, - value: _init_b(Foo, 123) -}; +class Foo { + static { + [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 5, "a", function () { + return this.#a; + }, function (value) { + this.#a = value; + }], [dec, 5, "b", function () { + return this.#b; + }, function (value) { + this.#b = value; + }]], []); + } + static #a = _init_a(this); + static #b = _init_b(this, 123); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js index c5df831438..64af257455 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js @@ -5,12 +5,11 @@ _dec2 = dec _computedKey = 'c' _dec3 = dec -class Foo {} - -(() => { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); -})(); - -babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); -babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); -babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); +class Foo { + static { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); + } + static a = _init_a(this); + static b = _init_b(this, 123); + static [_computedKey] = _init_computedKey(this, 456); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/options.json similarity index 53% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/options.json index 18aa205580..69f3e599cf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/options.json @@ -3,6 +3,9 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ] + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js new file mode 100644 index 0000000000..32971ca073 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js @@ -0,0 +1,30 @@ +var _call_a, _initProto; + +var _a = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: void 0 + }); + babelHelpers.defineProperty(this, "value", 1); + + _initProto(this); + } + + getA() { + return babelHelpers.classPrivateFieldGet(this, _a); + } + +} + +function _get_a() { + return _call_a(this); +} + +(() => { + [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a", function () { + return this.value; + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js similarity index 60% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js index 756adf797e..0152dbf977 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js @@ -5,16 +5,12 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); - } - constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); } - value = 1; - get a() { return this.value; } @@ -24,3 +20,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js new file mode 100644 index 0000000000..e0262570f9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js @@ -0,0 +1,27 @@ +var _call_a, _initStatic; + +class Foo { + static getA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + } + +} + +function _get_a() { + return _call_a(this); +} + +var _a = { + get: _get_a, + set: void 0 +}; + +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a", function () { + return this.value; + }]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js similarity index 54% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js index 2ec6f560dc..68787d4327 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js @@ -5,14 +5,6 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); - - _initStatic(this); - - } - static value = 1; - static get a() { return this.value; } @@ -22,3 +14,11 @@ class Foo { } } + +(() => { + [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/options.json new file mode 100644 index 0000000000..69f3e599cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "proposal-decorators", + { "version": "2021-12", "decoratorsBeforeExport": false } + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js new file mode 100644 index 0000000000..71e95a6ee2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js @@ -0,0 +1,40 @@ +var _call_a, _call_a2, _initProto; + +var _a = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: _set_a + }); + babelHelpers.defineProperty(this, "value", 1); + + _initProto(this); + } + + getA() { + return babelHelpers.classPrivateFieldGet(this, _a); + } + + setA(v) { + babelHelpers.classPrivateFieldSet(this, _a, v); + } + +} + +function _get_a() { + return _call_a(this); +} + +function _set_a(v) { + _call_a2(this, v); +} + +(() => { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a", function () { + return this.value; + }], [dec, 4, "a", function (v) { + this.value = v; + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js similarity index 66% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js index 1a7c895145..a05760c5cf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js @@ -8,16 +8,12 @@ _computedKey2 = 'b' _dec4 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); - } - constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); } - value = 1; - get a() { return this.value; } @@ -35,3 +31,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js new file mode 100644 index 0000000000..e9ac78c2c9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js @@ -0,0 +1,37 @@ +var _call_a, _call_a2, _initStatic; + +class Foo { + static getA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + } + + static setA(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + } + +} + +function _get_a() { + return _call_a(this); +} + +function _set_a(v) { + _call_a2(this, v); +} + +var _a = { + get: _get_a, + set: _set_a +}; + +(() => { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a", function () { + return this.value; + }], [dec, 9, "a", function (v) { + this.value = v; + }]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js similarity index 63% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js index 367b9d127f..edcb11764a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js @@ -8,14 +8,6 @@ _computedKey2 = 'b' _dec4 = dec class Foo { - static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); - - _initStatic(this); - - } - static value = 1; - static get a() { return this.value; } @@ -33,3 +25,11 @@ class Foo { } } + +(() => { + [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js index 71e95a6ee2..bcf3cae917 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js @@ -1,40 +1,34 @@ var _call_a, _call_a2, _initProto; -var _a = /*#__PURE__*/new WeakMap(); - class Foo { - constructor(...args) { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: _get_a, - set: _set_a - }); - babelHelpers.defineProperty(this, "value", 1); + static { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { + return this.value; + }], [dec, 4, "a", function (v) { + this.value = v; + }]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + + get #a() { + return _call_a(this); + } + + set #a(v) { + _call_a2(this, v); + } + getA() { - return babelHelpers.classPrivateFieldGet(this, _a); + return this.#a; } setA(v) { - babelHelpers.classPrivateFieldSet(this, _a, v); + this.#a = v; } } - -function _get_a() { - return _call_a(this); -} - -function _set_a(v) { - _call_a2(this, v); -} - -(() => { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a", function () { - return this.value; - }], [dec, 4, "a", function (v) { - this.value = v; - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js index a05760c5cf..1a7c895145 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js @@ -8,12 +8,16 @@ _computedKey2 = 'b' _dec4 = dec class Foo { - constructor(...args) { - babelHelpers.defineProperty(this, "value", 1); + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + get a() { return this.value; } @@ -31,7 +35,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js index e9ac78c2c9..e897ea3cd1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js @@ -1,37 +1,32 @@ var _call_a, _call_a2, _initStatic; class Foo { + static { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { + return this.value; + }], [dec, 9, "a", function (v) { + this.value = v; + }]], []); + + _initStatic(this); + + } + static value = 1; + + static get #a() { + return _call_a(this); + } + + static set #a(v) { + _call_a2(this, v); + } + static getA() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + return this.#a; } static setA(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + this.#a = v; } } - -function _get_a() { - return _call_a(this); -} - -function _set_a(v) { - _call_a2(this, v); -} - -var _a = { - get: _get_a, - set: _set_a -}; - -(() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a", function () { - return this.value; - }], [dec, 9, "a", function (v) { - this.value = v; - }]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js index edcb11764a..367b9d127f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js @@ -8,6 +8,14 @@ _computedKey2 = 'b' _dec4 = dec class Foo { + static { + [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); + + _initStatic(this); + + } + static value = 1; + static get a() { return this.value; } @@ -25,11 +33,3 @@ class Foo { } } - -(() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js index 32971ca073..06ba2926bf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js @@ -1,30 +1,24 @@ var _call_a, _initProto; -var _a = /*#__PURE__*/new WeakMap(); - class Foo { - constructor(...args) { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: _get_a, - set: void 0 - }); - babelHelpers.defineProperty(this, "value", 1); + static { + [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { + return this.value; + }]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + + get #a() { + return _call_a(this); + } + getA() { - return babelHelpers.classPrivateFieldGet(this, _a); + return this.#a; } } - -function _get_a() { - return _call_a(this); -} - -(() => { - [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a", function () { - return this.value; - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js index 0152dbf977..756adf797e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js @@ -5,12 +5,16 @@ _computedKey = 'b' _dec2 = dec class Foo { - constructor(...args) { - babelHelpers.defineProperty(this, "value", 1); + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + get a() { return this.value; } @@ -20,7 +24,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js index e0262570f9..dc93a53137 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js @@ -1,27 +1,22 @@ var _call_a, _initStatic; class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { + return this.value; + }]], []); + + _initStatic(this); + + } + static value = 1; + + static get #a() { + return _call_a(this); + } + static getA() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + return this.#a; } } - -function _get_a() { - return _call_a(this); -} - -var _a = { - get: _get_a, - set: void 0 -}; - -(() => { - [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a", function () { - return this.value; - }]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js index 68787d4327..2ec6f560dc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js @@ -5,6 +5,14 @@ _computedKey = 'b' _dec2 = dec class Foo { + static { + [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); + + _initStatic(this); + + } + static value = 1; + static get a() { return this.value; } @@ -14,11 +22,3 @@ class Foo { } } - -(() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/class/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/class/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/class/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/getting-previously-set-metadata/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/getting-previously-set-metadata/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/inheritance-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/inheritance-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/inheritance-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/inheritance-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/inheritance-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/inheritance-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/inheritance-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/inheritance-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/non-symbol-keys/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/non-symbol-keys/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/non-symbol-keys/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/non-symbol-keys/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/options.json new file mode 100644 index 0000000000..69f3e599cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "proposal-decorators", + { "version": "2021-12", "decoratorsBeforeExport": false } + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/proto-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/proto-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/proto-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/proto-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/proto-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/proto-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/proto-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/proto-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/options.json new file mode 100644 index 0000000000..69f3e599cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "proposal-decorators", + { "version": "2021-12", "decoratorsBeforeExport": false } + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js new file mode 100644 index 0000000000..4e18191445 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js @@ -0,0 +1,26 @@ +var _call_a, _initProto; + +var _a = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: _call_a + }); + babelHelpers.defineProperty(this, "value", 1); + + _initProto(this); + } + + callA() { + return babelHelpers.classPrivateFieldGet(this, _a).call(this); + } + +} + +(() => { + [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, "a", function () { + return this.value; + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js similarity index 60% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js index efac40c1c3..1835a9fa35 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js @@ -5,16 +5,12 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); - } - constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); } - value = 1; - a() { return this.value; } @@ -24,3 +20,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js new file mode 100644 index 0000000000..3c147c920d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js @@ -0,0 +1,22 @@ +var _call_a, _initStatic; + +class Foo { + static callA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a).call(this); + } + +} + +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 7, "a", function () { + return this.value; + }]], []); + + _initStatic(Foo); +})(); + +var _a = { + writable: true, + value: _call_a +}; +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js similarity index 53% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js index 1ad76b111f..d1c334def5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js @@ -5,14 +5,6 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); - - _initStatic(this); - - } - static value = 1; - static a() { return this.value; } @@ -22,3 +14,11 @@ class Foo { } } + +(() => { + [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js index 4e18191445..6f76b6021b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js @@ -1,26 +1,21 @@ var _call_a, _initProto; -var _a = /*#__PURE__*/new WeakMap(); - class Foo { - constructor(...args) { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - writable: true, - value: _call_a - }); - babelHelpers.defineProperty(this, "value", 1); + static { + [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a", function () { + return this.value; + }]], []); + } + constructor(...args) { _initProto(this); } + #a = _call_a; + value = 1; + callA() { - return babelHelpers.classPrivateFieldGet(this, _a).call(this); + return this.#a(); } } - -(() => { - [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, "a", function () { - return this.value; - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js index 1835a9fa35..efac40c1c3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js @@ -5,12 +5,16 @@ _computedKey = 'b' _dec2 = dec class Foo { - constructor(...args) { - babelHelpers.defineProperty(this, "value", 1); + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + a() { return this.value; } @@ -20,7 +24,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js index 3c147c920d..6b807803ef 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js @@ -1,22 +1,19 @@ var _call_a, _initStatic; class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 7, "a", function () { + return this.value; + }]], []); + + _initStatic(this); + + } + static #a = _call_a; + static value = 1; + static callA() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a).call(this); + return this.#a(); } } - -(() => { - [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 7, "a", function () { - return this.value; - }]], []); - - _initStatic(Foo); -})(); - -var _a = { - writable: true, - value: _call_a -}; -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js index d1c334def5..1ad76b111f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js @@ -5,6 +5,14 @@ _computedKey = 'b' _dec2 = dec class Foo { + static { + [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); + + _initStatic(this); + + } + static value = 1; + static a() { return this.value; } @@ -14,11 +22,3 @@ class Foo { } } - -(() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initializer-timing/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initializer-timing/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initializer-timing/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initializer-timing/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/options.json new file mode 100644 index 0000000000..69f3e599cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "proposal-decorators", + { "version": "2021-12", "decoratorsBeforeExport": false } + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/valid-expression-formats/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js new file mode 100644 index 0000000000..79b845170b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js @@ -0,0 +1,40 @@ +var _initClass, _initProto; + +let _Foo; + +var _a = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: void 0 + }); + + _initProto(this); + } + + method() {} + + makeClass() { + var _init_bar, _class, _temp; + + return _temp = _class = class Nested { + constructor() { + babelHelpers.defineProperty(this, "bar", _init_bar(this)); + } + + }, (() => { + [_init_bar] = babelHelpers.applyDecs(_class, [[babelHelpers.classPrivateFieldGet(_class, _a), 0, "bar"]], []); + })(), _temp; + } + +} + +(() => { + [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(Foo, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); +})(); + +(() => { + _initClass(); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/private-keys-in-enclosing-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/private-keys-in-enclosing-class/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/private-keys-in-enclosing-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/private-keys-in-enclosing-class/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-array-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-array-pattern/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-array-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-array-pattern/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-for-of/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-for-of/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-for-of/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-for-of/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-object-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-object-pattern/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-object-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-object-pattern/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-rest/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-rest/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-rest/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-rest/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-update/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-update/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-update/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method-via-update/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/setting-private-method/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-nested-constructor-expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-nested-constructor-expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-accessor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-accessor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/super-in-private-method/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js index 79b845170b..5490137a90 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js @@ -2,39 +2,32 @@ var _initClass, _initProto; let _Foo; -var _a = /*#__PURE__*/new WeakMap(); - class Foo { - constructor(...args) { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - writable: true, - value: void 0 - }); + static { + [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(this, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); + } + constructor(...args) { _initProto(this); } + #a; + method() {} makeClass() { - var _init_bar, _class, _temp; + var _init_bar; - return _temp = _class = class Nested { - constructor() { - babelHelpers.defineProperty(this, "bar", _init_bar(this)); + return class Nested { + static { + [_init_bar] = babelHelpers.applyDecs(this, [[this.#a, 0, "bar"]], []); } - - }, (() => { - [_init_bar] = babelHelpers.applyDecs(_class, [[babelHelpers.classPrivateFieldGet(_class, _a), 0, "bar"]], []); - })(), _temp; + bar = _init_bar(this); + }; } + static { + _initClass(); + + } } - -(() => { - [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(Foo, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); -})(); - -(() => { - _initClass(); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/options.json new file mode 100644 index 0000000000..69f3e599cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "proposal-decorators", + { "version": "2021-12", "decoratorsBeforeExport": false } + ], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js new file mode 100644 index 0000000000..5d0ad516b8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js @@ -0,0 +1,30 @@ +var _call_a, _initProto; + +var _a = /*#__PURE__*/new WeakMap(); + +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: void 0, + set: _set_a + }); + babelHelpers.defineProperty(this, "value", 1); + + _initProto(this); + } + + setA(v) { + babelHelpers.classPrivateFieldSet(this, _a, v); + } + +} + +function _set_a(v) { + _call_a(this, v); +} + +(() => { + [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 4, "a", function (v) { + return this.value = v; + }]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js similarity index 61% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js index ad6f2edce7..2562976323 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js @@ -5,16 +5,12 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); - } - constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); } - value = 1; - set a(v) { return this.value = v; } @@ -24,3 +20,7 @@ class Foo { } } + +(() => { + [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); +})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js new file mode 100644 index 0000000000..45e47a5717 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js @@ -0,0 +1,27 @@ +var _call_a, _initStatic; + +class Foo { + static setA(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + } + +} + +function _set_a(v) { + _call_a(this, v); +} + +var _a = { + get: void 0, + set: _set_a +}; + +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 9, "a", function (v) { + return this.value = v; + }]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js similarity index 55% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js index 230ee2bc8a..e890b8fb8d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js @@ -5,14 +5,6 @@ _computedKey = 'b' _dec2 = dec class Foo { - static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); - - _initStatic(this); - - } - static value = 1; - static set a(v) { return this.value = v; } @@ -22,3 +14,11 @@ class Foo { } } + +(() => { + [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); + + _initStatic(Foo); +})(); + +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/options.json index 69f3e599cf..18aa205580 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/options.json @@ -3,9 +3,6 @@ [ "proposal-decorators", { "version": "2021-12", "decoratorsBeforeExport": false } - ], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" + ] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js index 5d0ad516b8..a1b2e04ab8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js @@ -1,30 +1,24 @@ var _call_a, _initProto; -var _a = /*#__PURE__*/new WeakMap(); - class Foo { - constructor(...args) { - babelHelpers.classPrivateFieldInitSpec(this, _a, { - get: void 0, - set: _set_a - }); - babelHelpers.defineProperty(this, "value", 1); + static { + [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 4, "a", function (v) { + return this.value = v; + }]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + + set #a(v) { + _call_a(this, v); + } + setA(v) { - babelHelpers.classPrivateFieldSet(this, _a, v); + this.#a = v; } } - -function _set_a(v) { - _call_a(this, v); -} - -(() => { - [_call_a, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 4, "a", function (v) { - return this.value = v; - }]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js index 2562976323..ad6f2edce7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js @@ -5,12 +5,16 @@ _computedKey = 'b' _dec2 = dec class Foo { - constructor(...args) { - babelHelpers.defineProperty(this, "value", 1); + static { + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); + } + constructor(...args) { _initProto(this); } + value = 1; + set a(v) { return this.value = v; } @@ -20,7 +24,3 @@ class Foo { } } - -(() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); -})(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js index 45e47a5717..6bcadc0cc5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js @@ -1,27 +1,22 @@ var _call_a, _initStatic; class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 9, "a", function (v) { + return this.value = v; + }]], []); + + _initStatic(this); + + } + static value = 1; + + static set #a(v) { + _call_a(this, v); + } + static setA(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + this.#a = v; } } - -function _set_a(v) { - _call_a(this, v); -} - -var _a = { - get: void 0, - set: _set_a -}; - -(() => { - [_call_a, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 9, "a", function (v) { - return this.value = v; - }]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js index e890b8fb8d..230ee2bc8a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js @@ -5,6 +5,14 @@ _computedKey = 'b' _dec2 = dec class Foo { + static { + [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); + + _initStatic(this); + + } + static value = 1; + static set a(v) { return this.value = v; } @@ -14,11 +22,3 @@ class Foo { } } - -(() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); - - _initStatic(Foo); -})(); - -babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/private/output.js deleted file mode 100644 index c054a28803..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/private/output.js +++ /dev/null @@ -1,35 +0,0 @@ -var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; - -class Foo { - static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs(this, [[dec, 1, "a", function () { - return this.#A; - }, function (value) { - this.#A = value; - }], [dec, 1, "b", function () { - return this.#B; - }, function (value) { - this.#B = value; - }]], []); - } - #A = (_initProto(this), _init_a(this)); - - set #a(v) { - _set_a(this, v); - } - - get #a() { - _get_a(this); - } - - #B = _init_b(this, 123); - - set #b(v) { - _set_b(this, v); - } - - get #b() { - _get_b(this); - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/public/output.js deleted file mode 100644 index 0fb94194b1..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/public/output.js +++ /dev/null @@ -1,42 +0,0 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initProto; - -_dec = dec -_dec2 = dec -_computedKey = 'c' -_dec3 = dec - -class Foo { - static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(this, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); - } - #A = (_initProto(this), _init_a(this)); - - get a() { - return this.#A; - } - - set a(v) { - this.#A = v; - } - - #B = _init_b(this, 123); - - get b() { - return this.#B; - } - - set b(v) { - this.#B = v; - } - - #C = _init_computedKey(this, 456); - - get [_computedKey]() { - return this.#C; - } - - set [_computedKey](v) { - this.#C = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-private/output.js deleted file mode 100644 index ad30531a42..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-private/output.js +++ /dev/null @@ -1,38 +0,0 @@ -var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; - -class Foo { - static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs(this, [[dec, 6, "a", function () { - return this.#A; - }, function (value) { - this.#A = value; - }], [dec, 6, "b", function () { - return this.#B; - }, function (value) { - this.#B = value; - }]], []); - - _initStatic(this); - - } - static #A = _init_a(this); - - set #a(v) { - _set_a(this, v); - } - - get #a() { - _get_a(this); - } - - static #B = _init_b(this, 123); - - set #b(v) { - _set_b(this, v); - } - - get #b() { - _get_b(this); - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-public/output.js deleted file mode 100644 index 471adf36f9..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/static-public/output.js +++ /dev/null @@ -1,45 +0,0 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initStatic; - -_dec = dec -_dec2 = dec -_computedKey = 'c' -_dec3 = dec - -class Foo { - static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(this, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); - - _initStatic(this); - - } - static #A = _init_a(this); - - static get a() { - return this.#A; - } - - static set a(v) { - this.#A = v; - } - - static #B = _init_b(this, 123); - - static get b() { - return this.#B; - } - - static set b(v) { - this.#B = v; - } - - static #C = _init_computedKey(this, 456); - - static get [_computedKey]() { - return this.#C; - } - - static set [_computedKey](v) { - this.#C = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-private/output.js deleted file mode 100644 index 9eb7268e41..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-private/output.js +++ /dev/null @@ -1,22 +0,0 @@ -class Foo { - #A; - - get #a() { - return this.#A; - } - - set #a(v) { - this.#A = v; - } - - #B = 123; - - get #b() { - return this.#B; - } - - set #b(v) { - this.#B = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-public/output.js deleted file mode 100644 index f6269be736..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-public/output.js +++ /dev/null @@ -1,32 +0,0 @@ -class Foo { - #A; - - get a() { - return this.#A; - } - - set a(v) { - this.#A = v; - } - - #B = 123; - - get b() { - return this.#B; - } - - set b(v) { - this.#B = v; - } - - #C = 456; - - get 'c'() { - return this.#C; - } - - set 'c'(v) { - this.#C = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-private/output.js deleted file mode 100644 index 04cc0ef030..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-private/output.js +++ /dev/null @@ -1,22 +0,0 @@ -class Foo { - static #A; - - static get #a() { - return this.#A; - } - - static set #a(v) { - this.#A = v; - } - - static #B = 123; - - static get #b() { - return this.#B; - } - - static set #b(v) { - this.#B = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-public/output.js deleted file mode 100644 index 187ad5214a..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-accessors/undecorated-static-public/output.js +++ /dev/null @@ -1,32 +0,0 @@ -class Foo { - static #A; - - static get a() { - return this.#A; - } - - static set a(v) { - this.#A = v; - } - - static #B = 123; - - static get b() { - return this.#B; - } - - static set b(v) { - this.#B = v; - } - - static #C = 456; - - static get 'c'() { - return this.#C; - } - - static set 'c'(v) { - this.#C = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/expressions/output.js deleted file mode 100644 index 146cdb17ca..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/expressions/output.js +++ /dev/null @@ -1,87 +0,0 @@ -var _initClass, _A, _initClass2, _C, _initClass3, _D, _initClass4, _decorated_class, _initClass5, _G, _initClass6, _decorated_class2, _initClass7, _H, _initClass8, _K; - -const A = (class A { - static { - [_A, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass(); - - } -}, _A); -const B = (class C { - static { - [_C, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass2(); - - } -}, _C); -const D = (class D { - static { - [_D, _initClass3] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass3(); - - } -}, _D); -const E = ((class { - static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass4(); - - } -}, _decorated_class), 123); -const F = [(class G { - static { - [_G, _initClass5] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass5(); - - } -}, _G), (class { - static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass6(); - - } -}, _decorated_class2)]; -const H = (class H extends I { - static { - [_H, _initClass7] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass7(); - - } -}, _H); -const J = (class K extends L { - static { - [_K, _initClass8] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass8(); - - } -}, _K); - -function classFactory() { - var _initClass9, _decorated_class3; - - return class { - static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - _initClass9(); - - } - }, _decorated_class3; -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/inheritance/output.js deleted file mode 100644 index d7ea9b3516..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/inheritance/output.js +++ /dev/null @@ -1,25 +0,0 @@ -var _initClass, _initClass2; - -let _Bar; - -class Bar { - static { - [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec1]); - } - static { - _initClass(); - - } -} - -let _Foo; - -class Foo extends _Bar { - static { - [_Foo, _initClass2] = babelHelpers.applyDecs(this, [], [dec2]); - } - static { - _initClass2(); - - } -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/initializers/output.js deleted file mode 100644 index c4b21cf992..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/initializers/output.js +++ /dev/null @@ -1,30 +0,0 @@ -var _initClass, _initClass2; - -let _Foo; - -class Foo { - static { - [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - static field = 123; - static { - _initClass(); - - } -} - -let _Bar; - -class Bar extends _Foo { - static { - [_Bar, _initClass2] = babelHelpers.applyDecs(this, [], [dec]); - } - static { - this.otherField = 456; - } - static field = 123; - static { - _initClass2(); - - } -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement-with-expr/output.js deleted file mode 100644 index 4c37edebb1..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement-with-expr/output.js +++ /dev/null @@ -1,13 +0,0 @@ -var _initClass, _Bar; - -const Foo = (class Bar { - static { - [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - bar = new _Bar(); - static { - _initClass(); - - } -}, _Bar); -const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement/output.js deleted file mode 100644 index 046ba5f9a7..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-classes/replacement/output.js +++ /dev/null @@ -1,16 +0,0 @@ -var _initClass; - -let _Foo; - -class Foo { - static { - [_Foo, _initClass] = babelHelpers.applyDecs(this, [], [dec]); - } - static foo = new _Foo(); - static { - _initClass(); - - } -} - -const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/method-and-field/output.js deleted file mode 100644 index cb04e3cc2e..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-duplicated-keys/method-and-field/output.js +++ /dev/null @@ -1,13 +0,0 @@ -var _init_a, _initProto; - -class Foo { - static { - [_init_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 2, "a"]], []); - } - a = (_initProto(this), _init_a(this, 123)); - - a() { - return 1; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/private/output.js deleted file mode 100644 index b72a6d971d..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/private/output.js +++ /dev/null @@ -1,17 +0,0 @@ -var _init_a, _init_b; - -class Foo { - static { - [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 0, "a", function () { - return this.#a; - }, function (value) { - this.#a = value; - }], [dec, 0, "b", function () { - return this.#b; - }, function (value) { - this.#b = value; - }]], []); - } - #a = _init_a(this); - #b = _init_b(this, 123); -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/public/output.js deleted file mode 100644 index 06c0434d04..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/public/output.js +++ /dev/null @@ -1,15 +0,0 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; - -_dec = dec -_dec2 = dec -_computedKey = 'c' -_dec3 = dec - -class Foo { - static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); - } - a = _init_a(this); - b = _init_b(this, 123); - [_computedKey] = _init_computedKey(this, 456); -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-private/output.js deleted file mode 100644 index cb167ff192..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-private/output.js +++ /dev/null @@ -1,17 +0,0 @@ -var _init_a, _init_b; - -class Foo { - static { - [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 5, "a", function () { - return this.#a; - }, function (value) { - this.#a = value; - }], [dec, 5, "b", function () { - return this.#b; - }, function (value) { - this.#b = value; - }]], []); - } - static #a = _init_a(this); - static #b = _init_b(this, 123); -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-public/output.js deleted file mode 100644 index 64af257455..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-fields/static-public/output.js +++ /dev/null @@ -1,15 +0,0 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; - -_dec = dec -_dec2 = dec -_computedKey = 'c' -_dec3 = dec - -class Foo { - static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); - } - static a = _init_a(this); - static b = _init_b(this, 123); - static [_computedKey] = _init_computedKey(this, 456); -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/options.json deleted file mode 100644 index 18aa205580..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - [ - "proposal-decorators", - { "version": "2021-12", "decoratorsBeforeExport": false } - ] - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/private/output.js deleted file mode 100644 index bcf3cae917..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/private/output.js +++ /dev/null @@ -1,34 +0,0 @@ -var _call_a, _call_a2, _initProto; - -class Foo { - static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { - return this.value; - }], [dec, 4, "a", function (v) { - this.value = v; - }]], []); - } - - constructor(...args) { - _initProto(this); - } - - value = 1; - - get #a() { - return _call_a(this); - } - - set #a(v) { - _call_a2(this, v); - } - - getA() { - return this.#a; - } - - setA(v) { - this.#a = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-private/output.js deleted file mode 100644 index e897ea3cd1..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters-and-setters/static-private/output.js +++ /dev/null @@ -1,32 +0,0 @@ -var _call_a, _call_a2, _initStatic; - -class Foo { - static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { - return this.value; - }], [dec, 9, "a", function (v) { - this.value = v; - }]], []); - - _initStatic(this); - - } - static value = 1; - - static get #a() { - return _call_a(this); - } - - static set #a(v) { - _call_a2(this, v); - } - - static getA() { - return this.#a; - } - - static setA(v) { - this.#a = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/options.json deleted file mode 100644 index 18aa205580..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - [ - "proposal-decorators", - { "version": "2021-12", "decoratorsBeforeExport": false } - ] - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/private/output.js deleted file mode 100644 index 06ba2926bf..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/private/output.js +++ /dev/null @@ -1,24 +0,0 @@ -var _call_a, _initProto; - -class Foo { - static { - [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { - return this.value; - }]], []); - } - - constructor(...args) { - _initProto(this); - } - - value = 1; - - get #a() { - return _call_a(this); - } - - getA() { - return this.#a; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-private/output.js deleted file mode 100644 index dc93a53137..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-getters/static-private/output.js +++ /dev/null @@ -1,22 +0,0 @@ -var _call_a, _initStatic; - -class Foo { - static { - [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { - return this.value; - }]], []); - - _initStatic(this); - - } - static value = 1; - - static get #a() { - return _call_a(this); - } - - static getA() { - return this.#a; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/options.json deleted file mode 100644 index 18aa205580..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - [ - "proposal-decorators", - { "version": "2021-12", "decoratorsBeforeExport": false } - ] - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/private/output.js deleted file mode 100644 index 6f76b6021b..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/private/output.js +++ /dev/null @@ -1,21 +0,0 @@ -var _call_a, _initProto; - -class Foo { - static { - [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a", function () { - return this.value; - }]], []); - } - - constructor(...args) { - _initProto(this); - } - - #a = _call_a; - value = 1; - - callA() { - return this.#a(); - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-private/output.js deleted file mode 100644 index 6b807803ef..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-methods/static-private/output.js +++ /dev/null @@ -1,19 +0,0 @@ -var _call_a, _initStatic; - -class Foo { - static { - [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 7, "a", function () { - return this.value; - }]], []); - - _initStatic(this); - - } - static #a = _call_a; - static value = 1; - - static callA() { - return this.#a(); - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/options.json deleted file mode 100644 index 18aa205580..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - [ - "proposal-decorators", - { "version": "2021-12", "decoratorsBeforeExport": false } - ] - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/valid-expression-formats/output.js deleted file mode 100644 index 5490137a90..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-misc/valid-expression-formats/output.js +++ /dev/null @@ -1,33 +0,0 @@ -var _initClass, _initProto; - -let _Foo; - -class Foo { - static { - [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(this, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); - } - - constructor(...args) { - _initProto(this); - } - - #a; - - method() {} - - makeClass() { - var _init_bar; - - return class Nested { - static { - [_init_bar] = babelHelpers.applyDecs(this, [[this.#a, 0, "bar"]], []); - } - bar = _init_bar(this); - }; - } - - static { - _initClass(); - - } -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/options.json deleted file mode 100644 index 18aa205580..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - [ - "proposal-decorators", - { "version": "2021-12", "decoratorsBeforeExport": false } - ] - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/private/output.js deleted file mode 100644 index a1b2e04ab8..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/private/output.js +++ /dev/null @@ -1,24 +0,0 @@ -var _call_a, _initProto; - -class Foo { - static { - [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 4, "a", function (v) { - return this.value = v; - }]], []); - } - - constructor(...args) { - _initProto(this); - } - - value = 1; - - set #a(v) { - _call_a(this, v); - } - - setA(v) { - this.#a = v; - } - -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-private/output.js deleted file mode 100644 index 6bcadc0cc5..0000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-transform-only-setters/static-private/output.js +++ /dev/null @@ -1,22 +0,0 @@ -var _call_a, _initStatic; - -class Foo { - static { - [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 9, "a", function (v) { - return this.value = v; - }]], []); - - _initStatic(this); - - } - static value = 1; - - static set #a(v) { - _call_a(this, v); - } - - static setA(v) { - this.#a = v; - } - -}