From 482271ca94c34312a297c3b257f04f894766a611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 24 Jan 2024 17:49:53 -0500 Subject: [PATCH 1/2] Fix: inject fieldInitializerAssignments in the first available field Previously they are injected at the first _decorated_ field, which is probably an oversight. --- .../src/decorators.ts | 26 +-- .../method-initializers-field-value/exec.js | 153 ++++++++++++++++++ .../method-initializers-field-value/exec.js | 153 ++++++++++++++++++ 3 files changed, 319 insertions(+), 13 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/method-initializers-field-value/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/method-initializers-field-value/exec.js diff --git a/packages/babel-helper-create-class-features-plugin/src/decorators.ts b/packages/babel-helper-create-class-features-plugin/src/decorators.ts index 8e7f9caa397e..b79fc6d7ac20 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -1138,20 +1138,20 @@ function transformClass( if (element.node) { element.node.decorators = null; } + } - if ( - fieldInitializerAssignments.length > 0 && - !isStatic && - (kind === FIELD || kind === ACCESSOR) - ) { - prependExpressionsToFieldInitializer( - fieldInitializerAssignments, - element as NodePath< - t.ClassProperty | t.ClassPrivateProperty | t.ClassAccessorProperty - >, - ); - fieldInitializerAssignments = []; - } + if ( + fieldInitializerAssignments.length > 0 && + !isStatic && + (kind === FIELD || kind === ACCESSOR) + ) { + prependExpressionsToFieldInitializer( + fieldInitializerAssignments, + element as NodePath< + t.ClassProperty | t.ClassPrivateProperty | t.ClassAccessorProperty + >, + ); + fieldInitializerAssignments = []; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/method-initializers-field-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/method-initializers-field-value/exec.js new file mode 100644 index 000000000000..c1aacb35624e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/method-initializers-field-value/exec.js @@ -0,0 +1,153 @@ +{ + const log = []; + const methodDec1 = (fn, ctxMethod) => { + log.push("m2"); + ctxMethod.addInitializer(() => log.push("m5")); + ctxMethod.addInitializer(() => log.push("m6")); + }; + const methodDec2 = (fn, ctxMethod) => { + log.push("m1"); + ctxMethod.addInitializer(() => log.push("m3")); + ctxMethod.addInitializer(() => log.push("m4")); + }; + const getterDec1 = (fn, ctxGetter) => { + log.push("g2"); + ctxGetter.addInitializer(() => log.push("g5")); + ctxGetter.addInitializer(() => log.push("g6")); + }; + const getterDec2 = (fn, ctxGetter) => { + log.push("g1"); + ctxGetter.addInitializer(() => log.push("g3")); + ctxGetter.addInitializer(() => log.push("g4")); + }; + const setterDec1 = (fn, ctxSetter) => { + log.push("s2"); + ctxSetter.addInitializer(() => log.push("s5")); + ctxSetter.addInitializer(() => log.push("s6")); + }; + const setterDec2 = (fn, ctxSetter) => { + log.push("s1"); + ctxSetter.addInitializer(() => log.push("s3")); + ctxSetter.addInitializer(() => log.push("s4")); + }; + log.push("start"); + class Foo extends (log.push("extends"), Object) { + static { + log.push("static:start"); + } + constructor() { + log.push("ctor:start"); + super(); + log.push("ctor:end"); + } + @methodDec1 + @methodDec2 + method() {} + + field = log.push("f"); + + @getterDec1 + @getterDec2 + get getter() { + return; + } + @setterDec1 + @setterDec2 + set setter(x) {} + static { + log.push("static:end"); + } + } + log.push("after"); + new Foo(); + log.push("end"); + expect(log + "").toEqual( + "start,extends," + + "m1,m2,g1,g2,s1,s2," + // For each element e of instanceElements if e.[[Kind]] is not field + "static:start," + // staticElements + "static:end," + // staticElements + "after," + + "ctor:start," + + "m3,m4,m5,m6,g3,g4,g5,g6,s3,s4,s5,s6," + // instanceExtraInitializers + "f," + // InitializeFieldOrAccessor + "ctor:end," + + "end", + ); +} + +{ + const log = []; + const methodDec1 = (fn, ctxMethod) => { + log.push("m2"); + ctxMethod.addInitializer(() => log.push("m5")); + ctxMethod.addInitializer(() => log.push("m6")); + }; + const methodDec2 = (fn, ctxMethod) => { + log.push("m1"); + ctxMethod.addInitializer(() => log.push("m3")); + ctxMethod.addInitializer(() => log.push("m4")); + }; + const getterDec1 = (fn, ctxGetter) => { + log.push("g2"); + ctxGetter.addInitializer(() => log.push("g5")); + ctxGetter.addInitializer(() => log.push("g6")); + }; + const getterDec2 = (fn, ctxGetter) => { + log.push("g1"); + ctxGetter.addInitializer(() => log.push("g3")); + ctxGetter.addInitializer(() => log.push("g4")); + }; + const setterDec1 = (fn, ctxSetter) => { + log.push("s2"); + ctxSetter.addInitializer(() => log.push("s5")); + ctxSetter.addInitializer(() => log.push("s6")); + }; + const setterDec2 = (fn, ctxSetter) => { + log.push("s1"); + ctxSetter.addInitializer(() => log.push("s3")); + ctxSetter.addInitializer(() => log.push("s4")); + }; + log.push("start"); + class Foo extends (log.push("extends"), Object) { + static { + log.push("static:start"); + } + constructor() { + log.push("ctor:start"); + super(); + log.push("ctor:end"); + } + @methodDec1 + @methodDec2 + method() {} + + accessor field = log.push("a"); + + @getterDec1 + @getterDec2 + get getter() { + return; + } + @setterDec1 + @setterDec2 + set setter(x) {} + static { + log.push("static:end"); + } + } + log.push("after"); + new Foo(); + log.push("end"); + expect(log + "").toEqual( + "start,extends," + + "m1,m2,g1,g2,s1,s2," + // For each element e of instanceElements if e.[[Kind]] is not field + "static:start," + // staticElements + "static:end," + // staticElements + "after," + + "ctor:start," + + "m3,m4,m5,m6,g3,g4,g5,g6,s3,s4,s5,s6," + // instanceExtraInitializers + "a," + // InitializeFieldOrAccessor + "ctor:end," + + "end", + ); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/method-initializers-field-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/method-initializers-field-value/exec.js new file mode 100644 index 000000000000..c1aacb35624e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/method-initializers-field-value/exec.js @@ -0,0 +1,153 @@ +{ + const log = []; + const methodDec1 = (fn, ctxMethod) => { + log.push("m2"); + ctxMethod.addInitializer(() => log.push("m5")); + ctxMethod.addInitializer(() => log.push("m6")); + }; + const methodDec2 = (fn, ctxMethod) => { + log.push("m1"); + ctxMethod.addInitializer(() => log.push("m3")); + ctxMethod.addInitializer(() => log.push("m4")); + }; + const getterDec1 = (fn, ctxGetter) => { + log.push("g2"); + ctxGetter.addInitializer(() => log.push("g5")); + ctxGetter.addInitializer(() => log.push("g6")); + }; + const getterDec2 = (fn, ctxGetter) => { + log.push("g1"); + ctxGetter.addInitializer(() => log.push("g3")); + ctxGetter.addInitializer(() => log.push("g4")); + }; + const setterDec1 = (fn, ctxSetter) => { + log.push("s2"); + ctxSetter.addInitializer(() => log.push("s5")); + ctxSetter.addInitializer(() => log.push("s6")); + }; + const setterDec2 = (fn, ctxSetter) => { + log.push("s1"); + ctxSetter.addInitializer(() => log.push("s3")); + ctxSetter.addInitializer(() => log.push("s4")); + }; + log.push("start"); + class Foo extends (log.push("extends"), Object) { + static { + log.push("static:start"); + } + constructor() { + log.push("ctor:start"); + super(); + log.push("ctor:end"); + } + @methodDec1 + @methodDec2 + method() {} + + field = log.push("f"); + + @getterDec1 + @getterDec2 + get getter() { + return; + } + @setterDec1 + @setterDec2 + set setter(x) {} + static { + log.push("static:end"); + } + } + log.push("after"); + new Foo(); + log.push("end"); + expect(log + "").toEqual( + "start,extends," + + "m1,m2,g1,g2,s1,s2," + // For each element e of instanceElements if e.[[Kind]] is not field + "static:start," + // staticElements + "static:end," + // staticElements + "after," + + "ctor:start," + + "m3,m4,m5,m6,g3,g4,g5,g6,s3,s4,s5,s6," + // instanceExtraInitializers + "f," + // InitializeFieldOrAccessor + "ctor:end," + + "end", + ); +} + +{ + const log = []; + const methodDec1 = (fn, ctxMethod) => { + log.push("m2"); + ctxMethod.addInitializer(() => log.push("m5")); + ctxMethod.addInitializer(() => log.push("m6")); + }; + const methodDec2 = (fn, ctxMethod) => { + log.push("m1"); + ctxMethod.addInitializer(() => log.push("m3")); + ctxMethod.addInitializer(() => log.push("m4")); + }; + const getterDec1 = (fn, ctxGetter) => { + log.push("g2"); + ctxGetter.addInitializer(() => log.push("g5")); + ctxGetter.addInitializer(() => log.push("g6")); + }; + const getterDec2 = (fn, ctxGetter) => { + log.push("g1"); + ctxGetter.addInitializer(() => log.push("g3")); + ctxGetter.addInitializer(() => log.push("g4")); + }; + const setterDec1 = (fn, ctxSetter) => { + log.push("s2"); + ctxSetter.addInitializer(() => log.push("s5")); + ctxSetter.addInitializer(() => log.push("s6")); + }; + const setterDec2 = (fn, ctxSetter) => { + log.push("s1"); + ctxSetter.addInitializer(() => log.push("s3")); + ctxSetter.addInitializer(() => log.push("s4")); + }; + log.push("start"); + class Foo extends (log.push("extends"), Object) { + static { + log.push("static:start"); + } + constructor() { + log.push("ctor:start"); + super(); + log.push("ctor:end"); + } + @methodDec1 + @methodDec2 + method() {} + + accessor field = log.push("a"); + + @getterDec1 + @getterDec2 + get getter() { + return; + } + @setterDec1 + @setterDec2 + set setter(x) {} + static { + log.push("static:end"); + } + } + log.push("after"); + new Foo(); + log.push("end"); + expect(log + "").toEqual( + "start,extends," + + "m1,m2,g1,g2,s1,s2," + // For each element e of instanceElements if e.[[Kind]] is not field + "static:start," + // staticElements + "static:end," + // staticElements + "after," + + "ctor:start," + + "m3,m4,m5,m6,g3,g4,g5,g6,s3,s4,s5,s6," + // instanceExtraInitializers + "a," + // InitializeFieldOrAccessor + "ctor:end," + + "end", + ); +} From 846153c519c45eff9ae193f792132718d882231b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 24 Jan 2024 18:25:15 -0500 Subject: [PATCH 2/2] update test fixtures --- .../fixtures/2021-12-getters--to-es2015/private/output.js | 3 +-- .../fixtures/2021-12-getters--to-es2015/public/output.js | 3 +-- .../2021-12-getters-and-setters--to-es2015/private/output.js | 3 +-- .../2021-12-getters-and-setters--to-es2015/public/output.js | 3 +-- .../fixtures/2021-12-getters-and-setters/private/output.js | 5 +---- .../fixtures/2021-12-getters-and-setters/public/output.js | 5 +---- .../test/fixtures/2021-12-getters/private/output.js | 5 +---- .../test/fixtures/2021-12-getters/public/output.js | 5 +---- .../fixtures/2021-12-methods--to-es2015/private/output.js | 3 +-- .../fixtures/2021-12-methods--to-es2015/public/output.js | 3 +-- .../test/fixtures/2021-12-methods/private/output.js | 5 +---- .../test/fixtures/2021-12-methods/public/output.js | 5 +---- .../valid-expression-formats/output.js | 3 +-- .../initProto-existing-derived-constructor/output.js | 4 ++-- .../fixtures/2021-12-misc/valid-expression-formats/output.js | 5 +---- .../fixtures/2021-12-setters--to-es2015/private/output.js | 3 +-- .../fixtures/2021-12-setters--to-es2015/public/output.js | 3 +-- .../test/fixtures/2021-12-setters/private/output.js | 5 +---- .../test/fixtures/2021-12-setters/public/output.js | 5 +---- .../fixtures/2022-03-getters--to-es2015/private/output.js | 3 +-- .../fixtures/2022-03-getters--to-es2015/public/output.js | 3 +-- .../2022-03-getters-and-setters--to-es2015/private/output.js | 3 +-- .../2022-03-getters-and-setters--to-es2015/public/output.js | 3 +-- .../fixtures/2022-03-getters-and-setters/private/output.js | 5 +---- .../fixtures/2022-03-getters-and-setters/public/output.js | 5 +---- .../test/fixtures/2022-03-getters/private/output.js | 5 +---- .../test/fixtures/2022-03-getters/public/output.js | 5 +---- .../fixtures/2022-03-methods--to-es2015/private/output.js | 3 +-- .../fixtures/2022-03-methods--to-es2015/public/output.js | 3 +-- .../test/fixtures/2022-03-methods/private/output.js | 5 +---- .../test/fixtures/2022-03-methods/public/output.js | 5 +---- .../initProto-existing-derived-constructor/output.js | 2 +- .../valid-expression-formats/output.js | 3 +-- .../initProto-existing-derived-constructor/output.js | 4 ++-- .../fixtures/2022-03-misc/valid-expression-formats/output.js | 5 +---- .../fixtures/2022-03-setters--to-es2015/private/output.js | 3 +-- .../fixtures/2022-03-setters--to-es2015/public/output.js | 3 +-- .../test/fixtures/2022-03-setters/private/output.js | 5 +---- .../test/fixtures/2022-03-setters/public/output.js | 5 +---- .../fixtures/2023-01-getters--to-es2015/private/output.js | 3 +-- .../fixtures/2023-01-getters--to-es2015/public/output.js | 3 +-- .../2023-01-getters-and-setters--to-es2015/private/output.js | 3 +-- .../2023-01-getters-and-setters--to-es2015/public/output.js | 3 +-- .../fixtures/2023-01-getters-and-setters/private/output.js | 5 +---- .../fixtures/2023-01-getters-and-setters/public/output.js | 5 +---- .../test/fixtures/2023-01-getters/private/output.js | 5 +---- .../test/fixtures/2023-01-getters/public/output.js | 5 +---- .../fixtures/2023-01-methods--to-es2015/private/output.js | 3 +-- .../fixtures/2023-01-methods--to-es2015/public/output.js | 3 +-- .../test/fixtures/2023-01-methods/private/output.js | 5 +---- .../test/fixtures/2023-01-methods/public/output.js | 5 +---- .../initProto-existing-derived-constructor/output.js | 2 +- .../valid-expression-formats/output.js | 3 +-- .../initProto-existing-derived-constructor/output.js | 4 ++-- .../fixtures/2023-01-misc/valid-expression-formats/output.js | 5 +---- .../fixtures/2023-01-setters--to-es2015/private/output.js | 3 +-- .../fixtures/2023-01-setters--to-es2015/public/output.js | 3 +-- .../test/fixtures/2023-01-setters/private/output.js | 5 +---- .../test/fixtures/2023-01-setters/public/output.js | 5 +---- .../fixtures/2023-05-getters--to-es2015/private/output.js | 3 +-- .../fixtures/2023-05-getters--to-es2015/public/output.js | 3 +-- .../2023-05-getters-and-setters--to-es2015/private/output.js | 3 +-- .../2023-05-getters-and-setters--to-es2015/public/output.js | 3 +-- .../fixtures/2023-05-getters-and-setters/private/output.js | 5 +---- .../fixtures/2023-05-getters-and-setters/public/output.js | 5 +---- .../test/fixtures/2023-05-getters/private/output.js | 5 +---- .../test/fixtures/2023-05-getters/public/output.js | 5 +---- .../fixtures/2023-05-methods--to-es2015/private/output.js | 3 +-- .../fixtures/2023-05-methods--to-es2015/public/output.js | 3 +-- .../test/fixtures/2023-05-methods/private/output.js | 5 +---- .../test/fixtures/2023-05-methods/public/output.js | 5 +---- .../initProto-existing-derived-constructor/output.js | 2 +- .../valid-expression-formats/output.js | 3 +-- .../initProto-existing-derived-constructor/output.js | 4 ++-- .../fixtures/2023-05-misc/valid-expression-formats/output.js | 5 +---- .../fixtures/2023-05-setters--to-es2015/private/output.js | 3 +-- .../fixtures/2023-05-setters--to-es2015/public/output.js | 3 +-- .../test/fixtures/2023-05-setters/private/output.js | 5 +---- .../test/fixtures/2023-05-setters/public/output.js | 5 +---- 79 files changed, 83 insertions(+), 227 deletions(-) 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 index 7c2dc1a1038c..02cc0656da15 100644 --- 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 @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: void 0 }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js index 5b0d03ac0f01..c43c5ec3be42 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; 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 index b40a5ccdd1e6..e6ec5cadd2ea 100644 --- 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 @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js index 1f851c178653..ec00e8721644 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; 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 837f980c0cf4..f2b381e46f46 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 @@ -8,10 +8,7 @@ class Foo { this.value = v; }]], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } 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 7957cca6437f..2757891a5996 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 @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } 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 ebe00a5a06b3..fb796e618fe3 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 @@ -6,10 +6,7 @@ class Foo { return this.value; }]], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } 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 4c26f758d9b7..0159e1239f83 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 @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a"], [dec, 3, 'b']], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } 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 index da73a1955662..137c0212f964 100644 --- 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 @@ -7,8 +7,7 @@ class Foo { writable: true, value: _call_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } callA() { return babelHelpers.classPrivateFieldGet(this, _a).call(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js index 2d431786fcfc..fe6bcd0374c3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } a() { return this.value; 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 5b0cd4de3833..1c45b2cced0a 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 @@ -6,11 +6,8 @@ class Foo { return this.value; }]], []); } - constructor() { - _initProto(this); - } #a = _call_a; - value = 1; + value = (_initProto(this), 1); callA() { return this.#a(); } 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 435b643e5150..821f4b011eb9 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 @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a"], [dec, 2, 'b']], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); a() { return this.value; } 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 index 046283d9b8f5..f061d8b5c003 100644 --- 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 @@ -11,9 +11,8 @@ class Foo { constructor() { babelHelpers.classPrivateFieldInitSpec(this, _a, { writable: true, - value: void 0 + value: void _initProto(this) }); - _initProto(this); } method() {} makeClass() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js index a705e90033e4..a3c904fc4a48 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js @@ -76,12 +76,12 @@ [_initProto3] = babelHelpers.applyDecs(this, [[dec, 2, "method"]], []); } constructor() { - log.push(_initProto3(super(6)).method()); + log.push(super(6).method()); } method() { return this.a; } - [_computedKey]; + [_computedKey] = void _initProto3(this); } new A(); } 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 e36d1eb6e9e7..40f628c10229 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 @@ -10,10 +10,7 @@ class Foo { static { [_initProto, _Foo, _initClass] = babelHelpers.applyDecs(this, [[[dec, _dec, _dec2, _dec3, _dec4], 2, "method"]], _classDecs); } - constructor() { - _initProto(this); - } - #a; + #a = void _initProto(this); method() {} makeClass() { var _dec5, _init_bar; 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 index 1894b9e7344e..d858e92ba82c 100644 --- 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 @@ -7,8 +7,7 @@ class Foo { get: void 0, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } setA(v) { babelHelpers.classPrivateFieldSet(this, _a, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js index a0d6d759b759..3272cd018d0c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } set a(v) { return this.value = v; 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 59c938b674b1..5920fdf1495e 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 @@ -6,10 +6,7 @@ class Foo { return this.value = v; }]], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set #a(v) { _call_a(this, 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 20232121f41c..9cc7e9c4f6bb 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 @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs(this, [[dec, 4, "a"], [dec, 4, 'b']], []); } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set a(v) { return this.value = v; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/private/output.js index 6b47bee46615..10e25b473b67 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: void 0 }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/public/output.js index bd48c8dd40c8..f875a5eb0ec3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/private/output.js index a54f6829af8f..1f615c6dce0c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/public/output.js index 5c3ccdb999d8..bc4cb34e804b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/private/output.js index e30f15cb7247..a54bc57f4503 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/private/output.js @@ -8,10 +8,7 @@ class Foo { this.value = v; }]], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/public/output.js index 83e21e953023..ac0bede3b450 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters-and-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2203R(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/private/output.js index 2b56fa5f3ced..1bd71e05ebd6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value; }]], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/public/output.js index 66c911322189..e7f8f323f192 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-getters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2203R(this, [[dec, 3, "a"], [dec, 3, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/private/output.js index bea7baf5833c..59059a842798 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { writable: true, value: _call_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } callA() { return babelHelpers.classPrivateFieldGet(this, _a).call(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/public/output.js index 4c0cf4fe5e95..a2ef1a5126f8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/private/output.js index 193c419d8600..6cd57e9c82f0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/private/output.js @@ -6,11 +6,8 @@ class Foo { return this.value; }]], []).e; } - constructor() { - _initProto(this); - } #a = _call_a; - value = 1; + value = (_initProto(this), 1); callA() { return this.#a(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/public/output.js index adadecda72fd..c14019e59454 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-methods/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2203R(this, [[dec, 2, "a"], [dec, 2, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/initProto-existing-derived-constructor/output.js index 3e4dc0dc4037..cebcdcc6bfda 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -71,7 +71,7 @@ _computedKey = babelHelpers.toPropertyKey((key = super(5).method(), log.push(key), key)); class A extends B { constructor() { - log.push(_initProto3((super(6), babelHelpers.defineProperty(this, _computedKey, void 0))).method()); + log.push((super(6), babelHelpers.defineProperty(this, _computedKey, void _initProto3(this))).method()); } method() { return this.a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/valid-expression-formats/output.js index 6b145ca87ed1..79646ee30625 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc--to-es2015/valid-expression-formats/output.js @@ -11,9 +11,8 @@ class Foo { constructor() { babelHelpers.classPrivateFieldInitSpec(this, _a, { writable: true, - value: void 0 + value: void _initProto(this) }); - _initProto(this); } method() {} makeClass() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/initProto-existing-derived-constructor/output.js index a9acef411d5f..1b974f9a0dc2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/initProto-existing-derived-constructor/output.js @@ -76,12 +76,12 @@ [_initProto3] = babelHelpers.applyDecs2203R(this, [[dec, 2, "method"]], []).e; } constructor() { - log.push(_initProto3(super(6)).method()); + log.push(super(6).method()); } method() { return this.a; } - [_computedKey]; + [_computedKey] = void _initProto3(this); } new A(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/valid-expression-formats/output.js index b6aac055bff5..d26effb8be45 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-misc/valid-expression-formats/output.js @@ -13,10 +13,7 @@ class Foo { c: [_Foo, _initClass] } = babelHelpers.applyDecs2203R(this, [[[dec, _dec, _dec2, _dec3, _dec4], 2, "method"]], _classDecs)); } - constructor() { - _initProto(this); - } - #a; + #a = void _initProto(this); method() {} makeClass() { var _dec5, _init_bar; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/private/output.js index c3d7120f41ba..11591c0f8c49 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: void 0, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } setA(v) { babelHelpers.classPrivateFieldSet(this, _a, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/public/output.js index 2ca1e39a57e6..485ed7fb5dac 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } set a(v) { return this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/private/output.js index f33e36f96f00..5cd561372256 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value = v; }]], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set #a(v) { _call_a(this, v); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/public/output.js index 0aec9e16ccbb..18c72ca67657 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2203R(this, [[dec, 4, "a"], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set a(v) { return this.value = v; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/private/output.js index 4de6361159ee..58140582ddd6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: void 0 }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/public/output.js index 7dbf738ad476..2f794470d162 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/private/output.js index 8d7f463f74d0..aabb04bc8c9d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/public/output.js index 782fe19ccef5..972ba33a7a9c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/private/output.js index b8faddc87071..424d1176b82d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/private/output.js @@ -8,10 +8,7 @@ class Foo { this.value = v; }]], [], _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/public/output.js index 6603960496c9..5cfb86f93969 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters-and-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2301(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/private/output.js index cc7f8d96b1a4..39c5ea3f8e45 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value; }]], [], _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/public/output.js index bdd0120fbd9f..b3e386075110 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-getters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2301(this, [[dec, 3, "a"], [dec, 3, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/private/output.js index ab30be54289d..fde408038c56 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { writable: true, value: _call_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } callA() { return babelHelpers.classPrivateFieldGet(this, _a).call(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/public/output.js index 52bc152665b9..bf9968a16658 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/private/output.js index 9dd8453d42e3..73c5a4423f09 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/private/output.js @@ -6,11 +6,8 @@ class Foo { return this.value; }]], [], _ => #a in _).e; } - constructor() { - _initProto(this); - } #a = _call_a; - value = 1; + value = (_initProto(this), 1); callA() { return this.#a(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/public/output.js index 0461062f7c14..94fdac8582a2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-methods/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2301(this, [[dec, 2, "a"], [dec, 2, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/initProto-existing-derived-constructor/output.js index c9f51863efc4..b0a3393d308c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -71,7 +71,7 @@ _computedKey = babelHelpers.toPropertyKey((key = super(5).method(), log.push(key), key)); class A extends B { constructor() { - log.push(_initProto3((super(6), babelHelpers.defineProperty(this, _computedKey, void 0))).method()); + log.push((super(6), babelHelpers.defineProperty(this, _computedKey, void _initProto3(this))).method()); } method() { return this.a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/valid-expression-formats/output.js index 23b08722ae13..5825e56705dc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc--to-es2015/valid-expression-formats/output.js @@ -11,9 +11,8 @@ class Foo { constructor() { babelHelpers.classPrivateFieldInitSpec(this, _a, { writable: true, - value: void 0 + value: void _initProto(this) }); - _initProto(this); } method() {} makeClass() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/initProto-existing-derived-constructor/output.js index 5bc1067895eb..138a91d941d6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/initProto-existing-derived-constructor/output.js @@ -76,12 +76,12 @@ [_initProto3] = babelHelpers.applyDecs2301(this, [[dec, 2, "method"]], []).e; } constructor() { - log.push(_initProto3(super(6)).method()); + log.push(super(6).method()); } method() { return this.a; } - [_computedKey]; + [_computedKey] = void _initProto3(this); } new A(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/valid-expression-formats/output.js index e7c815d74bed..b0f2ce76c389 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-misc/valid-expression-formats/output.js @@ -13,10 +13,7 @@ class Foo { c: [_Foo, _initClass] } = babelHelpers.applyDecs2301(this, [[[dec, _dec, _dec2, _dec3, _dec4], 2, "method"]], _classDecs)); } - constructor() { - _initProto(this); - } - #a; + #a = void _initProto(this); method() {} makeClass() { var _dec5, _init_bar; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/private/output.js index e3f1b847dee3..6482036be740 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: void 0, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } setA(v) { babelHelpers.classPrivateFieldSet(this, _a, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/public/output.js index 76ea251c40b3..1eff9f8a3329 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } set a(v) { return this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/private/output.js index 0b11b2e55559..92341666e9e9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value = v; }]], [], _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set #a(v) { _call_a(this, v); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/public/output.js index d9b498c62205..e8346ec19f67 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-01-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2301(this, [[dec, 4, "a"], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set a(v) { return this.value = v; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js index 6fa65e5d7579..6b92ebb68db1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: void 0 }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js index b895e447ba75..bc84e89d009a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js index 0e3606b09cce..7dc8ddc18fc8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: _get_a, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } getA() { return babelHelpers.classPrivateFieldGet(this, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js index ded216f4f759..7313961d4602 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } get a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js index 33d4478459bf..479f1b947b9d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js @@ -8,10 +8,7 @@ class Foo { this.value = v; }]], [], 0, _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js index 7a1bc2dd6701..55591f7920d8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js index 4c8b74c25b78..81bc365faca1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value; }]], [], 0, _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get #a() { return _call_a(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js index 895e2d98f4a4..ce3b8d2faaac 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a"], [dec, 3, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); get a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js index 6aa377e1884f..906e46ea9d4a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { writable: true, value: _call_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } callA() { return babelHelpers.classPrivateFieldGet(this, _a).call(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js index a57514e64a5f..0c8b05c79c6a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } a() { return this.value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js index 88ad9298bb44..cdf5cfed288e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js @@ -6,11 +6,8 @@ class Foo { return this.value; }]], [], 0, _ => #a in _).e; } - constructor() { - _initProto(this); - } #a = _call_a; - value = 1; + value = (_initProto(this), 1); callA() { return this.#a(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js index 4ecb7ac18511..9eab1ec7d40f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "a"], [dec, 2, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); a() { return this.value; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js index 1f112ee0aa47..850a0ddb14d7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -71,7 +71,7 @@ _computedKey = babelHelpers.toPropertyKey((key = super(5).method(), log.push(key), key)); class A extends B { constructor() { - log.push(_initProto3((super(6), babelHelpers.defineProperty(this, _computedKey, void 0))).method()); + log.push((super(6), babelHelpers.defineProperty(this, _computedKey, void _initProto3(this))).method()); } method() { return this.a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js index 578eda33068b..b683996d249a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js @@ -12,9 +12,8 @@ class Foo { constructor() { babelHelpers.classPrivateFieldInitSpec(this, _a, { writable: true, - value: void 0 + value: void _initProto(this) }); - _initProto(this); } method() {} makeClass() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js index 7ce81ecfc04e..156457c2800a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js @@ -76,12 +76,12 @@ [_initProto3] = babelHelpers.applyDecs2305(this, [[dec, 2, "method"]], [], 0, void 0, B).e; } constructor() { - log.push(_initProto3(super(6)).method()); + log.push(super(6).method()); } method() { return this.a; } - [_computedKey]; + [_computedKey] = void _initProto3(this); } new A(); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js index 48636e267386..bf91a125c7e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js @@ -14,10 +14,7 @@ class Foo { c: [_Foo, _initClass] } = babelHelpers.applyDecs2305(this, [[[void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 18, "method"]], _classDecs, 1)); } - constructor() { - _initProto(this); - } - #a; + #a = void _initProto(this); method() {} makeClass() { var _obj2, _dec5, _init_bar; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js index 909b0d21915d..25cb263d580f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js @@ -7,8 +7,7 @@ class Foo { get: void 0, set: _set_a }); - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } setA(v) { babelHelpers.classPrivateFieldSet(this, _a, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js index badf4c53dc5a..a3d41cf24b9d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js @@ -2,8 +2,7 @@ var _initProto, _Foo; const dec = () => {}; class Foo { constructor() { - babelHelpers.defineProperty(this, "value", 1); - _initProto(this); + babelHelpers.defineProperty(this, "value", (_initProto(this), 1)); } set a(v) { return this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js index d2bde1793cb3..ee77ef520a39 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js @@ -6,10 +6,7 @@ class Foo { return this.value = v; }]], [], 0, _ => #a in _).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set #a(v) { _call_a(this, v); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js index 20c63ea593af..4be1a9b912f2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js @@ -4,10 +4,7 @@ class Foo { static { [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 4, "a"], [dec, 4, 'b']], []).e; } - constructor() { - _initProto(this); - } - value = 1; + value = (_initProto(this), 1); set a(v) { return this.value = v; }