From aab7a74e1d9f26ac8913c5ed55e29a3bc90e061c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 14 Feb 2024 17:15:02 +0000 Subject: [PATCH 1/6] Swap `classDecs` and `memberDecs` params in `applyDecs2311` --- .../src/decorators.ts | 5 ++++- .../babel-helpers/src/helpers-generated.ts | 4 ++-- .../babel-helpers/src/helpers/applyDecs2311.ts | 2 +- .../context-name/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-11-accessors/context-name/output.js | 2 +- .../2023-11-accessors/private/output.js | 2 +- .../2023-11-accessors/public/output.js | 2 +- .../2023-11-accessors/static-private/output.js | 2 +- .../2023-11-accessors/static-public/output.js | 2 +- .../output.js | 2 +- .../super-in-private-accessor/output.js | 4 ++-- .../super-in-private-method/output.js | 4 ++-- .../decorator-access-modified-fields/output.js | 2 +- .../output.js | 2 +- .../expressions-static-blocks/output.js | 18 +++++++++--------- .../expressions/output.js | 16 ++++++++-------- .../inheritance/output.js | 4 ++-- .../initializers/output.js | 4 ++-- .../output.js | 2 +- .../output.js | 2 +- .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/output.js | 2 +- .../replacement/output.js | 2 +- .../decorator-access-modified-fields/output.js | 2 +- .../output.js | 2 +- .../expressions-static-blocks/output.js | 18 +++++++++--------- .../2023-11-classes/expressions/output.js | 18 +++++++++--------- .../2023-11-classes/inheritance/output.js | 4 ++-- .../2023-11-classes/initializers/output.js | 4 ++-- .../output.js | 2 +- .../output.js | 2 +- .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/output.js | 2 +- .../2023-11-classes/replacement/output.js | 2 +- .../computed-keys-same-ast/output.js | 2 +- .../computed-keys-same-value/output.js | 2 +- .../method-and-field/output.js | 2 +- .../methods-with-same-key/output.js | 2 +- .../computed-keys-same-ast/output.js | 2 +- .../computed-keys-same-value/output.js | 2 +- .../method-and-field/output.js | 2 +- .../methods-with-same-key/output.js | 2 +- .../default-anonymous/output.mjs | 2 +- .../2023-11-exported/default-named/output.mjs | 2 +- .../member-decorator/output.mjs | 2 +- .../fixtures/2023-11-exported/named/output.mjs | 2 +- .../context-name/output.js | 2 +- .../private/output.js | 2 +- .../2023-11-fields--to-es2015/public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-11-fields/context-name/output.js | 2 +- .../fixtures/2023-11-fields/private/output.js | 2 +- .../fixtures/2023-11-fields/public/output.js | 2 +- .../2023-11-fields/static-private/output.js | 2 +- .../2023-11-fields/static-public/output.js | 2 +- .../context-name/output.js | 2 +- .../private/output.js | 4 ++-- .../public/output.js | 2 +- .../static-private/output.js | 4 ++-- .../static-public/output.js | 2 +- .../private/output.js | 4 ++-- .../public/output.js | 2 +- .../static-private/output.js | 4 ++-- .../static-public/output.js | 2 +- .../private/output.js | 4 ++-- .../public/output.js | 2 +- .../static-private/output.js | 4 ++-- .../static-public/output.js | 2 +- .../2023-11-getters/context-name/output.js | 2 +- .../fixtures/2023-11-getters/private/output.js | 4 ++-- .../fixtures/2023-11-getters/public/output.js | 2 +- .../2023-11-getters/static-private/output.js | 4 ++-- .../2023-11-getters/static-public/output.js | 2 +- .../context-name/output.js | 2 +- .../private-async-and-generator/output.js | 2 +- .../private/output.js | 4 ++-- .../public/output.js | 2 +- .../static-private/output.js | 4 ++-- .../static-public/output.js | 2 +- .../2023-11-methods/context-name/output.js | 2 +- .../private-async-and-generator/output.js | 2 +- .../fixtures/2023-11-methods/private/output.js | 4 ++-- .../fixtures/2023-11-methods/public/output.js | 2 +- .../2023-11-methods/static-private/output.js | 4 ++-- .../2023-11-methods/static-public/output.js | 2 +- .../output.js | 14 +++++++------- .../super-in-decorator/output.js | 2 +- .../2023-11-misc--to-es2015/this/output.js | 2 +- .../valid-expression-formats/output.js | 4 ++-- .../2023-11-misc/all-decorators/output.js | 2 +- .../output.js | 4 ++-- .../output.js | 14 +++++++------- .../output.js | 4 ++-- .../2023-11-misc/super-in-decorator/output.js | 2 +- .../output.js | 2 +- .../super-in-private-accessor/output.js | 4 ++-- .../super-in-private-method/output.js | 4 ++-- .../test/fixtures/2023-11-misc/this/output.js | 2 +- .../valid-expression-formats/output.js | 4 ++-- .../output.js | 2 +- .../output.js | 2 +- .../context-name/output.js | 2 +- .../private/output.js | 4 ++-- .../public/output.js | 2 +- .../static-private/output.js | 4 ++-- .../static-public/output.js | 2 +- .../2023-11-setters/context-name/output.js | 2 +- .../fixtures/2023-11-setters/private/output.js | 4 ++-- .../fixtures/2023-11-setters/public/output.js | 2 +- .../2023-11-setters/static-private/output.js | 4 ++-- .../2023-11-setters/static-public/output.js | 2 +- .../hack-double-at/class-decorator/output.js | 2 +- .../class-decorator/output.js | 2 +- .../super-call-in-decorator/output.js | 2 +- .../super-property-in-decorator/output.js | 2 +- 120 files changed, 195 insertions(+), 192 deletions(-) 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 50c8cf7bac55..595d5e03267e 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -1500,11 +1500,14 @@ function createLocalsAssignment( setClassName ? createSetFunctionNameCall(state, setClassName) : t.thisExpression(), - elementDecorations, classDecorations, + elementDecorations, ]; if (!process.env.BABEL_8_BREAKING) { + if (version !== "2023-11") { + args.splice(1, 2, elementDecorations, classDecorations); + } if ( version === "2021-12" || (version === "2022-03" && !state.availableHelper("applyDecs2203R")) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index b56c7794b171..03d5987dddc7 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -48,10 +48,10 @@ export default Object.freeze({ "7.21.0", 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2305(e,t,r,n,o,a){function i(e,t,r){return function(n,o){return r&&r(n),e[t].call(n,o)}}function c(e,t){for(var r=0;r=0;j-=r?2:1){var D=v[j],E=r?v[j-1]:void 0,I={},O={kind:["field","accessor","method","getter","setter","class"][o],name:n,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");s(t,"An initializer","be",!0),c.push(t)}.bind(null,I)};try{if(b)(y=s(D.call(E,P,O),"class decorators","return"))&&(P=y);else{var k,F;O.static=l,O.private=f,f?2===o?k=function(e){return m(e),w.value}:(o<4&&(k=i(w,"get",m)),3!==o&&(F=i(w,"set",m))):(k=function(e){return e[n]},(o<2||4===o)&&(F=function(e,t){e[n]=t}));var N=O.access={has:f?h.bind():function(e){return n in e}};if(k&&(N.get=k),F&&(N.set=F),P=D.call(E,d?{get:w.get,set:w.set}:w[A],O),d){if("object"==typeof P&&P)(y=s(P.get,"accessor.get"))&&(w.get=y),(y=s(P.set,"accessor.set"))&&(w.set=y),(y=s(P.init,"accessor.init"))&&S.push(y);else if(void 0!==P)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else s(P,(p?"field":"method")+" decorators","return")&&(p?S.push(P):w[A]=P)}}finally{I.v=!0}}return(p||d)&&u.push((function(e,t){for(var r=S.length-1;r>=0;r--)t=S[r].call(e,t);return t})),p||b||(f?d?u.push(i(w,"get"),i(w,"set")):u.push(2===o?w[A]:i.call.bind(w[A])):Object.defineProperty(e,n,w)),P}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var l=a[Symbol.metadata||Symbol.for("Symbol.metadata")];var f=Object.create(null==l?null:l),p=function(e,t,r,n){var o,a,i=[],s=function(t){return checkInRHS(t)===e},u=new Map;function l(e){e&&i.push(c.bind(null,e))}for(var f=0;f3,y=16&d,v=!!(8&d),g=0==(d&=7),b=h+"/"+v;if(!g&&!m){var w=u.get(b);if(!0===w||3===w&&4!==d||4===w&&3!==d)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);u.set(b,!(d>2)||d)}applyDec(v?e:e.prototype,p,y,m?"#"+h:toPropertyKey(h),d,n,v?a=a||[]:o=o||[],i,v,m,g,1===d,v&&m?s:r)}}return l(o),l(a),i}(e,t,o,f);return r.length||u(e,f),{e:p,get c(){var t=[];return r.length&&[u(applyDec(e,[r],n,e.name,5,f,t),f),c.bind(null,t,e)]}}}', ), - // size: 2917, gzip size: 1487 + // size: 2917, gzip size: 1488 applyDecs2311: helper( "7.23.0", - 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2311(e,t,n,r,o,i){var a,c,u=Symbol.metadata||Symbol.for("Symbol.metadata"),s=Object.defineProperty,f=Object.create,l=[f(null),f(null)],p=n.length;function d(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a=0;O-=n?2:1){var z=b[O],H=n?b[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");m(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(D)c=z.call(H,N,R),K.v=1,m(c,"class decorators","return")&&(N=c);else if(R.static=f,R.private=p,c=R.access={has:p?v.bind():function(e){return r in e}},j||(c.get=p?E?function(e){return g(e),P.value}:I("get",0,g):function(e){return e[r]}),E||S||(c.set=p?I("set",0,g):function(e,t){e[r]=t}),N=z.call(H,y?{get:P.get,set:P.set}:P[F],R),K.v=1,y){if("object"==typeof N&&N)(c=m(N.get,"accessor.get"))&&(P.get=c),(c=m(N.set,"accessor.set"))&&(P.set=c),(c=m(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else m(N,(h?"field":"method")+" decorators","return")&&(h?k.unshift(N):P[F]=N)}return o<2&&u.push(d(k,f,1),d(i,f,0)),h||D||(p?y?u.splice(-1,0,I("get",f),I("set",f)):u.push(E?P[F]:m.call.bind(P[F])):s(e,r,P)),N}function h(e){return s(e,u,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[u]),a=f(null==a?null:a),c=function(){var n,r,i=[];function a(e){e&&i.push(d(e))}for(var c=0;c=0;O-=n?2:1){var z=b[O],H=n?b[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");m(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(D)c=z.call(H,N,R),K.v=1,m(c,"class decorators","return")&&(N=c);else if(R.static=f,R.private=p,c=R.access={has:p?v.bind():function(e){return r in e}},j||(c.get=p?E?function(e){return g(e),P.value}:I("get",0,g):function(e){return e[r]}),E||S||(c.set=p?I("set",0,g):function(e,t){e[r]=t}),N=z.call(H,y?{get:P.get,set:P.set}:P[F],R),K.v=1,y){if("object"==typeof N&&N)(c=m(N.get,"accessor.get"))&&(P.get=c),(c=m(N.set,"accessor.set"))&&(P.set=c),(c=m(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else m(N,(h?"field":"method")+" decorators","return")&&(h?k.unshift(N):P[F]=N)}return o<2&&u.push(d(k,f,1),d(i,f,0)),h||D||(p?y?u.splice(-1,0,I("get",f),I("set",f)):u.push(E?P[F]:m.call.bind(P[F])):s(e,r,P)),N}function h(e){return s(e,u,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[u]),a=f(null==a?null:a),c=function(){var t,r,i=[];function a(e){e&&i.push(d(e))}for(var c=0;c babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b"], [dec, 9, "c"], [dec, 9, 0], [dec, 9, 1], [dec, 9, 2n], [dec, 9, 3n], [dec, 9, _computedKey]], []).e; +[_init_a, _init_extra_a, _init_a2, _get_a, _set_a, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 9, "a"], [dec, 9, "a", o => babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b"], [dec, 9, "c"], [dec, 9, 0], [dec, 9, 1], [dec, 9, 2n], [dec, 9, 3n], [dec, 9, _computedKey]]).e; var _A = { _: _init_a() }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/private/output.js index 8f62a56aa9f3..827481f60937 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/private/output.js @@ -24,4 +24,4 @@ function _set_b2(v) { function _get_b2() { return _get_b(this); } -[_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet2(o, _A), (o, v) => babelHelpers.classPrivateFieldSet2(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet2(o, _B), (o, v) => babelHelpers.classPrivateFieldSet2(o, _B, v)]], [], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet2(o, _A), (o, v) => babelHelpers.classPrivateFieldSet2(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet2(o, _B), (o, v) => babelHelpers.classPrivateFieldSet2(o, _B, v)]], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/public/output.js index 21cd1d3661d1..a573deab6eec 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/public/output.js @@ -30,4 +30,4 @@ class Foo { } } _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, 'c']], []).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, 'c']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-private/output.js index 8f448de033d4..fc7e6966b436 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-private/output.js @@ -14,7 +14,7 @@ function _set_b2(v) { function _get_b2() { return _get_b(); } -[_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [[dec, 9, "a", o => babelHelpers.assertClassBrand(o, _Foo, _A)._, (o, v) => _A._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b", o => babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)]], []).e; +[_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 9, "a", o => babelHelpers.assertClassBrand(o, _Foo, _A)._, (o, v) => _A._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b", o => babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)]]).e; var _A = { _: _init_a() }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-public/output.js index 4cca097154c1..3d3d73bbd3cd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-public/output.js @@ -21,7 +21,7 @@ class Foo { } } _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, 'c']], []).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, 'c']]).e; var _A = { _: _init_a() }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/context-name/output.js index 297ff988506e..44a3c4b976bd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo { static { - [_init_a, _init_extra_a, _init_a2, _get_a, _set_a, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(this, [[dec, 9, "a"], [dec, 9, "a", o => o.#B, (o, v) => o.#B = v], [dec, 9, "b"], [dec, 9, "c"], [dec, 9, 0], [dec, 9, 1], [dec, 9, 2n], [dec, 9, 3n], [dec, 9, _computedKey]], []).e; + [_init_a, _init_extra_a, _init_a2, _get_a, _set_a, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(this, [], [[dec, 9, "a"], [dec, 9, "a", o => o.#B, (o, v) => o.#B = v], [dec, 9, "b"], [dec, 9, "c"], [dec, 9, 0], [dec, 9, 1], [dec, 9, 2n], [dec, 9, 3n], [dec, 9, _computedKey]]).e; } static #A = _init_a(); static get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/private/output.js index 8351393aa3b2..d804cd0d8847 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [[dec, 1, "a", o => o.#A, (o, v) => o.#A = v], [dec, 1, "b", o => o.#B, (o, v) => o.#B = v]], [], 0, _ => #a in _).e; + [_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "a", o => o.#A, (o, v) => o.#A = v], [dec, 1, "b", o => o.#B, (o, v) => o.#B = v]], 0, _ => #a in _).e; } constructor() { _init_extra_b(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/public/output.js index 8f8ad15e32b6..fb2d06f9dfb4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_ext const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, 'c']], []).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, 'c']]).e; } constructor() { _init_extra_computedKey(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-private/output.js index fd5caedaa32e..204e5cbb78f5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [[dec, 9, "a", o => o.#A, (o, v) => o.#A = v], [dec, 9, "b", o => o.#B, (o, v) => o.#B = v]], []).e; + [_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [], [[dec, 9, "a", o => o.#A, (o, v) => o.#A = v], [dec, 9, "b", o => o.#B, (o, v) => o.#B = v]]).e; } static #A = _init_a(); static set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-public/output.js index a48eaeeb0f98..2f738e306e92 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_ext const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, 'c']], []).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [], [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, 'c']]).e; } static #A = _init_a(); static get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-nested-constructor-expression/output.js index c07e017c53de..ce0615628fa0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends (_Bar = Bar) { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _Bar).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _Bar).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-accessor/output.js index 85152516ad4c..38c1f86b8a6b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-accessor/output.js @@ -2,9 +2,9 @@ var _initProto, _call_x, _Bar; const dec = () => {}; class Foo extends (_Bar = Bar) { static { - [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "x", function () { return Bar.prototype.foo.call(this); - }]], [], 0, _ => #x in _, _Bar).e; + }]], 0, _ => #x in _, _Bar).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-method/output.js index 9d794c40451b..7b58c5bc26a8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-assumption-constantSuper/super-in-private-method/output.js @@ -2,9 +2,9 @@ var _initProto, _call_x, _Bar; const dec = () => {}; class Foo extends (_Bar = Bar) { static { - [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "x", function () { return Bar.prototype.foo.call(this); - }]], [], 0, _ => #x in _, _Bar).e; + }]], 0, _ => #x in _, _Bar).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-fields/output.js index 240f771fbfae..22634ee08161 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-fields/output.js @@ -16,5 +16,5 @@ _C2 = C; ({ e: [_init_m, _init_extra_m], c: [_C, _initClass] -} = babelHelpers.applyDecs2311(_C2, [[memberDec, 0, "m"]], [classDec])); +} = babelHelpers.applyDecs2311(_C2, [classDec], [[memberDec, 0, "m"]])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-methods/output.js index bc86dc7d7204..5edcd189b77e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/decorator-access-modified-methods/output.js @@ -16,5 +16,5 @@ _C2 = C; ({ e: [_initProto], c: [_C, _initClass] -} = babelHelpers.applyDecs2311(_C2, [[memberDec, 2, "m"]], [classDec])); +} = babelHelpers.applyDecs2311(_C2, [classDec], [[memberDec, 2, "m"]])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions-static-blocks/output.js index 7773aa2abfe8..040ee8e04539 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions-static-blocks/output.js @@ -7,7 +7,7 @@ const A = (new (_temp = class extends babelHelpers.identity { }, (_A2 => { class A {} _A2 = A; - [_A, _initClass] = babelHelpers.applyDecs2311(_A2, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2311(_A2, [dec], []).c; })(), _temp)(), _A); const B = (new (_temp2 = class extends babelHelpers.identity { constructor() { @@ -16,7 +16,7 @@ const B = (new (_temp2 = class extends babelHelpers.identity { }, (_C2 => { class C {} _C2 = C; - [_C, _initClass2] = babelHelpers.applyDecs2311(_C2, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2311(_C2, [dec], []).c; })(), _temp2)(), _C); const D = (new (_temp3 = class extends babelHelpers.identity { constructor() { @@ -25,13 +25,13 @@ const D = (new (_temp3 = class extends babelHelpers.identity { }, (_D2 => { class D {} _D2 = D; - [_D, _initClass3] = babelHelpers.applyDecs2311(_D2, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2311(_D2, [dec], []).c; })(), _temp3)(), _D); const E = ((new (_temp4 = class extends babelHelpers.identity { constructor() { super(_decorated_class), (() => {})(), _initClass4(); } -}, (_Class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(_Class2, [], [dec]).c), _temp4)(), _decorated_class), 123); +}, (_Class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(_Class2, [dec], []).c), _temp4)(), _decorated_class), 123); const F = [(new (_temp5 = class extends babelHelpers.identity { constructor() { super(_G), (() => {})(), _initClass5(); @@ -39,12 +39,12 @@ const F = [(new (_temp5 = class extends babelHelpers.identity { }, (_G2 => { class G {} _G2 = G; - [_G, _initClass5] = babelHelpers.applyDecs2311(_G2, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2311(_G2, [dec], []).c; })(), _temp5)(), _G), (new (_temp6 = class extends babelHelpers.identity { constructor() { super(_decorated_class2), (() => {})(), _initClass6(); } -}, (_Class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(_Class3, [], [dec]).c), _temp6)(), _decorated_class2)]; +}, (_Class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(_Class3, [dec], []).c), _temp6)(), _decorated_class2)]; const H = (new (_temp7 = class extends babelHelpers.identity { constructor() { super(_H), (() => {})(), _initClass7(); @@ -52,7 +52,7 @@ const H = (new (_temp7 = class extends babelHelpers.identity { }, (_H2 => { class H extends (_I = I) {} _H2 = H; - [_H, _initClass7] = babelHelpers.applyDecs2311(_H2, [], [dec], 0, void 0, _I).c; + [_H, _initClass7] = babelHelpers.applyDecs2311(_H2, [dec], [], 0, void 0, _I).c; })(), _temp7)(), _H); const J = (new (_temp8 = class extends babelHelpers.identity { constructor() { @@ -61,7 +61,7 @@ const J = (new (_temp8 = class extends babelHelpers.identity { }, (_K2 => { class K extends (_L = L) {} _K2 = K; - [_K, _initClass8] = babelHelpers.applyDecs2311(_K2, [], [dec], 0, void 0, _L).c; + [_K, _initClass8] = babelHelpers.applyDecs2311(_K2, [dec], [], 0, void 0, _L).c; })(), _temp8)(), _K); function classFactory() { var _initClass9, _decorated_class3, _temp9, _Class5; @@ -69,5 +69,5 @@ function classFactory() { constructor() { super(_decorated_class3), (() => {})(), _initClass9(); } - }, (_Class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(_Class5, [], [dec]).c), _temp9)(), _decorated_class3; + }, (_Class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(_Class5, [dec], []).c), _temp9)(), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions/output.js index 777305c8c552..c03906627566 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/expressions/output.js @@ -1,13 +1,13 @@ var _initClass, _A, _A2, _initClass2, _C, _C2, _initClass3, _D, _D2, _initClass4, _decorated_class, _Class, _initClass5, _G, _G2, _initClass6, _decorated_class2, _Class2, _initClass7, _H, _I, _H2, _initClass8, _K, _L, _K2; const dec = () => {}; -const A = ((_A2 = class A {}, [_A, _initClass] = babelHelpers.applyDecs2311(_A2, [], [dec]).c, _initClass()), _A); -const B = ((_C2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2311(_C2, [], [dec]).c, _initClass2()), _C); -const D = ((_D2 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2311(_D2, [], [dec]).c, _initClass3()), _D); -const E = (((_Class = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(_Class, [], [dec]).c, _initClass4()), _decorated_class), 123); -const F = [((_G2 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2311(_G2, [], [dec]).c, _initClass5()), _G), ((_Class2 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(_Class2, [], [dec]).c, _initClass6()), _decorated_class2)]; -const H = ((_H2 = class H extends (_I = I) {}, [_H, _initClass7] = babelHelpers.applyDecs2311(_H2, [], [dec], 0, void 0, _I).c, _initClass7()), _H); -const J = ((_K2 = class K extends (_L = L) {}, [_K, _initClass8] = babelHelpers.applyDecs2311(_K2, [], [dec], 0, void 0, _L).c, _initClass8()), _K); +const A = ((_A2 = class A {}, [_A, _initClass] = babelHelpers.applyDecs2311(_A2, [dec], []).c, _initClass()), _A); +const B = ((_C2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2311(_C2, [dec], []).c, _initClass2()), _C); +const D = ((_D2 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2311(_D2, [dec], []).c, _initClass3()), _D); +const E = (((_Class = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(_Class, [dec], []).c, _initClass4()), _decorated_class), 123); +const F = [((_G2 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2311(_G2, [dec], []).c, _initClass5()), _G), ((_Class2 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(_Class2, [dec], []).c, _initClass6()), _decorated_class2)]; +const H = ((_H2 = class H extends (_I = I) {}, [_H, _initClass7] = babelHelpers.applyDecs2311(_H2, [dec], [], 0, void 0, _I).c, _initClass7()), _H); +const J = ((_K2 = class K extends (_L = L) {}, [_K, _initClass8] = babelHelpers.applyDecs2311(_K2, [dec], [], 0, void 0, _L).c, _initClass8()), _K); function classFactory() { var _initClass9, _decorated_class3, _Class3; - return (_Class3 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(_Class3, [], [dec]).c, _initClass9()), _decorated_class3; + return (_Class3 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(_Class3, [dec], []).c, _initClass9()), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/inheritance/output.js index 2594a75d066f..ffe0c690b193 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/inheritance/output.js @@ -4,10 +4,10 @@ const dec2 = () => {}; let _Bar; class Bar {} _Bar2 = Bar; -[_Bar, _initClass] = babelHelpers.applyDecs2311(_Bar2, [], [dec1]).c; +[_Bar, _initClass] = babelHelpers.applyDecs2311(_Bar2, [dec1], []).c; _initClass(); let _Foo; class Foo extends (_Bar3 = _Bar) {} _Foo2 = Foo; -[_Foo, _initClass2] = babelHelpers.applyDecs2311(_Foo2, [], [dec2], 0, void 0, _Bar3).c; +[_Foo, _initClass2] = babelHelpers.applyDecs2311(_Foo2, [dec2], [], 0, void 0, _Bar3).c; _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/initializers/output.js index 27f26dc0ec4d..b747829b3166 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/initializers/output.js @@ -8,7 +8,7 @@ new (_temp = class extends babelHelpers.identity { }, (_Foo2 => { class Foo {} _Foo2 = Foo; - [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [dec], []).c; })(), _temp)(); let _Bar; new (_temp2 = class extends babelHelpers.identity { @@ -20,5 +20,5 @@ new (_temp2 = class extends babelHelpers.identity { }, (_Bar2 => { class Bar extends (_Foo3 = _Foo) {} _Bar2 = Bar; - [_Bar, _initClass2] = babelHelpers.applyDecs2311(_Bar2, [], [dec], 0, void 0, _Foo3).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2311(_Bar2, [dec], [], 0, void 0, _Foo3).c; })(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js index fae56354b21e..09db03f9f421 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js @@ -44,7 +44,7 @@ new (_A = /*#__PURE__*/new WeakMap(), (_temp = class extends babelHelpers.identi ({ e: [_init_accessor, _init_extra_accessor, _init_property, _init_extra_property, _initStatic], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(_Foo2, [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]], [dec])); + } = babelHelpers.applyDecs2311(_Foo2, [dec], [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]])); _initStatic(_Foo2); })(); })(), _temp))(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-installed-on-correct-class/output.js index ddb9857ae9a1..6750932a9934 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -21,7 +21,7 @@ new (_x = /*#__PURE__*/new WeakMap(), _A = /*#__PURE__*/new WeakMap(), _Class_br static m() {} } _Foo2 = Foo; - [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [dec], []).c; })(), _temp))(); function _get_a() { return babelHelpers.classPrivateFieldGet2(_Foo, _A); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-this/output.js index c78939592b5c..ffba867c9c4a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-this/output.js @@ -12,5 +12,5 @@ new (_temp = class extends babelHelpers.identity { }, (_Foo2 => { class Foo {} _Foo2 = Foo; - [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [dec], []).c; })(), _temp)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-with-expr/output.js index b653d63b506b..86507d9b2e89 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-with-expr/output.js @@ -4,5 +4,5 @@ const Foo = ((_Bar2 = class Bar { constructor() { babelHelpers.defineProperty(this, "bar", new _Bar()); } -}, [_Bar, _initClass] = babelHelpers.applyDecs2311(_Bar2, [], [dec]).c, _initClass()), _Bar); +}, [_Bar, _initClass] = babelHelpers.applyDecs2311(_Bar2, [dec], []).c, _initClass()), _Bar); const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement/output.js index e15ae22cd67b..db44675809b1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement/output.js @@ -8,6 +8,6 @@ new (_temp = class extends babelHelpers.identity { }, (_Foo2 => { class Foo {} _Foo2 = Foo; - [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(_Foo2, [dec], []).c; })(), _temp)(); const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-fields/output.js index 9c96f12a6969..6f9ce5b9d70d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-fields/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_init_m, _init_extra_m], c: [_C, _initClass] - } = babelHelpers.applyDecs2311(this, [[memberDec, 0, "m"]], [classDec])); + } = babelHelpers.applyDecs2311(this, [classDec], [[memberDec, 0, "m"]])); } constructor() { _init_extra_m(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-methods/output.js index 96fd3677f74a..1d418cf9c479 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/decorator-access-modified-methods/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2311(this, [[memberDec, 2, "m"]], [classDec])); + } = babelHelpers.applyDecs2311(this, [classDec], [[memberDec, 2, "m"]])); } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions-static-blocks/output.js index 7fbe714c5b6b..a7b3c1319f46 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions-static-blocks/output.js @@ -4,7 +4,7 @@ const A = (new class extends babelHelpers.identity { static { class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } @@ -16,7 +16,7 @@ const B = (new class extends babelHelpers.identity { static { class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } @@ -28,7 +28,7 @@ const D = (new class extends babelHelpers.identity { static { class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } @@ -40,7 +40,7 @@ const E = ((new class extends babelHelpers.identity { static { (class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(this, [dec], []).c; } }); } @@ -52,7 +52,7 @@ const F = [(new class extends babelHelpers.identity { static { class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } @@ -63,7 +63,7 @@ const F = [(new class extends babelHelpers.identity { static { (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(this, [dec], []).c; } }); } @@ -75,7 +75,7 @@ const H = (new class extends babelHelpers.identity { static { class H extends (_I = I) { static { - [_H, _initClass7] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _I).c; + [_H, _initClass7] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _I).c; } } } @@ -87,7 +87,7 @@ const J = (new class extends babelHelpers.identity { static { class K extends (_L = L) { static { - [_K, _initClass8] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _L).c; + [_K, _initClass8] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _L).c; } } } @@ -101,7 +101,7 @@ function classFactory() { static { (class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(this, [dec], []).c; } }); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions/output.js index a23ff720a101..ec960742f386 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/expressions/output.js @@ -2,7 +2,7 @@ var _initClass, _A, _initClass2, _C, _initClass3, _D, _initClass4, _decorated_cl const dec = () => {}; const A = (class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass(); @@ -10,7 +10,7 @@ const A = (class A { }, _A); const B = (class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass2(); @@ -18,7 +18,7 @@ const B = (class C { }, _C); const D = (class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass3(); @@ -26,7 +26,7 @@ const D = (class D { }, _D); const E = ((class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass4(); @@ -34,14 +34,14 @@ const E = ((class { }, _decorated_class), 123); const F = [(class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass5(); } }, _G), (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass6(); @@ -49,7 +49,7 @@ const F = [(class G { }, _decorated_class2)]; const H = (class H extends (_I = I) { static { - [_H, _initClass7] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _I).c; + [_H, _initClass7] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _I).c; } static { _initClass7(); @@ -57,7 +57,7 @@ const H = (class H extends (_I = I) { }, _H); const J = (class K extends (_L = L) { static { - [_K, _initClass8] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _L).c; + [_K, _initClass8] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _L).c; } static { _initClass8(); @@ -67,7 +67,7 @@ function classFactory() { var _initClass9, _decorated_class3; return class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass9(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js index fa58b1bb1b60..4932e6ffd722 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js @@ -4,7 +4,7 @@ _classDecs = [dec1]; let _Bar; class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2311(this, [], _classDecs).c; + [_Bar, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; } static { _initClass(); @@ -14,7 +14,7 @@ _classDecs2 = [dec2]; let _Foo; class Foo extends (_Bar2 = _Bar) { static { - [_Foo, _initClass2] = babelHelpers.applyDecs2311(this, [], _classDecs2, 0, void 0, _Bar2).c; + [_Foo, _initClass2] = babelHelpers.applyDecs2311(this, _classDecs2, [], 0, void 0, _Bar2).c; } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/initializers/output.js index 404b2bed89af..515698f33242 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/initializers/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } @@ -19,7 +19,7 @@ new class extends babelHelpers.identity { static { class Bar extends (_Foo2 = _Foo) { static { - [_Bar, _initClass2] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _Foo2).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _Foo2).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js index b8d1119bc02b..44c44b690ea4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js @@ -28,7 +28,7 @@ new class extends babelHelpers.identity { ({ e: [_init_accessor, _init_extra_accessor, _init_property, _init_extra_property, _initStatic], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(this, [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]], [dec])); + } = babelHelpers.applyDecs2311(this, [dec], [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]])); _initStatic(this); } static get accessor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-installed-on-correct-class/output.js index b29eac2accf9..4b76ee31072f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-installed-on-correct-class/output.js @@ -6,7 +6,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } static get a() { return _Foo.#B; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-this/output.js index 33e970129505..56493032c6ea 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-this/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-with-expr/output.js index d55e25993be2..e678b37b21fe 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-with-expr/output.js @@ -2,7 +2,7 @@ var _initClass, _Bar; const dec = () => {}; const Foo = (class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } bar = new _Bar(); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement/output.js index a9f0830c1061..9ef5852f437c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 911afeca8a1b..2114a1271628 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -14,4 +14,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, _computedKey], [dec, 2, _computedKey2]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 161f51580071..cc737dc4095a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -14,4 +14,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, _computedKey], [dec, 2, _computedKey2]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/method-and-field/output.js index e0a8dd9f7a89..2ef58483d6b3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/method-and-field/output.js @@ -10,4 +10,4 @@ class Foo { } } _Foo = Foo; -[_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; +[_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, "a"], [dec, 0, "a"]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/methods-with-same-key/output.js index 29fdeb0d8001..e357b6c45afd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -12,4 +12,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, "a"], [dec, 2, "a"]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-ast/output.js index 1256749f8886..37a7ee8d7974 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-ast/output.js @@ -4,7 +4,7 @@ _computedKey = babelHelpers.toPropertyKey(getKey()); _computedKey2 = babelHelpers.toPropertyKey(getKey()); class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, _computedKey], [dec, 2, _computedKey2]]).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-value/output.js index 574c05c08edc..abfbec73ecdc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/computed-keys-same-value/output.js @@ -4,7 +4,7 @@ _computedKey = babelHelpers.toPropertyKey(getKeyI()); _computedKey2 = babelHelpers.toPropertyKey(getKeyJ()); class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, _computedKey], [dec, 2, _computedKey2]]).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/method-and-field/output.js index 78789aedacdd..8c92875bcfd2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/method-and-field/output.js @@ -2,7 +2,7 @@ var _initProto, _init_a, _init_extra_a; const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; + [_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a"], [dec, 0, "a"]]).e; } constructor() { _init_extra_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/methods-with-same-key/output.js index 28575703feb5..99aa22c5b502 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-duplicated-keys/methods-with-same-key/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a"], [dec, 2, "a"]]).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs index 84d20cf2858f..3a016c7c602c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs @@ -3,7 +3,7 @@ _classDecs = [dec]; let _A; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, [], _classDecs).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs index f57d0dc1c2f6..165105706015 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs @@ -3,7 +3,7 @@ _classDecs = [dec]; let _default2; class _default { static { - [_default2, _initClass] = babelHelpers.applyDecs2311(babelHelpers.setFunctionName(this, "default"), [], _classDecs).c; + [_default2, _initClass] = babelHelpers.applyDecs2311(babelHelpers.setFunctionName(this, "default"), _classDecs, []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs index ab1e933356ff..5091fecaf4b8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs @@ -2,7 +2,7 @@ var _xDecs, _init_x, _init_extra_x; _xDecs = dec; export class A { static { - [_init_x, _init_extra_x] = babelHelpers.applyDecs2311(this, [[_xDecs, 0, "x"]], []).e; + [_init_x, _init_extra_x] = babelHelpers.applyDecs2311(this, [], [[_xDecs, 0, "x"]]).e; } constructor() { _init_extra_x(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs index 5100eac8c8a5..2f3f5c29fafc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs @@ -3,7 +3,7 @@ _classDecs = [dec]; let _A; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, [], _classDecs).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/context-name/output.js index 843b8d45e5bf..f433eb5ab4aa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo {} _Foo = Foo; -[_init_a, _init_extra_a, _init_a2, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(_Foo, [[dec, 8, "a"], [dec, 8, "a", o => babelHelpers.assertClassBrand(o, _Foo, _a)._, (o, v) => _a._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 8, "b"], [dec, 8, "c"], [dec, 8, 0], [dec, 8, 1], [dec, 8, 2n], [dec, 8, 3n], [dec, 8, _computedKey]], []).e; +[_init_a, _init_extra_a, _init_a2, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 8, "a"], [dec, 8, "a", o => babelHelpers.assertClassBrand(o, _Foo, _a)._, (o, v) => _a._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 8, "b"], [dec, 8, "c"], [dec, 8, 0], [dec, 8, 1], [dec, 8, 2n], [dec, 8, 3n], [dec, 8, _computedKey]]).e; babelHelpers.defineProperty(Foo, "a", _init_a()); var _a = { _: (_init_extra_a(), _init_a2()) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/private/output.js index 0fd0b143cbab..a571d5343162 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/private/output.js @@ -10,4 +10,4 @@ class Foo { } } _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet2(o, _a), (o, v) => babelHelpers.classPrivateFieldSet2(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet2(o, _b), (o, v) => babelHelpers.classPrivateFieldSet2(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet2(o, _a), (o, v) => babelHelpers.classPrivateFieldSet2(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet2(o, _b), (o, v) => babelHelpers.classPrivateFieldSet2(o, _b, v)]], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/public/output.js index cccbca3a34a8..a6f2cf5241b4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/public/output.js @@ -9,4 +9,4 @@ class Foo { } } _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, 'c']], []).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, 'c']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-private/output.js index e7cf09e5b939..a9765d04cee7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _Foo; const dec = () => {}; class Foo {} _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [[dec, 8, "a", o => babelHelpers.assertClassBrand(o, _Foo, _a)._, (o, v) => _a._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 8, "b", o => babelHelpers.assertClassBrand(o, _Foo, _b)._, (o, v) => _b._ = babelHelpers.assertClassBrand(o, _Foo, v)]], []).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 8, "a", o => babelHelpers.assertClassBrand(o, _Foo, _a)._, (o, v) => _a._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 8, "b", o => babelHelpers.assertClassBrand(o, _Foo, _b)._, (o, v) => _b._ = babelHelpers.assertClassBrand(o, _Foo, v)]]).e; var _a = { _: _init_a() }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-public/output.js index 617834e616c3..6ec1f64cdf04 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields--to-es2015/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_ext const dec = () => {}; class Foo {} _Foo = Foo; -[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, 'c']], []).e; +[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, 'c']]).e; babelHelpers.defineProperty(Foo, "a", _init_a()); babelHelpers.defineProperty(Foo, "b", (_init_extra_a(), _init_b(123))); babelHelpers.defineProperty(Foo, 'c', (_init_extra_b(), _init_computedKey(456))); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/context-name/output.js index 2f25c8330c87..5c422b4003df 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo { static { - [_init_a, _init_extra_a, _init_a2, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(this, [[dec, 8, "a"], [dec, 8, "a", o => o.#a, (o, v) => o.#a = v], [dec, 8, "b"], [dec, 8, "c"], [dec, 8, 0], [dec, 8, 1], [dec, 8, 2n], [dec, 8, 3n], [dec, 8, _computedKey]], []).e; + [_init_a, _init_extra_a, _init_a2, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(this, [], [[dec, 8, "a"], [dec, 8, "a", o => o.#a, (o, v) => o.#a = v], [dec, 8, "b"], [dec, 8, "c"], [dec, 8, 0], [dec, 8, 1], [dec, 8, 2n], [dec, 8, 3n], [dec, 8, _computedKey]]).e; } static a = _init_a(); static #a = (_init_extra_a(), _init_a2()); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/private/output.js index 7962debd4538..a7c2c3dab6c8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b; const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [[dec, 0, "a", o => o.#a, (o, v) => o.#a = v], [dec, 0, "b", o => o.#b, (o, v) => o.#b = v]], [], 0, _ => #b in _).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [], [[dec, 0, "a", o => o.#a, (o, v) => o.#a = v], [dec, 0, "b", o => o.#b, (o, v) => o.#b = v]], 0, _ => #b in _).e; } constructor() { _init_extra_b(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/public/output.js index 8e2a11e1c79e..740d8d701b2e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_ext const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, 'c']], []).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [], [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, 'c']]).e; } constructor() { _init_extra_computedKey(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-private/output.js index 9caf732da34c..ac76eba99560 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b; const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [[dec, 8, "a", o => o.#a, (o, v) => o.#a = v], [dec, 8, "b", o => o.#b, (o, v) => o.#b = v]], []).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b] = babelHelpers.applyDecs2311(this, [], [[dec, 8, "a", o => o.#a, (o, v) => o.#a = v], [dec, 8, "b", o => o.#b, (o, v) => o.#b = v]]).e; } static #a = _init_a(); static #b = (_init_extra_a(), _init_b(123)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-public/output.js index 93725938f3eb..0e85fbbc689e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-fields/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_ext const dec = () => {}; class Foo { static { - [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, 'c']], []).e; + [_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(this, [], [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, 'c']]).e; } static a = _init_a(); static b = (_init_extra_a(), _init_b(123)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/context-name/output.js index f27b02d24c41..e5e7ff512d54 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/context-name/output.js @@ -25,7 +25,7 @@ function _get_a() { return _call_a(this); } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 11, "a"], [dec, 11, "a", function () {}], [dec, 11, "b"], [dec, 11, "c"], [dec, 11, 0], [dec, 11, 1], [dec, 11, 2n], [dec, 11, 3n], [dec, 11, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 11, "a"], [dec, 11, "a", function () {}], [dec, 11, "b"], [dec, 11, "c"], [dec, 11, 0], [dec, 11, 1], [dec, 11, 2n], [dec, 11, 3n], [dec, 11, _computedKey]]).e; _initStatic(_Foo); })(); expect(logs).toStrictEqual(["computing f", "calling toPrimitive", "a", "#a", "b", "c", "0", "1", "2", "3", "f()"]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/private/output.js index b2fb4b9e9cf3..3a48fad849f0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/private/output.js @@ -14,6 +14,6 @@ _Foo = Foo; function _get_a() { return _call_a(this); } -[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 3, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 3, "a", function () { return this.value; -}]], [], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; +}]], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/public/output.js index 1649b5605d02..9f8c76b9ffb7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/public/output.js @@ -12,4 +12,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 3, "a"], [dec, 3, 'b']], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 3, "a"], [dec, 3, 'b']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-private/output.js index ffa2139f59c5..806f98e3566f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-private/output.js @@ -10,9 +10,9 @@ function _get_a() { return _call_a(this); } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 11, "a", function () { return this.value; - }]], []).e; + }]]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-public/output.js index 0e861ad085b3..e9ea629d544c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } _Foo = Foo; (() => { - [_initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 11, "a"], [dec, 11, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 11, "a"], [dec, 11, 'b']]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/private/output.js index 51c48f52c0be..25c91bf8dfaa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/private/output.js @@ -20,8 +20,8 @@ function _get_a() { function _set_a(v) { _call_a2(this, v); } -[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 3, "a", function () { +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 3, "a", function () { return this.value; }], [dec, 4, "a", function (v) { this.value = v; -}]], [], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; +}]], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/public/output.js index 6e740147b071..5c4ba973e377 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/public/output.js @@ -18,4 +18,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-private/output.js index c4d98ab03fb5..c997ff4cbbaf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-private/output.js @@ -16,11 +16,11 @@ function _set_a(v) { _call_a2(this, v); } (() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 11, "a", function () { return this.value; }], [dec, 12, "a", function (v) { this.value = v; - }]], []).e; + }]]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-public/output.js index 14087aeab2d1..0d4de8460a6a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters--to-es2015/static-public/output.js @@ -16,7 +16,7 @@ class Foo { } _Foo = Foo; (() => { - [_initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, 'b'], [dec, 12, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, 'b'], [dec, 12, 'b']]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/private/output.js index 2942095be5e2..e4727923feb4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/private/output.js @@ -2,11 +2,11 @@ var _initProto, _call_a, _call_a2; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "a", function () { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "a", function () { return this.value; }], [dec, 4, "a", function (v) { this.value = v; - }]], [], 0, _ => #a in _).e; + }]], 0, _ => #a in _).e; } value = (_initProto(this), 1); get #a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/public/output.js index 915fae6d4c75..83a4455a8289 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/public/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, 'b'], [dec, 4, 'b']]).e; } value = (_initProto(this), 1); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-private/output.js index f678649b46f7..bfbd5a0892db 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-private/output.js @@ -2,11 +2,11 @@ var _initStatic, _call_a, _call_a2; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 11, "a", function () { return this.value; }], [dec, 12, "a", function (v) { this.value = v; - }]], []).e; + }]]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-public/output.js index f38f1df487bb..861739353c0f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters-and-setters/static-public/output.js @@ -2,7 +2,7 @@ var _initStatic; const dec = () => {}; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2311(this, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, 'b'], [dec, 12, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, 'b'], [dec, 12, 'b']]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/context-name/output.js index 99938aef122a..004ffb01b827 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 11, "a"], [dec, 11, "a", function () {}], [dec, 11, "b"], [dec, 11, "c"], [dec, 11, 0], [dec, 11, 1], [dec, 11, 2n], [dec, 11, 3n], [dec, 11, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 11, "a"], [dec, 11, "a", function () {}], [dec, 11, "b"], [dec, 11, "c"], [dec, 11, 0], [dec, 11, 1], [dec, 11, 2n], [dec, 11, 3n], [dec, 11, _computedKey]]).e; _initStatic(this); } static get a() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/private/output.js index 53866a593fe8..796b1fdfc55c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/private/output.js @@ -2,9 +2,9 @@ var _initProto, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "a", function () { return this.value; - }]], [], 0, _ => #a in _).e; + }]], 0, _ => #a in _).e; } value = (_initProto(this), 1); get #a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/public/output.js index c475bdf563b8..c8e04537ce58 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/public/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "a"], [dec, 3, 'b']], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "a"], [dec, 3, 'b']]).e; } value = (_initProto(this), 1); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-private/output.js index 6505e5f78125..a6b16969db56 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-private/output.js @@ -2,9 +2,9 @@ var _initStatic, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 11, "a", function () { return this.value; - }]], []).e; + }]]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-public/output.js index 3b3551c3bcc7..2dca6efda67a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-getters/static-public/output.js @@ -2,7 +2,7 @@ var _initStatic; const dec = () => {}; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2311(this, [[dec, 11, "a"], [dec, 11, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 11, "a"], [dec, 11, 'b']]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/context-name/output.js index 6a85d5f613dd..1f09056249bb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/context-name/output.js @@ -22,7 +22,7 @@ class Foo { } _Foo = Foo; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 10, "a"], [dec, 10, "a", function () {}], [dec, 10, "b"], [dec, 10, "c"], [dec, 10, 0], [dec, 10, 1], [dec, 10, 2n], [dec, 10, 3n], [dec, 10, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 10, "a"], [dec, 10, "a", function () {}], [dec, 10, "b"], [dec, 10, "c"], [dec, 10, 0], [dec, 10, 1], [dec, 10, 2n], [dec, 10, 3n], [dec, 10, _computedKey]]).e; _initStatic(_Foo); })(); var _a = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js index f8edc1c4df65..6bf5b5dace9c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js @@ -14,4 +14,4 @@ class Foo { } } _Foo = Foo; -[_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(_Foo, [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private/output.js index ac47565dd432..a0adf2970613 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private/output.js @@ -11,6 +11,6 @@ class Foo { } } _Foo = Foo; -[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, "a", function () { return this.value; -}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; +}]], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/public/output.js index 749d9bf6bad8..f6e4ec79d2ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/public/output.js @@ -12,4 +12,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 2, "a"], [dec, 2, 'b']], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, "a"], [dec, 2, 'b']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-private/output.js index dd80252f9cd3..ef616f6ba6ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-private/output.js @@ -7,9 +7,9 @@ class Foo { } _Foo = Foo; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 10, "a", function () { return this.value; - }]], []).e; + }]]).e; _initStatic(_Foo); })(); var _a = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-public/output.js index 6f9b0f309366..9eb3f43c84ef 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } _Foo = Foo; (() => { - [_initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 10, "a"], [dec, 10, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 10, "a"], [dec, 10, 'b']]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/context-name/output.js index 85ca1cbe0971..e7fe92877e78 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 10, "a"], [dec, 10, "a", function () {}], [dec, 10, "b"], [dec, 10, "c"], [dec, 10, 0], [dec, 10, 1], [dec, 10, 2n], [dec, 10, 3n], [dec, 10, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 10, "a"], [dec, 10, "a", function () {}], [dec, 10, "b"], [dec, 10, "c"], [dec, 10, 0], [dec, 10, 1], [dec, 10, 2n], [dec, 10, 3n], [dec, 10, _computedKey]]).e; _initStatic(this); } static #a = _call_a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js index 5cd05f6fcdf0..8132cc2a3356 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js @@ -4,7 +4,7 @@ _gDecs = dec; _agDecs = dec; class Foo { static { - [_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(this, [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], [], 0, _ => #a in _).e; + [_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(this, [], [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], 0, _ => #a in _).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private/output.js index 96ba24b84dbc..350c1e195e49 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private/output.js @@ -2,9 +2,9 @@ var _initProto, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a", function () { return this.value; - }]], [], 0, _ => #a in _).e; + }]], 0, _ => #a in _).e; } #a = _call_a; value = (_initProto(this), 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/public/output.js index 6dce1d249bd7..109374797d9b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/public/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "a"], [dec, 2, 'b']], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a"], [dec, 2, 'b']]).e; } value = (_initProto(this), 1); a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-private/output.js index da9ba1e6cd97..1d2a4f5c930a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-private/output.js @@ -2,9 +2,9 @@ var _initStatic, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 10, "a", function () { return this.value; - }]], []).e; + }]]).e; _initStatic(this); } static #a = _call_a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-public/output.js index 5af0db674a22..a0f1caea500b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/static-public/output.js @@ -2,7 +2,7 @@ var _initStatic; const dec = () => {}; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2311(this, [[dec, 10, "a"], [dec, 10, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 10, "a"], [dec, 10, 'b']]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initProto-existing-derived-constructor/output.js index 60de81ad1792..9f44f7bece20 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -19,7 +19,7 @@ method() {} } _A = A; - [_initProto] = babelHelpers.applyDecs2311(_A, [[deco, 2, "method"]], [], 0, void 0, B).e; + [_initProto] = babelHelpers.applyDecs2311(_A, [], [[deco, 2, "method"]], 0, void 0, B).e; let instance = new A(); expect(self).toBe(instance); expect(a).toBe(2); @@ -57,7 +57,7 @@ } } _A2 = A; - [_initProto2] = babelHelpers.applyDecs2311(_A2, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto2] = babelHelpers.applyDecs2311(_A2, [], [[dec, 2, "method"]], 0, void 0, B).e; new A(); expect(log + "").toBe("103,4"); } @@ -78,7 +78,7 @@ } } _A3 = A; - [_initProto3] = babelHelpers.applyDecs2311(_A3, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto3] = babelHelpers.applyDecs2311(_A3, [], [[dec, 2, "method"]], 0, void 0, B).e; new A(); } }(); @@ -102,7 +102,7 @@ noop() {} } _A4 = A; - [_initProto4] = babelHelpers.applyDecs2311(_A4, [[dec, 2, "method"], [_noopDecs, 2, "noop"]], [], 0, void 0, B).e; + [_initProto4] = babelHelpers.applyDecs2311(_A4, [], [[dec, 2, "method"], [_noopDecs, 2, "noop"]], 0, void 0, B).e; new A(); } }(); @@ -127,7 +127,7 @@ } } _A5 = A; - [_initProto5] = babelHelpers.applyDecs2311(_A5, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto5] = babelHelpers.applyDecs2311(_A5, [], [[dec, 2, "method"]], 0, void 0, B).e; new A(); expect(log + "").toBe("109,10"); } @@ -144,14 +144,14 @@ log.push(_initProto7(super(12)).method()); } noop() {} - }, [_initProto7] = babelHelpers.applyDecs2311(_Dummy2, [[_noopDecs2, 2, "noop"]], [], 0, void 0, B).e, _Dummy2))(); + }, [_initProto7] = babelHelpers.applyDecs2311(_Dummy2, [], [[_noopDecs2, 2, "noop"]], 0, void 0, B).e, _Dummy2))(); } method() { return this.a; } } _A6 = A; - [_initProto6] = babelHelpers.applyDecs2311(_A6, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto6] = babelHelpers.applyDecs2311(_A6, [], [[dec, 2, "method"]], 0, void 0, B).e; new A(); expect(log + "").toBe("111,12"); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/super-in-decorator/output.js index 10b8fcbe364f..739c5dff4e08 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/super-in-decorator/output.js @@ -14,7 +14,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2311(_C2, [[_m2Decs, 18, "m2"]], _classDecs, 1)); + } = babelHelpers.applyDecs2311(_C2, _classDecs, [[_m2Decs, 18, "m2"]], 1)); _initClass(); } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js index 8693d19c84b2..9df93db43a1b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js @@ -14,5 +14,5 @@ _A2 = A; ({ e: [_init_x, _init_extra_x, _init_y, _init_extra_y], c: [_A, _initClass] -} = babelHelpers.applyDecs2311(_A2, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], _classDecs, 1)); +} = babelHelpers.applyDecs2311(_A2, _classDecs, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js index c79ed2d3d9c3..3da5d88b640a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js @@ -16,12 +16,12 @@ class Foo { babelHelpers.defineProperty(this, "bar", _init_bar(this)); _init_extra_bar(this); } - }, [_init_bar, _init_extra_bar] = babelHelpers.applyDecs2311(_Nested, [[_barDecs, 0, "bar"]], []).e, _Nested); + }, [_init_bar, _init_extra_bar] = babelHelpers.applyDecs2311(_Nested, [], [[_barDecs, 0, "bar"]]).e, _Nested); } } _Foo2 = Foo; ({ e: [_initProto], c: [_Foo, _initClass] -} = babelHelpers.applyDecs2311(_Foo2, [[_methodDecs, 18, "method"]], _classDecs, 1)); +} = babelHelpers.applyDecs2311(_Foo2, _classDecs, [[_methodDecs, 18, "method"]], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js index 3648ed19cc17..73a28f53c621 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _init_extra_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_extra_r, _init_d, _init_extra_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_extra_h, _init_i, _init_extra_i, _init_n, _init_extra_n, _init_a, _init_extra_a, _init_e, _init_extra_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2311(this, [[dec, 10, "j"], [dec, 11, "k"], [dec, 12, "l"], [dec, 9, "m"], [dec, 10, "o", function () {}], [dec, 11, "p", function () {}], [dec, 12, "q", function (v) {}], [dec, 9, "r", o => o.#D, (o, v) => o.#D = v], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 2, "f", function () {}], [dec, 3, "g", function () {}], [dec, 4, "g", function (v) {}], [dec, 1, "h", o => o.#B, (o, v) => o.#B = v], [dec, 8, "i"], [dec, 8, "n", o => o.#n, (o, v) => o.#n = v], [dec, 0, "a"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v]], [dec], 0, _ => #e in _)); + } = babelHelpers.applyDecs2311(this, [dec], [[dec, 10, "j"], [dec, 11, "k"], [dec, 12, "l"], [dec, 9, "m"], [dec, 10, "o", function () {}], [dec, 11, "p", function () {}], [dec, 12, "q", function (v) {}], [dec, 9, "r", o => o.#D, (o, v) => o.#D = v], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 2, "f", function () {}], [dec, 3, "g", function () {}], [dec, 4, "g", function (v) {}], [dec, 1, "h", o => o.#B, (o, v) => o.#B = v], [dec, 8, "i"], [dec, 8, "n", o => o.#n, (o, v) => o.#n = v], [dec, 0, "a"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v]], 0, _ => #e in _)); _initStatic(this); } constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js index 950fda28c2f0..32c0f19acf82 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _methodDecs = deco; class A extends (_B = B) { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[_methodDecs, 2, "method"]], [], 0, void 0, _B).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[_methodDecs, 2, "method"]], 0, void 0, _B).e; } constructor() { if (Math.random() > 0.5) { @@ -17,7 +17,7 @@ class A extends (_B = B) { _methodDecs2 = deco; class C extends (_B2 = B) { static { - [_initProto2] = babelHelpers.applyDecs2311(this, [[_methodDecs2, 2, "method"]], [], 0, void 0, _B2).e; + [_initProto2] = babelHelpers.applyDecs2311(this, [], [[_methodDecs2, 2, "method"]], 0, void 0, _B2).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor/output.js index 7c691b112391..7c6303ac8107 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor/output.js @@ -13,7 +13,7 @@ } class A extends B { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[deco, 2, "method"]], [], 0, void 0, B).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[deco, 2, "method"]], 0, void 0, B).e; } constructor() { let a = 2; @@ -46,7 +46,7 @@ let log = []; class A extends B { static { - [_initProto2] = babelHelpers.applyDecs2311(this, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto2] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "method"]], 0, void 0, B).e; } constructor() { log.push(_initProto2(super(3)).method()); @@ -73,7 +73,7 @@ _computedKey = babelHelpers.toPropertyKey((key = super(5).method(), log.push(key), key)); class A extends B { static { - [_initProto3] = babelHelpers.applyDecs2311(this, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto3] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "method"]], 0, void 0, B).e; } constructor() { log.push(super(6).method()); @@ -98,7 +98,7 @@ _noopDecs = noop(log.push(super(7).method())); class A extends B { static { - [_initProto4] = babelHelpers.applyDecs2311(this, [[dec, 2, "method"], [_noopDecs, 2, "noop"]], [], 0, void 0, B).e; + [_initProto4] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "method"], [_noopDecs, 2, "noop"]], 0, void 0, B).e; } constructor() { log.push(_initProto4(super(8)).method()); @@ -119,7 +119,7 @@ let log = []; class A extends B { static { - [_initProto5] = babelHelpers.applyDecs2311(this, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto5] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "method"]], 0, void 0, B).e; } constructor() { let key; @@ -144,13 +144,13 @@ const noop = () => fn => fn; class A extends B { static { - [_initProto6] = babelHelpers.applyDecs2311(this, [[dec, 2, "method"]], [], 0, void 0, B).e; + [_initProto6] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "method"]], 0, void 0, B).e; } constructor() { var _initProto7, _noopDecs2; new (_noopDecs2 = noop(log.push(_initProto6(super(11)).method())), class Dummy extends B { static { - [_initProto7] = babelHelpers.applyDecs2311(this, [[_noopDecs2, 2, "noop"]], [], 0, void 0, B).e; + [_initProto7] = babelHelpers.applyDecs2311(this, [], [[_noopDecs2, 2, "noop"]], 0, void 0, B).e; } constructor() { log.push(_initProto7(super(12)).method()); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/setting-shadowed-private-method-valid/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/setting-shadowed-private-method-valid/output.js index ca364a585a84..f7bd9a42d75b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/setting-shadowed-private-method-valid/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/setting-shadowed-private-method-valid/output.js @@ -2,14 +2,14 @@ var _initProto, _call_x; const dec = () => {}; class Foo { static { - [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "x", function () { class Nested { static #x; static set x(v) { this.#x = v; } } - }]], [], 0, _ => #x in _).e; + }]], 0, _ => #x in _).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-decorator/output.js index 07ef26247372..353c0958663c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-decorator/output.js @@ -9,7 +9,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2311(this, [[_m2Decs, 18, "m2"]], _classDecs, 1)); + } = babelHelpers.applyDecs2311(this, _classDecs, [[_m2Decs, 18, "m2"]], 1)); } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-nested-constructor-expression/output.js index c07e017c53de..ce0615628fa0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends (_Bar = Bar) { static { - [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [], [dec], 0, void 0, _Bar).c; + [_Foo, _initClass] = babelHelpers.applyDecs2311(this, [dec], [], 0, void 0, _Bar).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-accessor/output.js index 49cc1c1516f6..a3c4a3210885 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-accessor/output.js @@ -2,9 +2,9 @@ var _initProto, _call_x, _Bar; const dec = () => {}; class Foo extends (_Bar = Bar) { static { - [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 3, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); - }]], [], 0, _ => #x in _, _Bar).e; + }]], 0, _ => #x in _, _Bar).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-method/output.js index 1a579325c1e2..abda3bc3524d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/super-in-private-method/output.js @@ -2,9 +2,9 @@ var _initProto, _call_x, _Bar; const dec = () => {}; class Foo extends (_Bar = Bar) { static { - [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); - }]], [], 0, _ => #x in _, _Bar).e; + }]], 0, _ => #x in _, _Bar).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js index 573fdd815815..ef45de50a907 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js @@ -8,7 +8,7 @@ class A { ({ e: [_init_x, _init_extra_x, _init_y, _init_extra_y], c: [_A, _initClass] - } = babelHelpers.applyDecs2311(this, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], _classDecs, 1)); + } = babelHelpers.applyDecs2311(this, _classDecs, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], 1)); } constructor() { _init_extra_y(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js index f8c11b260efd..400e9a769a81 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js @@ -8,7 +8,7 @@ class Foo { ({ e: [_initProto], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(this, [[_methodDecs, 18, "method"]], _classDecs, 1)); + } = babelHelpers.applyDecs2311(this, _classDecs, [[_methodDecs, 18, "method"]], 1)); } #a = void _initProto(this); method() {} @@ -16,7 +16,7 @@ class Foo { var _barDecs, _init_bar, _init_extra_bar; return _barDecs = [this, this.#a], class Nested { static { - [_init_bar, _init_extra_bar] = babelHelpers.applyDecs2311(this, [[_barDecs, 16, "bar"]], []).e; + [_init_bar, _init_extra_bar] = babelHelpers.applyDecs2311(this, [], [[_barDecs, 16, "bar"]]).e; } constructor() { _init_extra_bar(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js index 37553d2f21b4..84ea6d1ace13 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js @@ -8,4 +8,4 @@ class A { method() {} } _A = A; -[_initProto] = babelHelpers.applyDecs2311(_A, [[_methodDecs, 18, "method"]], []).e; +[_initProto] = babelHelpers.applyDecs2311(_A, [], [[_methodDecs, 18, "method"]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js index c6ee9ed4a6c8..b27bdea8ac5b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js @@ -3,7 +3,7 @@ let fn, obj; _methodDecs = [void 0, fn(), _obj = obj.prop, _obj.foo]; class A { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[_methodDecs, 18, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[_methodDecs, 18, "method"]]).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/context-name/output.js index 62b70d6ed907..5dd1d0c3a317 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/context-name/output.js @@ -25,7 +25,7 @@ function _set_a(v) { _call_a(this, v); } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 12, "a"], [dec, 12, "a", function (v) {}], [dec, 12, "b"], [dec, 12, "c"], [dec, 12, 0], [dec, 12, 1], [dec, 12, 2n], [dec, 12, 3n], [dec, 12, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 12, "a"], [dec, 12, "a", function (v) {}], [dec, 12, "b"], [dec, 12, "c"], [dec, 12, 0], [dec, 12, 1], [dec, 12, 2n], [dec, 12, 3n], [dec, 12, _computedKey]]).e; _initStatic(_Foo); })(); expect(logs).toStrictEqual(["computing f", "calling toPrimitive", "a", "#a", "b", "c", "0", "1", "2", "3", "f()"]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/private/output.js index bbbc7216c643..518909dafe0f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/private/output.js @@ -14,6 +14,6 @@ _Foo = Foo; function _set_a(v) { _call_a(this, v); } -[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 4, "a", function (v) { +[_call_a, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 4, "a", function (v) { return this.value = v; -}]], [], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; +}]], 0, _ => _Foo_brand.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/public/output.js index 99282d824181..b7744796c707 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/public/output.js @@ -12,4 +12,4 @@ class Foo { } } _Foo = Foo; -[_initProto] = babelHelpers.applyDecs2311(_Foo, [[dec, 4, "a"], [dec, 4, 'b']], []).e; +[_initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 4, "a"], [dec, 4, 'b']]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-private/output.js index 70f38f3a215e..f3755e3d4304 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-private/output.js @@ -10,9 +10,9 @@ function _set_a(v) { _call_a(this, v); } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 12, "a", function (v) { return this.value = v; - }]], []).e; + }]]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-public/output.js index c22183df82b8..980d05ec97df 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } _Foo = Foo; (() => { - [_initStatic] = babelHelpers.applyDecs2311(_Foo, [[dec, 12, "a"], [dec, 12, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 12, "a"], [dec, 12, 'b']]).e; _initStatic(_Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/context-name/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/context-name/output.js index 9201f094f5fa..951f772c1a55 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/context-name/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/context-name/output.js @@ -12,7 +12,7 @@ const f = () => { _computedKey = babelHelpers.toPropertyKey(f()); class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 12, "a"], [dec, 12, "a", function (v) {}], [dec, 12, "b"], [dec, 12, "c"], [dec, 12, 0], [dec, 12, 1], [dec, 12, 2n], [dec, 12, 3n], [dec, 12, _computedKey]], []).e; + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 12, "a"], [dec, 12, "a", function (v) {}], [dec, 12, "b"], [dec, 12, "c"], [dec, 12, 0], [dec, 12, 1], [dec, 12, 2n], [dec, 12, 3n], [dec, 12, _computedKey]]).e; _initStatic(this); } static set a(v) {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/private/output.js index c2125d888a91..8b1c566be20f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/private/output.js @@ -2,9 +2,9 @@ var _initProto, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [[dec, 4, "a", function (v) { + [_call_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 4, "a", function (v) { return this.value = v; - }]], [], 0, _ => #a in _).e; + }]], 0, _ => #a in _).e; } value = (_initProto(this), 1); set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/public/output.js index 48698e7696e9..dcf8c2b84712 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/public/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2311(this, [[dec, 4, "a"], [dec, 4, 'b']], []).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 4, "a"], [dec, 4, 'b']]).e; } value = (_initProto(this), 1); set a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-private/output.js index 8f4b4cefb216..2485832f2621 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-private/output.js @@ -2,9 +2,9 @@ var _initStatic, _call_a; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [[dec, 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 12, "a", function (v) { return this.value = v; - }]], []).e; + }]]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-public/output.js index 486ad9ae57ed..8c7d75cd01da 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-setters/static-public/output.js @@ -2,7 +2,7 @@ var _initStatic; const dec = () => {}; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2311(this, [[dec, 12, "a"], [dec, 12, 'b']], []).e; + [_initStatic] = babelHelpers.applyDecs2311(this, [], [[dec, 12, "a"], [dec, 12, 'b']]).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js index d65663f260b6..da2addb67c99 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js @@ -7,6 +7,6 @@ const result = ((_Class = class { constructor() { this.value = expectedValue; } -}, [_decorated_class, _initClass] = babelHelpers.applyDecs2311(_Class, [], [decorator]).c, _initClass()), _decorated_class); +}, [_decorated_class, _initClass] = babelHelpers.applyDecs2311(_Class, [decorator], []).c, _initClass()), _decorated_class); expect(result.decoratorValue).toBe(expectedValue); expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js index d65663f260b6..da2addb67c99 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js @@ -7,6 +7,6 @@ const result = ((_Class = class { constructor() { this.value = expectedValue; } -}, [_decorated_class, _initClass] = babelHelpers.applyDecs2311(_Class, [], [decorator]).c, _initClass()), _decorated_class); +}, [_decorated_class, _initClass] = babelHelpers.applyDecs2311(_Class, [decorator], []).c, _initClass()), _decorated_class); expect(result.decoratorValue).toBe(expectedValue); expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-call-in-decorator/output.js b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-call-in-decorator/output.js index f65386676616..e200a4a08dbb 100644 --- a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-call-in-decorator/output.js +++ b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-call-in-decorator/output.js @@ -17,7 +17,7 @@ let Outer = /*#__PURE__*/function (_Hello) { _init_extra_hello(this); }); _Inner = Inner; - [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [[_helloDecs, 0, "hello"]], []).e; + [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[_helloDecs, 0, "hello"]]).e; return babelHelpers.possibleConstructorReturn(_this, new Inner()); } return babelHelpers.createClass(Outer); diff --git a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js index 0d13cca1053d..364c88e6dd7a 100644 --- a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js +++ b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js @@ -26,7 +26,7 @@ let Outer = /*#__PURE__*/function (_Hello) { _init_extra_hello(this); }); _Inner = Inner; - [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [[_helloDecs, 0, "hello"]], []).e; + [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[_helloDecs, 0, "hello"]]).e; return babelHelpers.possibleConstructorReturn(_this, new Inner()); } return babelHelpers.createClass(Outer); From 5bb0b08c0518aabce11e7c88b7cf78d33235dbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Feb 2024 12:48:57 +0100 Subject: [PATCH 2/6] Pass decorators to applyDecs2311 in lexical order --- .../src/decorators.ts | 4 +- .../babel-helpers/src/helpers-generated.ts | 4 +- .../src/helpers/applyDecs2311.ts | 93 +++++++++++-------- .../method-and-field/output.js | 2 +- .../method-and-field/output.js | 2 +- .../2023-11-misc/all-decorators/output.js | 2 +- 6 files changed, 60 insertions(+), 47 deletions(-) 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 595d5e03267e..5aefd41ace68 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -1311,7 +1311,9 @@ function transformClass( toSortedDecoratorInfo(elementDecoratorInfo); const elementDecorations = generateDecorationExprs( - sortedElementDecoratorInfo, + process.env.BABEL_8_BREAKING || version === "2023-11" + ? elementDecoratorInfo + : sortedElementDecoratorInfo, version, ); diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 03d5987dddc7..849f6d71823b 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -48,10 +48,10 @@ export default Object.freeze({ "7.21.0", 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2305(e,t,r,n,o,a){function i(e,t,r){return function(n,o){return r&&r(n),e[t].call(n,o)}}function c(e,t){for(var r=0;r=0;j-=r?2:1){var D=v[j],E=r?v[j-1]:void 0,I={},O={kind:["field","accessor","method","getter","setter","class"][o],name:n,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");s(t,"An initializer","be",!0),c.push(t)}.bind(null,I)};try{if(b)(y=s(D.call(E,P,O),"class decorators","return"))&&(P=y);else{var k,F;O.static=l,O.private=f,f?2===o?k=function(e){return m(e),w.value}:(o<4&&(k=i(w,"get",m)),3!==o&&(F=i(w,"set",m))):(k=function(e){return e[n]},(o<2||4===o)&&(F=function(e,t){e[n]=t}));var N=O.access={has:f?h.bind():function(e){return n in e}};if(k&&(N.get=k),F&&(N.set=F),P=D.call(E,d?{get:w.get,set:w.set}:w[A],O),d){if("object"==typeof P&&P)(y=s(P.get,"accessor.get"))&&(w.get=y),(y=s(P.set,"accessor.set"))&&(w.set=y),(y=s(P.init,"accessor.init"))&&S.push(y);else if(void 0!==P)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else s(P,(p?"field":"method")+" decorators","return")&&(p?S.push(P):w[A]=P)}}finally{I.v=!0}}return(p||d)&&u.push((function(e,t){for(var r=S.length-1;r>=0;r--)t=S[r].call(e,t);return t})),p||b||(f?d?u.push(i(w,"get"),i(w,"set")):u.push(2===o?w[A]:i.call.bind(w[A])):Object.defineProperty(e,n,w)),P}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var l=a[Symbol.metadata||Symbol.for("Symbol.metadata")];var f=Object.create(null==l?null:l),p=function(e,t,r,n){var o,a,i=[],s=function(t){return checkInRHS(t)===e},u=new Map;function l(e){e&&i.push(c.bind(null,e))}for(var f=0;f3,y=16&d,v=!!(8&d),g=0==(d&=7),b=h+"/"+v;if(!g&&!m){var w=u.get(b);if(!0===w||3===w&&4!==d||4===w&&3!==d)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);u.set(b,!(d>2)||d)}applyDec(v?e:e.prototype,p,y,m?"#"+h:toPropertyKey(h),d,n,v?a=a||[]:o=o||[],i,v,m,g,1===d,v&&m?s:r)}}return l(o),l(a),i}(e,t,o,f);return r.length||u(e,f),{e:p,get c(){var t=[];return r.length&&[u(applyDec(e,[r],n,e.name,5,f,t),f),c.bind(null,t,e)]}}}', ), - // size: 2917, gzip size: 1488 + // size: 2957, gzip size: 1507 applyDecs2311: helper( "7.23.0", - 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2311(e,t,n,r,o,i){var a,c,u=Symbol.metadata||Symbol.for("Symbol.metadata"),s=Object.defineProperty,f=Object.create,l=[f(null),f(null)],p=t.length;function d(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a=0;O-=n?2:1){var z=b[O],H=n?b[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");m(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(D)c=z.call(H,N,R),K.v=1,m(c,"class decorators","return")&&(N=c);else if(R.static=f,R.private=p,c=R.access={has:p?v.bind():function(e){return r in e}},j||(c.get=p?E?function(e){return g(e),P.value}:I("get",0,g):function(e){return e[r]}),E||S||(c.set=p?I("set",0,g):function(e,t){e[r]=t}),N=z.call(H,y?{get:P.get,set:P.set}:P[F],R),K.v=1,y){if("object"==typeof N&&N)(c=m(N.get,"accessor.get"))&&(P.get=c),(c=m(N.set,"accessor.set"))&&(P.set=c),(c=m(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else m(N,(h?"field":"method")+" decorators","return")&&(h?k.unshift(N):P[F]=N)}return o<2&&u.push(d(k,f,1),d(i,f,0)),h||D||(p?y?u.splice(-1,0,I("get",f),I("set",f)):u.push(E?P[F]:m.call.bind(P[F])):s(e,r,P)),N}function h(e){return s(e,u,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[u]),a=f(null==a?null:a),c=function(){var t,r,i=[];function a(e){e&&i.push(d(e))}for(var c=0;c=0;O-=n?2:1){var z=h[O],H=n?h[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(w)c=z.call(H,N,R),K.v=1,b(c,"class decorators","return")&&(N=c);else if(R.static=s,R.private=f,c=R.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=z.call(H,D?{get:P.get,set:P.set}:P[F],R),K.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;i {}; class Foo { static { - [_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a"], [dec, 0, "a"]]).e; + [_init_a, _init_extra_a, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 0, "a"], [dec, 2, "a"]]).e; } constructor() { _init_extra_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js index 73a28f53c621..5a9c61da601d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _init_extra_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_extra_r, _init_d, _init_extra_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_extra_h, _init_i, _init_extra_i, _init_n, _init_extra_n, _init_a, _init_extra_a, _init_e, _init_extra_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2311(this, [dec], [[dec, 10, "j"], [dec, 11, "k"], [dec, 12, "l"], [dec, 9, "m"], [dec, 10, "o", function () {}], [dec, 11, "p", function () {}], [dec, 12, "q", function (v) {}], [dec, 9, "r", o => o.#D, (o, v) => o.#D = v], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 2, "f", function () {}], [dec, 3, "g", function () {}], [dec, 4, "g", function (v) {}], [dec, 1, "h", o => o.#B, (o, v) => o.#B = v], [dec, 8, "i"], [dec, 8, "n", o => o.#n, (o, v) => o.#n = v], [dec, 0, "a"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v]], 0, _ => #e in _)); + } = babelHelpers.applyDecs2311(this, [dec], [[dec, 0, "a"], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v], [dec, 2, "f", function () {}], [dec, 3, "g", function () {}], [dec, 4, "g", function (v) {}], [dec, 1, "h", o => o.#B, (o, v) => o.#B = v], [dec, 8, "i"], [dec, 10, "j"], [dec, 11, "k"], [dec, 12, "l"], [dec, 9, "m"], [dec, 8, "n", o => o.#n, (o, v) => o.#n = v], [dec, 10, "o", function () {}], [dec, 11, "p", function () {}], [dec, 12, "q", function (v) {}], [dec, 9, "r", o => o.#D, (o, v) => o.#D = v]], 0, _ => #e in _)); _initStatic(this); } constructor() { From 245367a988c84b4d9861a234d3f6db7103ed40cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Feb 2024 18:46:11 +0100 Subject: [PATCH 3/6] More aggressively inline decorators in the static block --- babel.config.js | 1 - .../src/decorators.ts | 71 ++++++++++++++++--- .../output.js | 9 +-- .../2023-11-classes/inheritance/output.js | 8 +-- .../output.js | 9 +-- .../default-anonymous/output.mjs | 5 +- .../2023-11-exported/default-named/output.mjs | 5 +- .../member-decorator/output.mjs | 5 +- .../2023-11-exported/named/output.mjs | 5 +- .../private-async-and-generator/output.js | 7 +- .../private-async-and-generator/output.js | 7 +- .../2023-11-misc--to-es2015/this/output.js | 7 +- .../valid-expression-formats/output.js | 6 +- .../exec.js | 2 +- .../options.json | 0 .../output.js | 8 +-- .../test/fixtures/2023-11-misc/this/output.js | 7 +- .../valid-expression-formats/output.js | 6 +- .../output.js | 5 +- .../output.js | 5 +- .../super-property-in-decorator/output.js | 5 +- 21 files changed, 99 insertions(+), 84 deletions(-) rename packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/{class-tdz-during-decorators => class-not-available-during-decorators}/exec.js (76%) rename packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/{class-tdz-during-decorators => class-not-available-during-decorators}/options.json (100%) diff --git a/babel.config.js b/babel.config.js index 166fb9141323..86e4cf06e6aa 100644 --- a/babel.config.js +++ b/babel.config.js @@ -543,7 +543,6 @@ function pluginToggleBooleanFlag({ types: t }, { name, value }) { if (left.value === false) return res.replace(right.replacement); if (right.value === false) return res.replace(left.replacement); if (left.unrelated && right.unrelated) return res.unrelated(); - console.log(left, right); return res.replace( t.logicalExpression("||", left.replacement, right.replacement) ); 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 5aefd41ace68..9223ed7db0e2 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -751,6 +751,32 @@ function createPrivateBrandCheckClosure(brandName: t.PrivateName) { ); } +// Check if the expression does not reference function-specific +// context or the given identifier name. +// `true` means "maybe" and `false` means "no". +function usesFunctionContextOrRef( + expression: t.Node, + refName: string | undefined, +) { + try { + t.traverseFast(expression, node => { + if ( + t.isThisExpression(node) || + t.isSuper(node) || + t.isIdentifier(node, { name: "arguments" }) || + (t.isMetaProperty(node) && node.meta.name !== "import") || + (refName && t.isIdentifier(node, { name: refName })) + ) { + // TODO: Add early return support to t.traverseFast + throw null; + } + }); + return false; + } catch { + return true; + } +} + function checkPrivateMethodUpdateError( path: NodePath, decoratedPrivateMethods: Set, @@ -810,6 +836,8 @@ function transformClass( const classDecorators = path.node.decorators; let hasElementDecorators = false; + let hasComputedKeysSideEffects = false; + let elemDecsUseFnContext = false; const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path); @@ -868,6 +896,9 @@ function transformClass( break; } hasElementDecorators = true; + elemDecsUseFnContext ||= element.node.decorators.some(dec => + usesFunctionContextOrRef(dec, path.node.id?.name), + ); } else if (element.node.type === "ClassAccessorProperty") { // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings. propertyVisitor.ClassAccessorProperty( @@ -896,6 +927,10 @@ function transformClass( isStatic, ); } + + if ("computed" in element.node && element.node.computed) { + hasComputedKeysSideEffects ||= !scopeParent.isStatic(element.node.key); + } } if (!classDecorators && !hasElementDecorators) { @@ -922,14 +957,16 @@ function transformClass( // Memoise the this value `a.b` of decorator member expressions `@a.b.dec`, type HandleDecoratorExpressionsResult = { // whether the whole decorator list requires memoisation - needMemoise: boolean; + hasSideEffects: boolean; + usesFnContext: boolean; // the this value of each decorator if applicable decoratorsThis: (t.Expression | undefined)[]; }; function handleDecoratorExpressions( expressions: t.Expression[], ): HandleDecoratorExpressionsResult { - let needMemoise = false; + let hasSideEffects = false; + let usesFnContext = false; const decoratorsThis: (t.Expression | null)[] = []; for (const expression of expressions) { let object; @@ -954,11 +991,21 @@ function transformClass( } } decoratorsThis.push(object); - needMemoise ||= !scopeParent.isStatic(expression); + hasSideEffects ||= !scopeParent.isStatic(expression); + usesFnContext ||= usesFunctionContextOrRef( + expression, + path.node.id?.name, + ); } - return { needMemoise, decoratorsThis }; + return { hasSideEffects, usesFnContext, decoratorsThis }; } + const willExtractSomeElemDecs = + hasComputedKeysSideEffects || + (process.env.BABEL_8_BREAKING + ? elemDecsUseFnContext + : elemDecsUseFnContext || version !== "2023-11"); + let needsDeclaraionForClassBinding = false; let classDecorationsFlag = 0; let classDecorations: t.Expression[] = []; @@ -971,7 +1018,7 @@ function transformClass( path.node.decorators = null; const decoratorExpressions = classDecorators.map(el => el.expression); - const { needMemoise, decoratorsThis } = + const { hasSideEffects, decoratorsThis } = handleDecoratorExpressions(decoratorExpressions); const { haveThis, decs } = generateDecorationList( @@ -982,7 +1029,7 @@ function transformClass( classDecorationsFlag = haveThis ? 1 : 0; classDecorations = decs; - if (needMemoise) { + if (hasSideEffects && willExtractSomeElemDecs) { classDecorationsId = memoiseExpression( t.arrayExpression(classDecorations), "classDecs", @@ -1042,8 +1089,11 @@ function transformClass( if (hasDecorators) { const decoratorExpressions = decorators.map(d => d.expression); - const { needMemoise, decoratorsThis } = - handleDecoratorExpressions(decoratorExpressions); + const { + hasSideEffects, + usesFnContext: usesFunctionContext, + decoratorsThis, + } = handleDecoratorExpressions(decoratorExpressions); const { decs, haveThis } = generateDecorationList( decoratorExpressions, decoratorsThis, @@ -1051,7 +1101,10 @@ function transformClass( ); decoratorsHaveThis = haveThis; decoratorsArray = decs.length === 1 ? decs[0] : t.arrayExpression(decs); - if (needMemoise) { + if ( + usesFunctionContext || + (hasSideEffects && willExtractSomeElemDecs) + ) { decoratorsArray = memoiseExpression(decoratorsArray, name + "Decs"); } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js index 09db03f9f421..c3ff5ff5ffdd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes--to-es2015/replacement-static-decorator-initializer-this/output.js @@ -1,4 +1,4 @@ -var _initStatic, _initClass, _accessorDecs, _init_accessor, _init_extra_accessor, _getterDecs, _setterDecs, _methodDecs, _propertyDecs, _init_property, _init_extra_property, _A, _temp; +var _initStatic, _initClass, _init_accessor, _init_extra_accessor, _init_property, _init_extra_property, _A, _temp; let original, replaced, accessorThis, getterThis, setterThis, methodThis, propertyThis, classThis; function dec(Klass, context) { original = Klass; @@ -15,11 +15,6 @@ function captureInitializerThis(callback) { }); }; } -_accessorDecs = captureInitializerThis(v => accessorThis = v); -_getterDecs = captureInitializerThis(v => getterThis = v); -_setterDecs = captureInitializerThis(v => setterThis = v); -_methodDecs = captureInitializerThis(v => methodThis = v); -_propertyDecs = captureInitializerThis(v => propertyThis = v); let _Foo; new (_A = /*#__PURE__*/new WeakMap(), (_temp = class extends babelHelpers.identity { constructor() { @@ -44,7 +39,7 @@ new (_A = /*#__PURE__*/new WeakMap(), (_temp = class extends babelHelpers.identi ({ e: [_init_accessor, _init_extra_accessor, _init_property, _init_extra_property, _initStatic], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(_Foo2, [dec], [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]])); + } = babelHelpers.applyDecs2311(_Foo2, [dec], [[captureInitializerThis(v => accessorThis = v), 9, "accessor"], [captureInitializerThis(v => getterThis = v), 11, "getter"], [captureInitializerThis(v => setterThis = v), 12, "setter"], [captureInitializerThis(v => methodThis = v), 10, "method"], [captureInitializerThis(v => propertyThis = v), 8, "property"]])); _initStatic(_Foo2); })(); })(), _temp))(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js index 4932e6ffd722..f2553f964dd0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/inheritance/output.js @@ -1,20 +1,18 @@ -var _initClass, _classDecs, _initClass2, _classDecs2, _Bar2; +var _initClass, _initClass2, _Bar2; const dec = () => {}; -_classDecs = [dec1]; let _Bar; class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; + [_Bar, _initClass] = babelHelpers.applyDecs2311(this, [dec1], []).c; } static { _initClass(); } } -_classDecs2 = [dec2]; let _Foo; class Foo extends (_Bar2 = _Bar) { static { - [_Foo, _initClass2] = babelHelpers.applyDecs2311(this, _classDecs2, [], 0, void 0, _Bar2).c; + [_Foo, _initClass2] = babelHelpers.applyDecs2311(this, [dec2], [], 0, void 0, _Bar2).c; } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js index 44c44b690ea4..89e72ac02c2a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-classes/replacement-static-decorator-initializer-this/output.js @@ -1,4 +1,4 @@ -var _initStatic, _initClass, _accessorDecs, _init_accessor, _init_extra_accessor, _getterDecs, _setterDecs, _methodDecs, _propertyDecs, _init_property, _init_extra_property; +var _initStatic, _initClass, _init_accessor, _init_extra_accessor, _init_property, _init_extra_property; let original, replaced, accessorThis, getterThis, setterThis, methodThis, propertyThis, classThis; function dec(Klass, context) { original = Klass; @@ -15,11 +15,6 @@ function captureInitializerThis(callback) { }); }; } -_accessorDecs = captureInitializerThis(v => accessorThis = v); -_getterDecs = captureInitializerThis(v => getterThis = v); -_setterDecs = captureInitializerThis(v => setterThis = v); -_methodDecs = captureInitializerThis(v => methodThis = v); -_propertyDecs = captureInitializerThis(v => propertyThis = v); let _Foo; new class extends babelHelpers.identity { static { @@ -28,7 +23,7 @@ new class extends babelHelpers.identity { ({ e: [_init_accessor, _init_extra_accessor, _init_property, _init_extra_property, _initStatic], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(this, [dec], [[_accessorDecs, 9, "accessor"], [_getterDecs, 11, "getter"], [_setterDecs, 12, "setter"], [_methodDecs, 10, "method"], [_propertyDecs, 8, "property"]])); + } = babelHelpers.applyDecs2311(this, [dec], [[captureInitializerThis(v => accessorThis = v), 9, "accessor"], [captureInitializerThis(v => getterThis = v), 11, "getter"], [captureInitializerThis(v => setterThis = v), 12, "setter"], [captureInitializerThis(v => methodThis = v), 10, "method"], [captureInitializerThis(v => propertyThis = v), 8, "property"]])); _initStatic(this); } static get accessor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs index 3a016c7c602c..1117c0037a90 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-anonymous/output.mjs @@ -1,9 +1,8 @@ -var _initClass, _classDecs; -_classDecs = [dec]; +var _initClass; let _A; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs index 165105706015..53953603abd6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/default-named/output.mjs @@ -1,9 +1,8 @@ -var _initClass, _classDecs; -_classDecs = [dec]; +var _initClass; let _default2; class _default { static { - [_default2, _initClass] = babelHelpers.applyDecs2311(babelHelpers.setFunctionName(this, "default"), _classDecs, []).c; + [_default2, _initClass] = babelHelpers.applyDecs2311(babelHelpers.setFunctionName(this, "default"), [dec], []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs index 5091fecaf4b8..cec1c69a058f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/member-decorator/output.mjs @@ -1,8 +1,7 @@ -var _xDecs, _init_x, _init_extra_x; -_xDecs = dec; +var _init_x, _init_extra_x; export class A { static { - [_init_x, _init_extra_x] = babelHelpers.applyDecs2311(this, [], [[_xDecs, 0, "x"]]).e; + [_init_x, _init_extra_x] = babelHelpers.applyDecs2311(this, [], [[dec, 0, "x"]]).e; } constructor() { _init_extra_x(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs index 2f3f5c29fafc..b25d0eaab168 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-exported/named/output.mjs @@ -1,9 +1,8 @@ -var _initClass, _classDecs; -_classDecs = [dec]; +var _initClass; let _A; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, []).c; + [_A, _initClass] = babelHelpers.applyDecs2311(this, [dec], []).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js index 6bf5b5dace9c..05d01f3dafa5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods--to-es2015/private-async-and-generator/output.js @@ -1,7 +1,4 @@ -var _initProto, _aDecs, _call_a, _gDecs, _call_g, _agDecs, _call_ag, _Foo; -_aDecs = dec; -_gDecs = dec; -_agDecs = dec; +var _initProto, _call_a, _call_g, _call_ag, _Foo; var _ag = /*#__PURE__*/new WeakMap(); var _g = /*#__PURE__*/new WeakMap(); var _a = /*#__PURE__*/new WeakMap(); @@ -14,4 +11,4 @@ class Foo { } } _Foo = Foo; -[_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(_Foo, [], [[dec, 2, "a", async function () {}], [dec, 2, "g", function* () {}], [dec, 2, "ag", async function* () {}]], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js index 8132cc2a3356..7d8c831e81c3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-methods/private-async-and-generator/output.js @@ -1,10 +1,7 @@ -var _initProto, _aDecs, _call_a, _gDecs, _call_g, _agDecs, _call_ag; -_aDecs = dec; -_gDecs = dec; -_agDecs = dec; +var _initProto, _call_a, _call_g, _call_ag; class Foo { static { - [_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(this, [], [[_aDecs, 2, "a", async function () {}], [_gDecs, 2, "g", function* () {}], [_agDecs, 2, "ag", async function* () {}]], 0, _ => #a in _).e; + [_call_a, _call_g, _call_ag, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 2, "a", async function () {}], [dec, 2, "g", function* () {}], [dec, 2, "ag", async function* () {}]], 0, _ => #a in _).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js index 9df93db43a1b..3d9a803b4cb9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/this/output.js @@ -1,7 +1,4 @@ -var _initClass, _obj, _classDecs, _xDecs, _init_x, _init_extra_x, _yDecs, _init_y, _init_extra_y, _A2; -_classDecs = [_obj = o1, _obj.dec, void 0, dec, _obj = o2, _obj.dec]; -_xDecs = [_obj = o2, _obj.dec, _obj = o3.o, _obj.dec]; -_yDecs = [_obj = o2, _obj.dec, void 0, dec]; +var _initClass, _obj, _init_x, _init_extra_x, _init_y, _init_extra_y, _A2; let _A; class A { constructor() { @@ -14,5 +11,5 @@ _A2 = A; ({ e: [_init_x, _init_extra_x, _init_y, _init_extra_y], c: [_A, _initClass] -} = babelHelpers.applyDecs2311(_A2, _classDecs, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], 1)); +} = babelHelpers.applyDecs2311(_A2, [_obj = o1, _obj.dec, void 0, dec, _obj = o2, _obj.dec], [[[_obj = o2, _obj.dec, _obj = o3.o, _obj.dec], 16, "x"], [[_obj = o2, _obj.dec, void 0, dec], 16, "y"]], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js index 3da5d88b640a..69d951387e67 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/valid-expression-formats/output.js @@ -1,7 +1,5 @@ -var _initProto, _initClass, _obj, _classDecs, _methodDecs, _Foo2; +var _initProto, _initClass, _obj, _Foo2; const dec = () => {}; -_classDecs = [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]]; -_methodDecs = [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]]; let _Foo; var _a = /*#__PURE__*/new WeakMap(); class Foo { @@ -23,5 +21,5 @@ _Foo2 = Foo; ({ e: [_initProto], c: [_Foo, _initClass] -} = babelHelpers.applyDecs2311(_Foo2, _classDecs, [[_methodDecs, 18, "method"]], 1)); +} = babelHelpers.applyDecs2311(_Foo2, [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]], [[[void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]], 18, "method"]], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-tdz-during-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-not-available-during-decorators/exec.js similarity index 76% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-tdz-during-decorators/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-not-available-during-decorators/exec.js index 2bc656b53faa..c3885caa4ec8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-tdz-during-decorators/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-not-available-during-decorators/exec.js @@ -6,7 +6,7 @@ function dec(fn) { } @dec(() => { - expect(() => Foo).toThrow(ReferenceError); + expect(() => Foo.x).toThrow(); didRun = true; }) class Foo {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-tdz-during-decorators/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-not-available-during-decorators/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-tdz-during-decorators/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/class-not-available-during-decorators/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js index 32c0f19acf82..edfc3577d2aa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -1,9 +1,8 @@ -var _initProto, _methodDecs, _B, _initProto2, _methodDecs2, _B2; +var _initProto, _B, _initProto2, _B2; const dec = () => {}; -_methodDecs = deco; class A extends (_B = B) { static { - [_initProto] = babelHelpers.applyDecs2311(this, [], [[_methodDecs, 2, "method"]], 0, void 0, _B).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[deco, 2, "method"]], 0, void 0, _B).e; } constructor() { if (Math.random() > 0.5) { @@ -14,10 +13,9 @@ class A extends (_B = B) { } method() {} } -_methodDecs2 = deco; class C extends (_B2 = B) { static { - [_initProto2] = babelHelpers.applyDecs2311(this, [], [[_methodDecs2, 2, "method"]], 0, void 0, _B2).e; + [_initProto2] = babelHelpers.applyDecs2311(this, [], [[deco, 2, "method"]], 0, void 0, _B2).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js index ef45de50a907..39e7b5bc73c9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/this/output.js @@ -1,14 +1,11 @@ -var _initClass, _obj, _classDecs, _xDecs, _init_x, _init_extra_x, _yDecs, _init_y, _init_extra_y; -_classDecs = [_obj = o1, _obj.dec, void 0, dec, _obj = o2, _obj.dec, _obj = o4.o(), _obj.dec]; -_xDecs = [_obj = o2, _obj.dec, _obj = o3.o, _obj.dec, _obj = o4.o(), _obj.dec]; -_yDecs = [_obj = o2, _obj.dec, void 0, dec]; +var _initClass, _obj, _init_x, _init_extra_x, _init_y, _init_extra_y; let _A; class A { static { ({ e: [_init_x, _init_extra_x, _init_y, _init_extra_y], c: [_A, _initClass] - } = babelHelpers.applyDecs2311(this, _classDecs, [[_xDecs, 16, "x"], [_yDecs, 16, "y"]], 1)); + } = babelHelpers.applyDecs2311(this, [_obj = o1, _obj.dec, void 0, dec, _obj = o2, _obj.dec, _obj = o4.o(), _obj.dec], [[[_obj = o2, _obj.dec, _obj = o3.o, _obj.dec, _obj = o4.o(), _obj.dec], 16, "x"], [[_obj = o2, _obj.dec, void 0, dec], 16, "y"]], 1)); } constructor() { _init_extra_y(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js index 400e9a769a81..789320a8bb4a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/valid-expression-formats/output.js @@ -1,14 +1,12 @@ -var _initProto, _initClass, _obj, _classDecs, _methodDecs; +var _initProto, _initClass, _obj; const dec = () => {}; -_classDecs = [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]]; -_methodDecs = [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]]; let _Foo; class Foo { static { ({ e: [_initProto], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2311(this, _classDecs, [[_methodDecs, 18, "method"]], 1)); + } = babelHelpers.applyDecs2311(this, [void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]], [[[void 0, dec, void 0, call(), void 0, chain.expr(), void 0, arbitrary + expr, _obj = array, _obj[expr]], 18, "method"]], 1)); } #a = void _initProto(this); method() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js index 84ea6d1ace13..ebfd4244dfc6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering--to-es2015/decorators-evaluation-with-this-caching/output.js @@ -1,6 +1,5 @@ -var _initProto, _obj, _methodDecs, _A; +var _initProto, _obj, _A; let fn, obj; -_methodDecs = [void 0, fn(), _obj = obj.prop, _obj.foo]; class A { constructor() { _initProto(this); @@ -8,4 +7,4 @@ class A { method() {} } _A = A; -[_initProto] = babelHelpers.applyDecs2311(_A, [], [[_methodDecs, 18, "method"]]).e; +[_initProto] = babelHelpers.applyDecs2311(_A, [], [[[void 0, fn(), _obj = obj.prop, _obj.foo], 18, "method"]]).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js index b27bdea8ac5b..bd3cb540389d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-ordering/decorators-evaluation-with-this-caching/output.js @@ -1,9 +1,8 @@ -var _initProto, _obj, _methodDecs; +var _initProto, _obj; let fn, obj; -_methodDecs = [void 0, fn(), _obj = obj.prop, _obj.foo]; class A { static { - [_initProto] = babelHelpers.applyDecs2311(this, [], [[_methodDecs, 18, "method"]]).e; + [_initProto] = babelHelpers.applyDecs2311(this, [], [[[void 0, fn(), _obj = obj.prop, _obj.foo], 18, "method"]]).e; } constructor() { _initProto(this); diff --git a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js index 364c88e6dd7a..5ce7e6122d23 100644 --- a/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js +++ b/packages/babel-plugin-transform-class-properties/test/fixtures/nested-class/super-property-in-decorator/output.js @@ -15,18 +15,17 @@ let Hello = /*#__PURE__*/function () { let Outer = /*#__PURE__*/function (_Hello) { babelHelpers.inherits(Outer, _Hello); function Outer() { - var _helloDecs, _init_hello, _init_extra_hello, _Inner; + var _init_hello, _init_extra_hello, _Inner; var _thisSuper, _this; babelHelpers.classCallCheck(this, Outer); _this = babelHelpers.callSuper(this, Outer); - _helloDecs = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "dec", _thisSuper); let Inner = /*#__PURE__*/babelHelpers.createClass(function Inner() { babelHelpers.classCallCheck(this, Inner); babelHelpers.defineProperty(this, "hello", _init_hello(this)); _init_extra_hello(this); }); _Inner = Inner; - [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[_helloDecs, 0, "hello"]]).e; + [_init_hello, _init_extra_hello] = babelHelpers.applyDecs2311(_Inner, [], [[babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "dec", _thisSuper), 0, "hello"]]).e; return babelHelpers.possibleConstructorReturn(_this, new Inner()); } return babelHelpers.createClass(Outer); From 7fdee59ba2281962a764752f59cc771058e0fc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 21 Feb 2024 13:08:06 +0100 Subject: [PATCH 4/6] Fix usage of private fields in class decorators --- .../src/decorators.ts | 50 ++++++++++--------- .../private-name-in-class-decorator/exec.js | 14 ++++++ .../private-name-in-class-decorator/input.js | 14 ++++++ .../private-name-in-class-decorator/output.js | 24 +++++++++ .../private-name-in-class-decorator/exec.js | 14 ++++++ .../private-name-in-class-decorator/input.js | 14 ++++++ .../private-name-in-class-decorator/output.js | 28 +++++++++++ 7 files changed, 135 insertions(+), 23 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/output.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 9223ed7db0e2..c14e4652777e 100644 --- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts +++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts @@ -754,18 +754,14 @@ function createPrivateBrandCheckClosure(brandName: t.PrivateName) { // Check if the expression does not reference function-specific // context or the given identifier name. // `true` means "maybe" and `false` means "no". -function usesFunctionContextOrRef( - expression: t.Node, - refName: string | undefined, -) { +function usesFunctionContext(expression: t.Node) { try { t.traverseFast(expression, node => { if ( t.isThisExpression(node) || t.isSuper(node) || t.isIdentifier(node, { name: "arguments" }) || - (t.isMetaProperty(node) && node.meta.name !== "import") || - (refName && t.isIdentifier(node, { name: refName })) + (t.isMetaProperty(node) && node.meta.name !== "import") ) { // TODO: Add early return support to t.traverseFast throw null; @@ -777,6 +773,20 @@ function usesFunctionContextOrRef( } } +function usesPrivateField(expression: t.Node) { + try { + t.traverseFast(expression, node => { + if (t.isPrivateName(node)) { + // TODO: Add early return support to t.traverseFast + throw null; + } + }); + return false; + } catch { + return true; + } +} + function checkPrivateMethodUpdateError( path: NodePath, decoratedPrivateMethods: Set, @@ -896,9 +906,8 @@ function transformClass( break; } hasElementDecorators = true; - elemDecsUseFnContext ||= element.node.decorators.some(dec => - usesFunctionContextOrRef(dec, path.node.id?.name), - ); + elemDecsUseFnContext ||= + element.node.decorators.some(usesFunctionContext); } else if (element.node.type === "ClassAccessorProperty") { // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings. propertyVisitor.ClassAccessorProperty( @@ -992,10 +1001,7 @@ function transformClass( } decoratorsThis.push(object); hasSideEffects ||= !scopeParent.isStatic(expression); - usesFnContext ||= usesFunctionContextOrRef( - expression, - path.node.id?.name, - ); + usesFnContext ||= usesFunctionContext(expression); } return { hasSideEffects, usesFnContext, decoratorsThis }; } @@ -1018,6 +1024,7 @@ function transformClass( path.node.decorators = null; const decoratorExpressions = classDecorators.map(el => el.expression); + const classDecsUsePrivateName = decoratorExpressions.some(usesPrivateField); const { hasSideEffects, decoratorsThis } = handleDecoratorExpressions(decoratorExpressions); @@ -1029,7 +1036,10 @@ function transformClass( classDecorationsFlag = haveThis ? 1 : 0; classDecorations = decs; - if (hasSideEffects && willExtractSomeElemDecs) { + if ( + (hasSideEffects && willExtractSomeElemDecs) || + classDecsUsePrivateName + ) { classDecorationsId = memoiseExpression( t.arrayExpression(classDecorations), "classDecs", @@ -1089,11 +1099,8 @@ function transformClass( if (hasDecorators) { const decoratorExpressions = decorators.map(d => d.expression); - const { - hasSideEffects, - usesFnContext: usesFunctionContext, - decoratorsThis, - } = handleDecoratorExpressions(decoratorExpressions); + const { hasSideEffects, usesFnContext, decoratorsThis } = + handleDecoratorExpressions(decoratorExpressions); const { decs, haveThis } = generateDecorationList( decoratorExpressions, decoratorsThis, @@ -1101,10 +1108,7 @@ function transformClass( ); decoratorsHaveThis = haveThis; decoratorsArray = decs.length === 1 ? decs[0] : t.arrayExpression(decs); - if ( - usesFunctionContext || - (hasSideEffects && willExtractSomeElemDecs) - ) { + if (usesFnContext || (hasSideEffects && willExtractSomeElemDecs)) { decoratorsArray = memoiseExpression(decoratorsArray, name + "Decs"); } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/exec.js new file mode 100644 index 000000000000..f37dda0b1d8c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/exec.js @@ -0,0 +1,14 @@ +let called = false; + +class A { + static #x() { called = true } + constructor() { + @(A.#x) + class B extends A { + static #x() { throw new Error("Should not be called") } + } + } +} + +new A(); +expect(called).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/input.js new file mode 100644 index 000000000000..f37dda0b1d8c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/input.js @@ -0,0 +1,14 @@ +let called = false; + +class A { + static #x() { called = true } + constructor() { + @(A.#x) + class B extends A { + static #x() { throw new Error("Should not be called") } + } + } +} + +new A(); +expect(called).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/output.js new file mode 100644 index 000000000000..aef2c0c38eec --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/private-name-in-class-decorator/output.js @@ -0,0 +1,24 @@ +let called = false; +class A { + constructor() { + var _initClass, _Class_brand, _temp; + let _B; + new (_Class_brand = /*#__PURE__*/new WeakSet(), (_temp = class extends babelHelpers.identity { + constructor() { + (super(_B), babelHelpers.classPrivateMethodInitSpec(this, _Class_brand), this), _initClass(); + } + }, (_B2 => { + class B extends A {} + _B2 = B; + [_B, _initClass] = babelHelpers.applyDecs2311(_B2, [_x], [], 0, void 0, A).c; + })(), _temp))(); + function _x3() { + throw new Error("Should not be called"); + } + } +} +function _x() { + called = true; +} +new A(); +expect(called).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/exec.js new file mode 100644 index 000000000000..f37dda0b1d8c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/exec.js @@ -0,0 +1,14 @@ +let called = false; + +class A { + static #x() { called = true } + constructor() { + @(A.#x) + class B extends A { + static #x() { throw new Error("Should not be called") } + } + } +} + +new A(); +expect(called).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/input.js new file mode 100644 index 000000000000..f37dda0b1d8c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/input.js @@ -0,0 +1,14 @@ +let called = false; + +class A { + static #x() { called = true } + constructor() { + @(A.#x) + class B extends A { + static #x() { throw new Error("Should not be called") } + } + } +} + +new A(); +expect(called).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/output.js new file mode 100644 index 000000000000..7c338b5f8d9d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/private-name-in-class-decorator/output.js @@ -0,0 +1,28 @@ +let called = false; +class A { + static #x() { + called = true; + } + constructor() { + var _initClass, _classDecs; + _classDecs = [A, A.#x]; + let _B; + new class extends babelHelpers.identity { + static { + class B extends A { + static { + [_B, _initClass] = babelHelpers.applyDecs2311(this, _classDecs, [], 1, void 0, A).c; + } + } + } + #x() { + throw new Error("Should not be called"); + } + constructor() { + super(_B), _initClass(); + } + }(); + } +} +new A(); +expect(called).toBe(true); From dd4798a03afe993445cb580cfd9fea8970272f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 21 Feb 2024 14:44:30 +0100 Subject: [PATCH 5/6] minNodeVersion --- .../test/fixtures/2023-11-misc/options.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/options.json index 752326c78eb0..4ca5688a297c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/options.json @@ -1,3 +1,4 @@ { + "minNodeVersion": "16.0.0", "plugins": [["proposal-decorators", { "version": "2023-11" }]] } From 712501da94c1a50e603177ddfc788998d55f3410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 21 Feb 2024 15:02:19 +0100 Subject: [PATCH 6/6] Trim some bytes off the helper --- .../babel-helpers/src/helpers-generated.ts | 4 ++-- .../src/helpers/applyDecs2311.ts | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 849f6d71823b..0dde0bb141f9 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -48,10 +48,10 @@ export default Object.freeze({ "7.21.0", 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2305(e,t,r,n,o,a){function i(e,t,r){return function(n,o){return r&&r(n),e[t].call(n,o)}}function c(e,t){for(var r=0;r=0;j-=r?2:1){var D=v[j],E=r?v[j-1]:void 0,I={},O={kind:["field","accessor","method","getter","setter","class"][o],name:n,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");s(t,"An initializer","be",!0),c.push(t)}.bind(null,I)};try{if(b)(y=s(D.call(E,P,O),"class decorators","return"))&&(P=y);else{var k,F;O.static=l,O.private=f,f?2===o?k=function(e){return m(e),w.value}:(o<4&&(k=i(w,"get",m)),3!==o&&(F=i(w,"set",m))):(k=function(e){return e[n]},(o<2||4===o)&&(F=function(e,t){e[n]=t}));var N=O.access={has:f?h.bind():function(e){return n in e}};if(k&&(N.get=k),F&&(N.set=F),P=D.call(E,d?{get:w.get,set:w.set}:w[A],O),d){if("object"==typeof P&&P)(y=s(P.get,"accessor.get"))&&(w.get=y),(y=s(P.set,"accessor.set"))&&(w.set=y),(y=s(P.init,"accessor.init"))&&S.push(y);else if(void 0!==P)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else s(P,(p?"field":"method")+" decorators","return")&&(p?S.push(P):w[A]=P)}}finally{I.v=!0}}return(p||d)&&u.push((function(e,t){for(var r=S.length-1;r>=0;r--)t=S[r].call(e,t);return t})),p||b||(f?d?u.push(i(w,"get"),i(w,"set")):u.push(2===o?w[A]:i.call.bind(w[A])):Object.defineProperty(e,n,w)),P}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var l=a[Symbol.metadata||Symbol.for("Symbol.metadata")];var f=Object.create(null==l?null:l),p=function(e,t,r,n){var o,a,i=[],s=function(t){return checkInRHS(t)===e},u=new Map;function l(e){e&&i.push(c.bind(null,e))}for(var f=0;f3,y=16&d,v=!!(8&d),g=0==(d&=7),b=h+"/"+v;if(!g&&!m){var w=u.get(b);if(!0===w||3===w&&4!==d||4===w&&3!==d)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);u.set(b,!(d>2)||d)}applyDec(v?e:e.prototype,p,y,m?"#"+h:toPropertyKey(h),d,n,v?a=a||[]:o=o||[],i,v,m,g,1===d,v&&m?s:r)}}return l(o),l(a),i}(e,t,o,f);return r.length||u(e,f),{e:p,get c(){var t=[];return r.length&&[u(applyDec(e,[r],n,e.name,5,f,t),f),c.bind(null,t,e)]}}}', ), - // size: 2957, gzip size: 1507 + // size: 2951, gzip size: 1503 applyDecs2311: helper( "7.23.0", - 'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2311(e,t,n,r,o,i){var a,c,u,s,f,l,p,d=Symbol.metadata||Symbol.for("Symbol.metadata"),m=Object.defineProperty,h=Object.create,y=[h(null),h(null)],v=t.length;function g(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a=0;O-=n?2:1){var z=h[O],H=n?h[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(w)c=z.call(H,N,R),K.v=1,b(c,"class decorators","return")&&(N=c);else if(R.static=s,R.private=f,c=R.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=z.call(H,D?{get:P.get,set:P.set}:P[F],R),K.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;i=0;O-=n?2:1){var z=h[O],H=n?h[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(w)c=z.call(H,N,R),K.v=1,b(c,"class decorators","return")&&(N=c);else if(R.static=s,R.private=f,c=R.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=z.call(H,D?{get:P.get,set:P.set}:P[F],R),K.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;i