From cf383d08dee345c807128a0223e0f4c2baaab31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 13 Apr 2023 15:01:17 +0200 Subject: [PATCH 01/15] chore: Copy `applyDecs2303` to `applyDecs2301` --- .../babel-helpers/src/helpers-generated.ts | 4 + .../src/helpers/applyDecs2303.js | 691 ++++++++++++++++++ 2 files changed, 695 insertions(+) create mode 100644 packages/babel-helpers/src/helpers/applyDecs2303.js diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 6524b3653d75..70af2f13efb6 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -34,6 +34,10 @@ export default Object.freeze({ 'function applyDecs2203RFactory(){function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){!function(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function memberDec(dec,name,desc,initializers,kind,isStatic,isPrivate,value){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),0===kind?isPrivate?(get=desc.get,set=desc.set):(get=function(){return this[name]},set=function(v){this[name]=v}):2===kind?get=function(){return desc.value}:(1!==kind&&3!==kind||(get=function(){return desc.get.call(this)}),1!==kind&&4!==kind||(set=function(v){desc.set.call(this,v)})),ctx.access=get&&set?{get:get,set:set}:get?{get:get}:{set:set};try{return dec(value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":10===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers){var desc,init,value,newValue,get,set,decs=decInfo[0];if(isPrivate?desc=0===kind||1===kind?{get:decInfo[3],set:decInfo[4]}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set),"function"==typeof decs)void 0!==(newValue=memberDec(decs,name,desc,initializers,kind,isStatic,isPrivate,value))&&(assertValidReturnValue(kind,newValue),0===kind?init=newValue:1===kind?(init=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue);else for(var i=decs.length-1;i>=0;i--){var newInit;if(void 0!==(newValue=memberDec(decs[i],name,desc,initializers,kind,isStatic,isPrivate,value)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[])):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,i=classDecs.length-1;i>=0;i--){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i](newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i--){var newInit;if(void 0!==(newValue=memberDec(decs[i],name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,i=classDecs.length-1;i>=0;i--){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i](newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i--){var newInit;if(void 0!==(newValue=memberDec(decs[i],name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,i=classDecs.length-1;i>=0;i--){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i](newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i= 0; i--) { + var dec = decs[i]; + + newValue = memberDec( + dec, + name, + desc, + initializers, + kind, + isStatic, + isPrivate, + value, + hasPrivateBrand + ); + + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + var newInit; + + if (kind === 0 /* FIELD */) { + newInit = newValue; + } else if (kind === 1 /* ACCESSOR */) { + newInit = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; + } else { + value = newValue; + } + + if (newInit !== void 0) { + if (init === void 0) { + init = newInit; + } else if (typeof init === "function") { + init = [init, newInit]; + } else { + init.push(newInit); + } + } + } + } + } + + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + if (init === void 0) { + // If the initializer was void 0, sub in a dummy initializer + init = function (instance, init) { + return init; + }; + } else if (typeof init !== "function") { + var ownInitializers = init; + + init = function (instance, init) { + var value = init; + + for (var i = 0; i < ownInitializers.length; i++) { + value = ownInitializers[i].call(instance, value); + } + + return value; + }; + } else { + var originalInitializer = init; + + init = function (instance, init) { + return originalInitializer.call(instance, init); + }; + } + + ret.push(init); + } + + if (kind !== 0 /* FIELD */) { + if (kind === 1 /* ACCESSOR */) { + desc.get = value.get; + desc.set = value.set; + } else if (kind === 2 /* METHOD */) { + desc.value = value; + } else if (kind === 3 /* GETTER */) { + desc.get = value; + } else if (kind === 4 /* SETTER */) { + desc.set = value; + } + + if (isPrivate) { + if (kind === 1 /* ACCESSOR */) { + ret.push(function (instance, args) { + return value.get.call(instance, args); + }); + ret.push(function (instance, args) { + return value.set.call(instance, args); + }); + } else if (kind === 2 /* METHOD */) { + ret.push(value); + } else { + ret.push(function (instance, args) { + return value.call(instance, args); + }); + } + } else { + Object.defineProperty(base, name, desc); + } + } +} + +function applyMemberDecs(Class, decInfos, instanceBrand) { + var ret = []; + var protoInitializers; + var staticInitializers; + var staticBrand; + + var existingProtoNonFields = new Map(); + var existingStaticNonFields = new Map(); + + for (var i = 0; i < decInfos.length; i++) { + var decInfo = decInfos[i]; + + // skip computed property names + if (!Array.isArray(decInfo)) continue; + + var kind = decInfo[1]; + var name = decInfo[2]; + var isPrivate = decInfo.length > 3; + + var isStatic = kind >= 5; /* STATIC */ + var base; + var initializers; + var hasPrivateBrand = instanceBrand; + + if (isStatic) { + base = Class; + kind = kind - 5 /* STATIC */; + // initialize staticInitializers when we see a non-field static member + if (kind !== 0 /* FIELD */) { + staticInitializers = staticInitializers || []; + initializers = staticInitializers; + } + if (isPrivate && !staticBrand) { + staticBrand = function (_) { + return checkInRHS(_) === Class; + }; + } + hasPrivateBrand = staticBrand; + } else { + base = Class.prototype; + // initialize protoInitializers when we see a non-field member + if (kind !== 0 /* FIELD */) { + protoInitializers = protoInitializers || []; + initializers = protoInitializers; + } + } + + if (kind !== 0 /* FIELD */ && !isPrivate) { + var existingNonFields = isStatic + ? existingStaticNonFields + : existingProtoNonFields; + + var existingKind = existingNonFields.get(name) || 0; + + if ( + existingKind === true || + (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ || + (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */ + ) { + 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: " + + name + ); + } else if (!existingKind && kind > 2 /* METHOD */) { + existingNonFields.set(name, kind); + } else { + existingNonFields.set(name, true); + } + } + + applyMemberDec( + ret, + base, + decInfo, + name, + kind, + isStatic, + isPrivate, + initializers, + hasPrivateBrand + ); + } + + pushInitializers(ret, protoInitializers); + pushInitializers(ret, staticInitializers); + return ret; +} + +function pushInitializers(ret, initializers) { + if (initializers) { + ret.push(function (instance) { + for (var i = 0; i < initializers.length; i++) { + initializers[i].call(instance); + } + return instance; + }); + } +} + +function applyClassDecs(targetClass, classDecs) { + if (classDecs.length > 0) { + var initializers = []; + var newClass = targetClass; + var name = targetClass.name; + + for (var i = classDecs.length - 1; i >= 0; i--) { + var decoratorFinishedRef = { v: false }; + + try { + var nextNewClass = classDecs[i](newClass, { + kind: "class", + name: name, + addInitializer: createAddInitializerMethod( + initializers, + decoratorFinishedRef + ), + }); + } finally { + decoratorFinishedRef.v = true; + } + + if (nextNewClass !== undefined) { + assertValidReturnValue(10 /* CLASS */, nextNewClass); + newClass = nextNewClass; + } + } + + return [ + newClass, + function () { + for (var i = 0; i < initializers.length; i++) { + initializers[i].call(newClass); + } + }, + ]; + } + // The transformer will not emit assignment when there are no class decorators, + // so we don't have to return an empty array here. +} + +/** + Basic usage: + + applyDecs( + Class, + [ + // member decorators + [ + dec, // dec or array of decs + 0, // kind of value being decorated + 'prop', // name of public prop on class containing the value being decorated, + '#p', // the name of the private property (if is private, void 0 otherwise), + ] + ], + [ + // class decorators + dec1, dec2 + ] + ) + ``` + + Fully transpiled example: + + ```js + @dec + class Class { + @dec + a = 123; + + @dec + #a = 123; + + @dec + @dec2 + accessor b = 123; + + @dec + accessor #b = 123; + + @dec + c() { console.log('c'); } + + @dec + #c() { console.log('privC'); } + + @dec + get d() { console.log('d'); } + + @dec + get #d() { console.log('privD'); } + + @dec + set e(v) { console.log('e'); } + + @dec + set #e(v) { console.log('privE'); } + } + + + // becomes + let initializeInstance; + let initializeClass; + + let initA; + let initPrivA; + + let initB; + let initPrivB, getPrivB, setPrivB; + + let privC; + let privD; + let privE; + + let Class; + class _Class { + static { + let ret = applyDecs( + this, + [ + [dec, 0, 'a'], + [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[dec, dec2], 1, 'b'], + [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [dec, 2, 'c'], + [dec, 2, 'c', () => console.log('privC')], + [dec, 3, 'd'], + [dec, 3, 'd', () => console.log('privD')], + [dec, 4, 'e'], + [dec, 4, 'e', () => console.log('privE')], + ], + [ + dec + ] + ) + + initA = ret[0]; + + initPrivA = ret[1]; + + initB = ret[2]; + + initPrivB = ret[3]; + getPrivB = ret[4]; + setPrivB = ret[5]; + + privC = ret[6]; + + privD = ret[7]; + + privE = ret[8]; + + initializeInstance = ret[9]; + + Class = ret[10] + + initializeClass = ret[11]; + } + + a = (initializeInstance(this), initA(this, 123)); + + #a = initPrivA(this, 123); + + #bData = initB(this, 123); + get b() { return this.#bData } + set b(v) { this.#bData = v } + + #privBData = initPrivB(this, 123); + get #b() { return getPrivB(this); } + set #b(v) { setPrivB(this, v); } + + c() { console.log('c'); } + + #c(...args) { return privC(this, ...args) } + + get d() { console.log('d'); } + + get #d() { return privD(this); } + + set e(v) { console.log('e'); } + + set #e(v) { privE(this, v); } + } + + initializeClass(Class); + */ + +export default function applyDecs2301( + targetClass, + memberDecs, + classDecs, + instanceBrand +) { + return { + e: applyMemberDecs(targetClass, memberDecs, instanceBrand), + // Lazily apply class decorations so that member init locals can be properly bound. + get c() { + return applyClassDecs(targetClass, classDecs); + }, + }; +} From a247df66a5a264568819c963169fcf027ea3e21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 13 Apr 2023 15:03:13 +0200 Subject: [PATCH 02/15] chore: Wrap `applyDecs2301` in an IIFE --- .../src/helpers/applyDecs2301.js | 1075 +++++++++-------- packages/babel-runtime-corejs2/package.json | 9 + packages/babel-runtime-corejs3/package.json | 9 + packages/babel-runtime/package.json | 9 + 4 files changed, 574 insertions(+), 528 deletions(-) diff --git a/packages/babel-helpers/src/helpers/applyDecs2301.js b/packages/babel-helpers/src/helpers/applyDecs2301.js index 6b68590b0657..eabb5362f449 100644 --- a/packages/babel-helpers/src/helpers/applyDecs2301.js +++ b/packages/babel-helpers/src/helpers/applyDecs2301.js @@ -20,274 +20,248 @@ import checkInRHS from "checkInRHS"; CLASS = 10; // only used in assertValidReturnValue */ -function createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function addInitializer(initializer) { - assertNotFinished(decoratorFinishedRef, "addInitializer"); - assertCallable(initializer, "An initializer"); - initializers.push(initializer); - }; -} - -function assertInstanceIfPrivate(has, target) { - if (!has(target)) { - throw new TypeError("Attempted to access private element on non-instance"); +function applyDecs2301Factory() { + function createAddInitializerMethod(initializers, decoratorFinishedRef) { + return function addInitializer(initializer) { + assertNotFinished(decoratorFinishedRef, "addInitializer"); + assertCallable(initializer, "An initializer"); + initializers.push(initializer); + }; } -} -function memberDec( - dec, - name, - desc, - initializers, - kind, - isStatic, - isPrivate, - value, - hasPrivateBrand -) { - var kindStr; - - switch (kind) { - case 1 /* ACCESSOR */: - kindStr = "accessor"; - break; - case 2 /* METHOD */: - kindStr = "method"; - break; - case 3 /* GETTER */: - kindStr = "getter"; - break; - case 4 /* SETTER */: - kindStr = "setter"; - break; - default: - kindStr = "field"; + function assertInstanceIfPrivate(has, target) { + if (!has(target)) { + throw new TypeError( + "Attempted to access private element on non-instance" + ); + } } - var ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - static: isStatic, - private: isPrivate, - }; + function memberDec( + dec, + name, + desc, + initializers, + kind, + isStatic, + isPrivate, + value, + hasPrivateBrand + ) { + var kindStr; + + switch (kind) { + case 1 /* ACCESSOR */: + kindStr = "accessor"; + break; + case 2 /* METHOD */: + kindStr = "method"; + break; + case 3 /* GETTER */: + kindStr = "getter"; + break; + case 4 /* SETTER */: + kindStr = "setter"; + break; + default: + kindStr = "field"; + } - var decoratorFinishedRef = { v: false }; + var ctx = { + kind: kindStr, + name: isPrivate ? "#" + name : name, + static: isStatic, + private: isPrivate, + }; - if (kind !== 0 /* FIELD */) { - ctx.addInitializer = createAddInitializerMethod( - initializers, - decoratorFinishedRef - ); - } + var decoratorFinishedRef = { v: false }; - var get, set; - if (!isPrivate && (kind === 0 /* FIELD */ || kind === 2) /* METHOD */) { - get = function (target) { - return target[name]; - }; - if (kind === 0 /* FIELD */) { - set = function (target, v) { - target[name] = v; - }; + if (kind !== 0 /* FIELD */) { + ctx.addInitializer = createAddInitializerMethod( + initializers, + decoratorFinishedRef + ); } - } else if (kind === 2 /* METHOD */) { - // Assert: isPrivate is true. - get = function (target) { - assertInstanceIfPrivate(hasPrivateBrand, target); - return desc.value; - }; - } else { - // Assert: If kind === 0, then isPrivate is true. - var t = kind === 0 /* FIELD */ || kind === 1; /* ACCESSOR */ - if (t || kind === 3 /* GETTER */) { - if (isPrivate) { - get = function (target) { - assertInstanceIfPrivate(hasPrivateBrand, target); - return desc.get.call(target); - }; - } else { - get = function (target) { - return desc.get.call(target); + + var get, set; + if (!isPrivate && (kind === 0 /* FIELD */ || kind === 2) /* METHOD */) { + get = function (target) { + return target[name]; + }; + if (kind === 0 /* FIELD */) { + set = function (target, v) { + target[name] = v; }; } + } else if (kind === 2 /* METHOD */) { + // Assert: isPrivate is true. + get = function (target) { + assertInstanceIfPrivate(hasPrivateBrand, target); + return desc.value; + }; + } else { + // Assert: If kind === 0, then isPrivate is true. + var t = kind === 0 /* FIELD */ || kind === 1; /* ACCESSOR */ + if (t || kind === 3 /* GETTER */) { + if (isPrivate) { + get = function (target) { + assertInstanceIfPrivate(hasPrivateBrand, target); + return desc.get.call(target); + }; + } else { + get = function (target) { + return desc.get.call(target); + }; + } + } + if (t || kind === 4 /* SETTER */) { + if (isPrivate) { + set = function (target, value) { + assertInstanceIfPrivate(hasPrivateBrand, target); + desc.set.call(target, value); + }; + } else { + set = function (target, value) { + desc.set.call(target, value); + }; + } + } } - if (t || kind === 4 /* SETTER */) { - if (isPrivate) { - set = function (target, value) { - assertInstanceIfPrivate(hasPrivateBrand, target); - desc.set.call(target, value); - }; - } else { - set = function (target, value) { - desc.set.call(target, value); + var has = isPrivate + ? hasPrivateBrand.bind() + : function (target) { + return name in target; }; - } + ctx.access = + get && set + ? { get: get, set: set, has: has } + : get + ? { get: get, has: has } + : { set: set, has: has }; + + try { + return dec(value, ctx); + } finally { + decoratorFinishedRef.v = true; } } - var has = isPrivate - ? hasPrivateBrand.bind() - : function (target) { - return name in target; - }; - ctx.access = - get && set - ? { get: get, set: set, has: has } - : get - ? { get: get, has: has } - : { set: set, has: has }; - - try { - return dec(value, ctx); - } finally { - decoratorFinishedRef.v = true; - } -} -function assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) { - throw new Error( - "attempted to call " + fnName + " after decoration was finished" - ); + function assertNotFinished(decoratorFinishedRef, fnName) { + if (decoratorFinishedRef.v) { + throw new Error( + "attempted to call " + fnName + " after decoration was finished" + ); + } } -} -function assertCallable(fn, hint) { - if (typeof fn !== "function") { - throw new TypeError(hint + " must be a function"); + function assertCallable(fn, hint) { + if (typeof fn !== "function") { + throw new TypeError(hint + " must be a function"); + } } -} -function assertValidReturnValue(kind, value) { - var type = typeof value; + function assertValidReturnValue(kind, value) { + var type = typeof value; - if (kind === 1 /* ACCESSOR */) { - if (type !== "object" || value === null) { + if (kind === 1 /* ACCESSOR */) { + if (type !== "object" || value === null) { + throw new TypeError( + "accessor decorators must return an object with get, set, or init properties or void 0" + ); + } + if (value.get !== undefined) { + assertCallable(value.get, "accessor.get"); + } + if (value.set !== undefined) { + assertCallable(value.set, "accessor.set"); + } + if (value.init !== undefined) { + assertCallable(value.init, "accessor.init"); + } + } else if (type !== "function") { + var hint; + if (kind === 0 /* FIELD */) { + hint = "field"; + } else if (kind === 10 /* CLASS */) { + hint = "class"; + } else { + hint = "method"; + } throw new TypeError( - "accessor decorators must return an object with get, set, or init properties or void 0" + hint + " decorators must return a function or void 0" ); } - if (value.get !== undefined) { - assertCallable(value.get, "accessor.get"); - } - if (value.set !== undefined) { - assertCallable(value.set, "accessor.set"); - } - if (value.init !== undefined) { - assertCallable(value.init, "accessor.init"); - } - } else if (type !== "function") { - var hint; - if (kind === 0 /* FIELD */) { - hint = "field"; - } else if (kind === 10 /* CLASS */) { - hint = "class"; - } else { - hint = "method"; - } - throw new TypeError(hint + " decorators must return a function or void 0"); } -} -function curryThis1(fn) { - return function () { - return fn(this); - }; -} -function curryThis2(fn) { - return function (value) { - fn(this, value); - }; -} - -function applyMemberDec( - ret, - base, - decInfo, - name, - kind, - isStatic, - isPrivate, - initializers, - hasPrivateBrand -) { - var decs = decInfo[0]; + function curryThis1(fn) { + return function () { + return fn(this); + }; + } + function curryThis2(fn) { + return function (value) { + fn(this, value); + }; + } - var desc, init, value; + function applyMemberDec( + ret, + base, + decInfo, + name, + kind, + isStatic, + isPrivate, + initializers, + hasPrivateBrand + ) { + var decs = decInfo[0]; + + var desc, init, value; - if (isPrivate) { - if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { - desc = { - get: curryThis1(decInfo[3]), - set: curryThis2(decInfo[4]), - }; - } else { - if (kind === 3 /* GETTER */) { - desc = { - get: decInfo[3], - }; - } else if (kind === 4 /* SETTER */) { + if (isPrivate) { + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { desc = { - set: decInfo[3], + get: curryThis1(decInfo[3]), + set: curryThis2(decInfo[4]), }; } else { - desc = { - value: decInfo[3], - }; + if (kind === 3 /* GETTER */) { + desc = { + get: decInfo[3], + }; + } else if (kind === 4 /* SETTER */) { + desc = { + set: decInfo[3], + }; + } else { + desc = { + value: decInfo[3], + }; + } } + } else if (kind !== 0 /* FIELD */) { + desc = Object.getOwnPropertyDescriptor(base, name); } - } else if (kind !== 0 /* FIELD */) { - desc = Object.getOwnPropertyDescriptor(base, name); - } - if (kind === 1 /* ACCESSOR */) { - value = { - get: desc.get, - set: desc.set, - }; - } else if (kind === 2 /* METHOD */) { - value = desc.value; - } else if (kind === 3 /* GETTER */) { - value = desc.get; - } else if (kind === 4 /* SETTER */) { - value = desc.set; - } - - var newValue, get, set; - - if (typeof decs === "function") { - newValue = memberDec( - decs, - name, - desc, - initializers, - kind, - isStatic, - isPrivate, - value, - hasPrivateBrand - ); - - if (newValue !== void 0) { - assertValidReturnValue(kind, newValue); - - if (kind === 0 /* FIELD */) { - init = newValue; - } else if (kind === 1 /* ACCESSOR */) { - init = newValue.init; - get = newValue.get || value.get; - set = newValue.set || value.set; - - value = { get: get, set: set }; - } else { - value = newValue; - } + if (kind === 1 /* ACCESSOR */) { + value = { + get: desc.get, + set: desc.set, + }; + } else if (kind === 2 /* METHOD */) { + value = desc.value; + } else if (kind === 3 /* GETTER */) { + value = desc.get; + } else if (kind === 4 /* SETTER */) { + value = desc.set; } - } else { - for (var i = decs.length - 1; i >= 0; i--) { - var dec = decs[i]; + var newValue, get, set; + + if (typeof decs === "function") { newValue = memberDec( - dec, + decs, name, desc, initializers, @@ -300,12 +274,11 @@ function applyMemberDec( if (newValue !== void 0) { assertValidReturnValue(kind, newValue); - var newInit; if (kind === 0 /* FIELD */) { - newInit = newValue; + init = newValue; } else if (kind === 1 /* ACCESSOR */) { - newInit = newValue.init; + init = newValue.init; get = newValue.get || value.get; set = newValue.set || value.set; @@ -313,367 +286,414 @@ function applyMemberDec( } else { value = newValue; } + } + } else { + for (var i = decs.length - 1; i >= 0; i--) { + var dec = decs[i]; + + newValue = memberDec( + dec, + name, + desc, + initializers, + kind, + isStatic, + isPrivate, + value, + hasPrivateBrand + ); - if (newInit !== void 0) { - if (init === void 0) { - init = newInit; - } else if (typeof init === "function") { - init = [init, newInit]; + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + var newInit; + + if (kind === 0 /* FIELD */) { + newInit = newValue; + } else if (kind === 1 /* ACCESSOR */) { + newInit = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; } else { - init.push(newInit); + value = newValue; + } + + if (newInit !== void 0) { + if (init === void 0) { + init = newInit; + } else if (typeof init === "function") { + init = [init, newInit]; + } else { + init.push(newInit); + } } } } } - } - - if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { - if (init === void 0) { - // If the initializer was void 0, sub in a dummy initializer - init = function (instance, init) { - return init; - }; - } else if (typeof init !== "function") { - var ownInitializers = init; - init = function (instance, init) { - var value = init; + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + if (init === void 0) { + // If the initializer was void 0, sub in a dummy initializer + init = function (instance, init) { + return init; + }; + } else if (typeof init !== "function") { + var ownInitializers = init; - for (var i = 0; i < ownInitializers.length; i++) { - value = ownInitializers[i].call(instance, value); - } + init = function (instance, init) { + var value = init; - return value; - }; - } else { - var originalInitializer = init; + for (var i = 0; i < ownInitializers.length; i++) { + value = ownInitializers[i].call(instance, value); + } - init = function (instance, init) { - return originalInitializer.call(instance, init); - }; - } + return value; + }; + } else { + var originalInitializer = init; - ret.push(init); - } + init = function (instance, init) { + return originalInitializer.call(instance, init); + }; + } - if (kind !== 0 /* FIELD */) { - if (kind === 1 /* ACCESSOR */) { - desc.get = value.get; - desc.set = value.set; - } else if (kind === 2 /* METHOD */) { - desc.value = value; - } else if (kind === 3 /* GETTER */) { - desc.get = value; - } else if (kind === 4 /* SETTER */) { - desc.set = value; + ret.push(init); } - if (isPrivate) { + if (kind !== 0 /* FIELD */) { if (kind === 1 /* ACCESSOR */) { - ret.push(function (instance, args) { - return value.get.call(instance, args); - }); - ret.push(function (instance, args) { - return value.set.call(instance, args); - }); + desc.get = value.get; + desc.set = value.set; } else if (kind === 2 /* METHOD */) { - ret.push(value); + desc.value = value; + } else if (kind === 3 /* GETTER */) { + desc.get = value; + } else if (kind === 4 /* SETTER */) { + desc.set = value; + } + + if (isPrivate) { + if (kind === 1 /* ACCESSOR */) { + ret.push(function (instance, args) { + return value.get.call(instance, args); + }); + ret.push(function (instance, args) { + return value.set.call(instance, args); + }); + } else if (kind === 2 /* METHOD */) { + ret.push(value); + } else { + ret.push(function (instance, args) { + return value.call(instance, args); + }); + } } else { - ret.push(function (instance, args) { - return value.call(instance, args); - }); + Object.defineProperty(base, name, desc); } - } else { - Object.defineProperty(base, name, desc); } } -} -function applyMemberDecs(Class, decInfos, instanceBrand) { - var ret = []; - var protoInitializers; - var staticInitializers; - var staticBrand; - - var existingProtoNonFields = new Map(); - var existingStaticNonFields = new Map(); - - for (var i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - - // skip computed property names - if (!Array.isArray(decInfo)) continue; - - var kind = decInfo[1]; - var name = decInfo[2]; - var isPrivate = decInfo.length > 3; - - var isStatic = kind >= 5; /* STATIC */ - var base; - var initializers; - var hasPrivateBrand = instanceBrand; - - if (isStatic) { - base = Class; - kind = kind - 5 /* STATIC */; - // initialize staticInitializers when we see a non-field static member - if (kind !== 0 /* FIELD */) { - staticInitializers = staticInitializers || []; - initializers = staticInitializers; - } - if (isPrivate && !staticBrand) { - staticBrand = function (_) { - return checkInRHS(_) === Class; - }; - } - hasPrivateBrand = staticBrand; - } else { - base = Class.prototype; - // initialize protoInitializers when we see a non-field member - if (kind !== 0 /* FIELD */) { - protoInitializers = protoInitializers || []; - initializers = protoInitializers; + function applyMemberDecs(Class, decInfos, instanceBrand) { + var ret = []; + var protoInitializers; + var staticInitializers; + var staticBrand; + + var existingProtoNonFields = new Map(); + var existingStaticNonFields = new Map(); + + for (var i = 0; i < decInfos.length; i++) { + var decInfo = decInfos[i]; + + // skip computed property names + if (!Array.isArray(decInfo)) continue; + + var kind = decInfo[1]; + var name = decInfo[2]; + var isPrivate = decInfo.length > 3; + + var isStatic = kind >= 5; /* STATIC */ + var base; + var initializers; + var hasPrivateBrand = instanceBrand; + + if (isStatic) { + base = Class; + kind = kind - 5 /* STATIC */; + // initialize staticInitializers when we see a non-field static member + if (kind !== 0 /* FIELD */) { + staticInitializers = staticInitializers || []; + initializers = staticInitializers; + } + if (isPrivate && !staticBrand) { + staticBrand = function (_) { + return checkInRHS(_) === Class; + }; + } + hasPrivateBrand = staticBrand; + } else { + base = Class.prototype; + // initialize protoInitializers when we see a non-field member + if (kind !== 0 /* FIELD */) { + protoInitializers = protoInitializers || []; + initializers = protoInitializers; + } } - } - if (kind !== 0 /* FIELD */ && !isPrivate) { - var existingNonFields = isStatic - ? existingStaticNonFields - : existingProtoNonFields; - - var existingKind = existingNonFields.get(name) || 0; - - if ( - existingKind === true || - (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ || - (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */ - ) { - 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: " + - name - ); - } else if (!existingKind && kind > 2 /* METHOD */) { - existingNonFields.set(name, kind); - } else { - existingNonFields.set(name, true); + if (kind !== 0 /* FIELD */ && !isPrivate) { + var existingNonFields = isStatic + ? existingStaticNonFields + : existingProtoNonFields; + + var existingKind = existingNonFields.get(name) || 0; + + if ( + existingKind === true || + (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ || + (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */ + ) { + 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: " + + name + ); + } else if (!existingKind && kind > 2 /* METHOD */) { + existingNonFields.set(name, kind); + } else { + existingNonFields.set(name, true); + } } + + applyMemberDec( + ret, + base, + decInfo, + name, + kind, + isStatic, + isPrivate, + initializers, + hasPrivateBrand + ); } - applyMemberDec( - ret, - base, - decInfo, - name, - kind, - isStatic, - isPrivate, - initializers, - hasPrivateBrand - ); + pushInitializers(ret, protoInitializers); + pushInitializers(ret, staticInitializers); + return ret; } - pushInitializers(ret, protoInitializers); - pushInitializers(ret, staticInitializers); - return ret; -} - -function pushInitializers(ret, initializers) { - if (initializers) { - ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) { - initializers[i].call(instance); - } - return instance; - }); + function pushInitializers(ret, initializers) { + if (initializers) { + ret.push(function (instance) { + for (var i = 0; i < initializers.length; i++) { + initializers[i].call(instance); + } + return instance; + }); + } } -} -function applyClassDecs(targetClass, classDecs) { - if (classDecs.length > 0) { - var initializers = []; - var newClass = targetClass; - var name = targetClass.name; - - for (var i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { v: false }; - - try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod( - initializers, - decoratorFinishedRef - ), - }); - } finally { - decoratorFinishedRef.v = true; - } + function applyClassDecs(targetClass, classDecs) { + if (classDecs.length > 0) { + var initializers = []; + var newClass = targetClass; + var name = targetClass.name; + + for (var i = classDecs.length - 1; i >= 0; i--) { + var decoratorFinishedRef = { v: false }; + + try { + var nextNewClass = classDecs[i](newClass, { + kind: "class", + name: name, + addInitializer: createAddInitializerMethod( + initializers, + decoratorFinishedRef + ), + }); + } finally { + decoratorFinishedRef.v = true; + } - if (nextNewClass !== undefined) { - assertValidReturnValue(10 /* CLASS */, nextNewClass); - newClass = nextNewClass; + if (nextNewClass !== undefined) { + assertValidReturnValue(10 /* CLASS */, nextNewClass); + newClass = nextNewClass; + } } - } - return [ - newClass, - function () { - for (var i = 0; i < initializers.length; i++) { - initializers[i].call(newClass); - } - }, - ]; + return [ + newClass, + function () { + for (var i = 0; i < initializers.length; i++) { + initializers[i].call(newClass); + } + }, + ]; + } + // The transformer will not emit assignment when there are no class decorators, + // so we don't have to return an empty array here. } - // The transformer will not emit assignment when there are no class decorators, - // so we don't have to return an empty array here. -} -/** - Basic usage: + /** + Basic usage: - applyDecs( - Class, - [ - // member decorators + applyDecs( + Class, + [ + // member decorators + [ + dec, // dec or array of decs + 0, // kind of value being decorated + 'prop', // name of public prop on class containing the value being decorated, + '#p', // the name of the private property (if is private, void 0 otherwise), + ] + ], [ - dec, // dec or array of decs - 0, // kind of value being decorated - 'prop', // name of public prop on class containing the value being decorated, - '#p', // the name of the private property (if is private, void 0 otherwise), + // class decorators + dec1, dec2 ] - ], - [ - // class decorators - dec1, dec2 - ] - ) - ``` - - Fully transpiled example: - - ```js - @dec - class Class { - @dec - a = 123; + ) + ``` - @dec - #a = 123; + Fully transpiled example: + ```js @dec - @dec2 - accessor b = 123; + class Class { + @dec + a = 123; - @dec - accessor #b = 123; + @dec + #a = 123; - @dec - c() { console.log('c'); } + @dec + @dec2 + accessor b = 123; - @dec - #c() { console.log('privC'); } + @dec + accessor #b = 123; - @dec - get d() { console.log('d'); } + @dec + c() { console.log('c'); } - @dec - get #d() { console.log('privD'); } + @dec + #c() { console.log('privC'); } - @dec - set e(v) { console.log('e'); } + @dec + get d() { console.log('d'); } - @dec - set #e(v) { console.log('privE'); } - } + @dec + get #d() { console.log('privD'); } + @dec + set e(v) { console.log('e'); } - // becomes - let initializeInstance; - let initializeClass; + @dec + set #e(v) { console.log('privE'); } + } - let initA; - let initPrivA; - let initB; - let initPrivB, getPrivB, setPrivB; + // becomes + let initializeInstance; + let initializeClass; - let privC; - let privD; - let privE; + let initA; + let initPrivA; - let Class; - class _Class { - static { - let ret = applyDecs( - this, - [ - [dec, 0, 'a'], - [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], - [[dec, dec2], 1, 'b'], - [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], - [dec, 2, 'c'], - [dec, 2, 'c', () => console.log('privC')], - [dec, 3, 'd'], - [dec, 3, 'd', () => console.log('privD')], - [dec, 4, 'e'], - [dec, 4, 'e', () => console.log('privE')], - ], - [ - dec - ] - ) + let initB; + let initPrivB, getPrivB, setPrivB; - initA = ret[0]; + let privC; + let privD; + let privE; - initPrivA = ret[1]; + let Class; + class _Class { + static { + let ret = applyDecs( + this, + [ + [dec, 0, 'a'], + [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[dec, dec2], 1, 'b'], + [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [dec, 2, 'c'], + [dec, 2, 'c', () => console.log('privC')], + [dec, 3, 'd'], + [dec, 3, 'd', () => console.log('privD')], + [dec, 4, 'e'], + [dec, 4, 'e', () => console.log('privE')], + ], + [ + dec + ] + ) - initB = ret[2]; + initA = ret[0]; - initPrivB = ret[3]; - getPrivB = ret[4]; - setPrivB = ret[5]; + initPrivA = ret[1]; - privC = ret[6]; + initB = ret[2]; - privD = ret[7]; + initPrivB = ret[3]; + getPrivB = ret[4]; + setPrivB = ret[5]; - privE = ret[8]; + privC = ret[6]; - initializeInstance = ret[9]; + privD = ret[7]; - Class = ret[10] + privE = ret[8]; - initializeClass = ret[11]; - } + initializeInstance = ret[9]; + + Class = ret[10] - a = (initializeInstance(this), initA(this, 123)); + initializeClass = ret[11]; + } - #a = initPrivA(this, 123); + a = (initializeInstance(this), initA(this, 123)); - #bData = initB(this, 123); - get b() { return this.#bData } - set b(v) { this.#bData = v } + #a = initPrivA(this, 123); - #privBData = initPrivB(this, 123); - get #b() { return getPrivB(this); } - set #b(v) { setPrivB(this, v); } + #bData = initB(this, 123); + get b() { return this.#bData } + set b(v) { this.#bData = v } - c() { console.log('c'); } + #privBData = initPrivB(this, 123); + get #b() { return getPrivB(this); } + set #b(v) { setPrivB(this, v); } - #c(...args) { return privC(this, ...args) } + c() { console.log('c'); } - get d() { console.log('d'); } + #c(...args) { return privC(this, ...args) } - get #d() { return privD(this); } + get d() { console.log('d'); } - set e(v) { console.log('e'); } + get #d() { return privD(this); } - set #e(v) { privE(this, v); } - } + set e(v) { console.log('e'); } + + set #e(v) { privE(this, v); } + } - initializeClass(Class); - */ + initializeClass(Class); + */ + return function applyDecs2301( + targetClass, + memberDecs, + classDecs, + instanceBrand + ) { + return { + e: applyMemberDecs(targetClass, memberDecs, instanceBrand), + // Lazily apply class decorations so that member init locals can be properly bound. + get c() { + return applyClassDecs(targetClass, classDecs); + }, + }; + }; +} export default function applyDecs2301( targetClass, @@ -681,11 +701,10 @@ export default function applyDecs2301( classDecs, instanceBrand ) { - return { - e: applyMemberDecs(targetClass, memberDecs, instanceBrand), - // Lazily apply class decorations so that member init locals can be properly bound. - get c() { - return applyClassDecs(targetClass, classDecs); - }, - }; + return (applyDecs2301 = applyDecs2301Factory())( + targetClass, + memberDecs, + classDecs, + instanceBrand + ); } diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index f08289d4eca5..2262a1c7eb89 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -72,6 +72,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", + "./helpers/applyDecs2303": [ + { + "node": "./helpers/applyDecs2303.js", + "import": "./helpers/esm/applyDecs2303.js", + "default": "./helpers/applyDecs2303.js" + }, + "./helpers/applyDecs2303.js" + ], + "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index e191ade33e24..ef1ce7966ae9 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -71,6 +71,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", + "./helpers/applyDecs2303": [ + { + "node": "./helpers/applyDecs2303.js", + "import": "./helpers/esm/applyDecs2303.js", + "default": "./helpers/applyDecs2303.js" + }, + "./helpers/applyDecs2303.js" + ], + "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 156dd84c643a..ced5ec6d9693 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -71,6 +71,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", + "./helpers/applyDecs2303": [ + { + "node": "./helpers/applyDecs2303.js", + "import": "./helpers/esm/applyDecs2303.js", + "default": "./helpers/applyDecs2303.js" + }, + "./helpers/applyDecs2303.js" + ], + "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", From 1fcaf6c23f4058d29bf70d5ce86e56aab7ba84b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 13 Apr 2023 15:23:53 +0200 Subject: [PATCH 03/15] chore: Add 2023-03 decorator version (alias of 2023-01 for now) --- .../src/index.ts | 5 +++-- ...rmer-2023-01.ts => transformer-2023-03.ts} | 19 ++++++++++++++----- .../src/index.ts | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 11 deletions(-) rename packages/babel-plugin-proposal-decorators/src/{transformer-2023-01.ts => transformer-2023-03.ts} (98%) diff --git a/packages/babel-plugin-proposal-decorators/src/index.ts b/packages/babel-plugin-proposal-decorators/src/index.ts index f6c7d6730137..9e2e4c0b8c1e 100644 --- a/packages/babel-plugin-proposal-decorators/src/index.ts +++ b/packages/babel-plugin-proposal-decorators/src/index.ts @@ -7,7 +7,7 @@ import { FEATURES, } from "@babel/helper-create-class-features-plugin"; import legacyVisitor from "./transformer-legacy"; -import transformer2022_03 from "./transformer-2023-01"; +import transformer2022_03 from "./transformer-2023-03"; import type { Options as SyntaxOptions } from "@babel/plugin-syntax-decorators"; interface Options extends SyntaxOptions { @@ -40,7 +40,8 @@ export default declare((api, options: Options) => { } else if ( version === "2021-12" || version === "2022-03" || - version === "2023-01" + version === "2023-01" || + version === "2023-03" ) { return transformer2022_03(api, options, version); } else if (!process.env.BABEL_8_BREAKING) { diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-01.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts similarity index 98% rename from packages/babel-plugin-proposal-decorators/src/transformer-2023-01.ts rename to packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index c7b0d1424ebc..108b24136e9c 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-01.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -20,7 +20,7 @@ type ClassElement = | t.TSIndexSignature | t.StaticBlock; -type DecoratorVersionKind = "2023-01" | "2022-03" | "2021-12"; +type DecoratorVersionKind = "2023-03" | "2023-01" | "2022-03" | "2021-12"; function incrementId(id: number[], idx = id.length - 1): void { // If index is -1, id needs an additional character, unshift A @@ -233,7 +233,7 @@ function extractProxyAccessorsFor( targetKey: t.PrivateName, version: DecoratorVersionKind, ): (t.FunctionExpression | t.ArrowFunctionExpression)[] { - if (version !== "2023-01") { + if (version !== "2023-03" && version !== "2023-01") { return [ template.expression.ast` function () { @@ -1056,7 +1056,16 @@ function createLocalsAssignment( ); } else { // TODO(Babel 8): Only keep the if branch - if (version === "2023-01") { + if (version === "2023-03") { + if (maybePrivateBranName) { + args.push( + template.expression.ast` + _ => ${t.cloneNode(maybePrivateBranName)} in _ + ` as t.ArrowFunctionExpression, + ); + } + rhs = t.callExpression(state.addHelper("applyDecs2303"), args); + } else if (version === "2023-01") { if (maybePrivateBranName) { args.push( template.expression.ast` @@ -1092,9 +1101,9 @@ function createLocalsAssignment( export default function ( { assertVersion, assumption }: PluginAPI, { loose }: Options, - version: "2023-01" | "2022-03" | "2021-12", + version: "2023-03" | "2023-01" | "2022-03" | "2021-12", ): PluginObject { - if (version === "2023-01") { + if (version === "2023-03" || version === "2023-01") { assertVersion("^7.21.0"); } else if (version === "2021-12") { assertVersion("^7.16.0"); diff --git a/packages/babel-plugin-syntax-decorators/src/index.ts b/packages/babel-plugin-syntax-decorators/src/index.ts index 292e48fe2587..1fe36fb7658e 100644 --- a/packages/babel-plugin-syntax-decorators/src/index.ts +++ b/packages/babel-plugin-syntax-decorators/src/index.ts @@ -3,8 +3,14 @@ import { declare } from "@babel/helper-plugin-utils"; export interface Options { // TODO(Babel 8): Remove legacy?: boolean; - // TODO(Babel 8): Remove "2018-09", "2021-12", and '2022-03' - version?: "legacy" | "2018-09" | "2021-12" | "2022-03" | "2023-01"; + // TODO(Babel 8): Remove "2018-09", "2021-12", '2022-03', and '2023-01' + version?: + | "legacy" + | "2018-09" + | "2021-12" + | "2022-03" + | "2023-01" + | "2023-03"; // TODO(Babel 8): Remove decoratorsBeforeExport?: boolean; } @@ -18,10 +24,11 @@ export default declare((api, options: Options) => { if (version === undefined) { throw new Error( "The decorators plugin requires a 'version' option, whose value must be one of: " + - "'2023-01', '2022-03', '2021-12', '2018-09', or 'legacy'.", + "'2023-03', '2023-01', '2022-03', '2021-12', '2018-09', or 'legacy'.", ); } if ( + version !== "2023-03" && version !== "2023-01" && version !== "2022-03" && version !== "2021-12" && @@ -56,6 +63,7 @@ export default declare((api, options: Options) => { if (version === undefined) { version = legacy ? "legacy" : "2018-09"; } else if ( + version !== "2023-03" && version !== "2023-01" && version !== "2022-03" && version !== "2021-12" && @@ -104,7 +112,7 @@ export default declare((api, options: Options) => { "decoratorAutoAccessors", ); } else { - if (version === "2023-01") { + if (version === "2023-01" || version === "2023-03") { parserOpts.plugins.push( ["decorators", { allowCallParenthesized: false }], "decoratorAutoAccessors", From 087a7994fcb0c290fe5334457d3b15c04e2c8c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 13 Apr 2023 15:26:49 +0200 Subject: [PATCH 04/15] chore: Copy tests from 2023-01 to 2023-03 --- .../2023-03-accessors--to-es2015/options.json | 8 ++ .../private/exec.js | 56 +++++++++ .../private/input.js | 8 ++ .../private/output.js | 39 ++++++ .../public/exec.js | 80 +++++++++++++ .../public/input.js | 11 ++ .../public/output.js | 41 +++++++ .../static-private/exec.js | 55 +++++++++ .../static-private/input.js | 8 ++ .../static-private/output.js | 40 +++++++ .../static-public/exec.js | 75 ++++++++++++ .../static-public/input.js | 11 ++ .../static-public/output.js | 39 ++++++ .../undecorated-private/exec.js | 31 +++++ .../undecorated-private/input.js | 6 + .../undecorated-private/output.js | 37 ++++++ .../undecorated-public/exec.js | 27 +++++ .../undecorated-public/input.js | 8 ++ .../undecorated-public/output.js | 38 ++++++ .../undecorated-static-private/exec.js | 29 +++++ .../undecorated-static-private/input.js | 6 + .../undecorated-static-private/output.js | 30 +++++ .../undecorated-static-public/exec.js | 22 ++++ .../undecorated-static-public/input.js | 8 ++ .../undecorated-static-public/output.js | 33 ++++++ .../fixtures/2023-03-accessors/options.json | 3 + .../2023-03-accessors/private/input.js | 8 ++ .../2023-03-accessors/private/output.js | 21 ++++ .../2023-03-accessors/public/input.js | 11 ++ .../2023-03-accessors/public/output.js | 29 +++++ .../2023-03-accessors/static-private/input.js | 8 ++ .../static-private/output.js | 22 ++++ .../2023-03-accessors/static-public/input.js | 11 ++ .../2023-03-accessors/static-public/output.js | 30 +++++ .../undecorated-private/input.js | 6 + .../undecorated-private/output.js | 17 +++ .../undecorated-public/input.js | 8 ++ .../undecorated-public/output.js | 24 ++++ .../undecorated-static-private/input.js | 6 + .../undecorated-static-private/output.js | 17 +++ .../undecorated-static-public/input.js | 8 ++ .../undecorated-static-public/output.js | 24 ++++ .../options.json | 6 + .../input.js | 7 ++ .../output.js | 14 +++ .../super-in-private-accessor/input.js | 7 ++ .../super-in-private-accessor/output.js | 16 +++ .../super-in-private-method/input.js | 7 ++ .../super-in-private-method/output.js | 14 +++ .../decorator-access-modified-fields/exec.js | 14 +++ .../decorator-access-modified-fields/input.js | 12 ++ .../output.js | 18 +++ .../decorator-access-modified-methods/exec.js | 14 +++ .../input.js | 12 ++ .../output.js | 19 +++ .../expressions-static-blocks/input.js | 12 ++ .../expressions-static-blocks/output.js | 67 +++++++++++ .../expressions/input.js | 12 ++ .../expressions/output.js | 13 ++ .../inheritance/exec.js | 18 +++ .../inheritance/input.js | 7 ++ .../inheritance/output.js | 11 ++ .../initializers/exec.js | 41 +++++++ .../initializers/input.js | 14 +++ .../initializers/output.js | 22 ++++ .../2023-03-classes--to-es2015/options.json | 8 ++ .../exec.js | 33 ++++++ .../input.js | 16 +++ .../output.js | 21 ++++ .../replacement-static-this/exec.js | 19 +++ .../replacement-static-this/input.js | 11 ++ .../replacement-static-this/output.js | 15 +++ .../replacement-with-expr/exec.js | 17 +++ .../replacement-with-expr/input.js | 7 ++ .../replacement-with-expr/output.js | 8 ++ .../replacement/exec.js | 19 +++ .../replacement/input.js | 7 ++ .../replacement/output.js | 12 ++ .../decorator-access-modified-fields/exec.js | 14 +++ .../decorator-access-modified-fields/input.js | 12 ++ .../options.json | 3 + .../output.js | 20 ++++ .../decorator-access-modified-methods/exec.js | 14 +++ .../input.js | 12 ++ .../options.json | 3 + .../output.js | 23 ++++ .../expressions-static-blocks/input.js | 12 ++ .../expressions-static-blocks/output.js | 112 ++++++++++++++++++ .../2023-03-classes/expressions/input.js | 12 ++ .../2023-03-classes/expressions/output.js | 76 ++++++++++++ .../2023-03-classes/inheritance/input.js | 6 + .../2023-03-classes/inheritance/output.js | 22 ++++ .../2023-03-classes/initializers/input.js | 14 +++ .../2023-03-classes/initializers/output.js | 32 +++++ .../fixtures/2023-03-classes/options.json | 3 + .../input.js | 16 +++ .../output.js | 23 ++++ .../replacement-static-this/input.js | 11 ++ .../replacement-static-this/output.js | 20 ++++ .../replacement-with-expr/input.js | 7 ++ .../replacement-with-expr/output.js | 12 ++ .../2023-03-classes/replacement/input.js | 7 ++ .../2023-03-classes/replacement/output.js | 17 +++ .../computed-keys-same-ast/exec.js | 33 ++++++ .../computed-keys-same-ast/input.js | 12 ++ .../computed-keys-same-ast/output.js | 16 +++ .../computed-keys-same-value/exec.js | 29 +++++ .../computed-keys-same-value/input.js | 12 ++ .../computed-keys-same-value/output.js | 16 +++ .../method-and-field/exec.js | 23 ++++ .../method-and-field/input.js | 10 ++ .../method-and-field/output.js | 11 ++ .../methods-with-same-key/exec.js | 19 +++ .../methods-with-same-key/input.js | 12 ++ .../methods-with-same-key/output.js | 14 +++ .../options.json | 8 ++ .../computed-keys-same-ast/input.js | 12 ++ .../computed-keys-same-ast/output.js | 18 +++ .../computed-keys-same-value/input.js | 12 ++ .../computed-keys-same-value/output.js | 18 +++ .../method-and-field/input.js | 10 ++ .../method-and-field/output.js | 11 ++ .../methods-with-same-key/input.js | 12 ++ .../methods-with-same-key/output.js | 16 +++ .../2023-03-duplicated-keys/options.json | 3 + .../default-anonymous/input.mjs | 1 + .../default-anonymous/output.mjs | 12 ++ .../2023-03-exported/default-named/input.mjs | 1 + .../2023-03-exported/default-named/output.mjs | 12 ++ .../member-decorator/input.mjs | 3 + .../member-decorator/output.mjs | 8 ++ .../fixtures/2023-03-exported/named/input.mjs | 1 + .../2023-03-exported/named/output.mjs | 12 ++ .../2023-03-exported/no-decorators/input.mjs | 4 + .../2023-03-exported/no-decorators/output.mjs | 3 + .../fixtures/2023-03-exported/options.json | 3 + .../2023-03-fields--to-es2015/options.json | 8 ++ .../2023-03-fields--to-es2015/private/exec.js | 44 +++++++ .../private/input.js | 8 ++ .../private/output.js | 17 +++ .../2023-03-fields--to-es2015/public/exec.js | 67 +++++++++++ .../2023-03-fields--to-es2015/public/input.js | 11 ++ .../public/output.js | 11 ++ .../static-private/exec.js | 42 +++++++ .../static-private/input.js | 8 ++ .../static-private/output.js | 12 ++ .../static-public/exec.js | 62 ++++++++++ .../static-public/input.js | 11 ++ .../static-public/output.js | 8 ++ .../test/fixtures/2023-03-fields/options.json | 3 + .../fixtures/2023-03-fields/private/input.js | 8 ++ .../fixtures/2023-03-fields/private/output.js | 9 ++ .../fixtures/2023-03-fields/public/input.js | 11 ++ .../fixtures/2023-03-fields/public/output.js | 11 ++ .../2023-03-fields/static-private/input.js | 8 ++ .../2023-03-fields/static-private/output.js | 9 ++ .../2023-03-fields/static-public/input.js | 11 ++ .../2023-03-fields/static-public/output.js | 11 ++ .../2023-03-getters--to-es2015/options.json | 8 ++ .../private/exec.js | 42 +++++++ .../private/input.js | 13 ++ .../private/output.js | 22 ++++ .../2023-03-getters--to-es2015/public/exec.js | 56 +++++++++ .../public/input.js | 14 +++ .../public/output.js | 16 +++ .../static-private/exec.js | 41 +++++++ .../static-private/input.js | 13 ++ .../static-private/output.js | 21 ++++ .../static-public/exec.js | 54 +++++++++ .../static-public/input.js | 14 +++ .../static-public/output.js | 16 +++ .../options.json | 8 ++ .../private/exec.js | 74 ++++++++++++ .../private/input.js | 22 ++++ .../private/output.js | 30 +++++ .../public/exec.js | 103 ++++++++++++++++ .../public/input.js | 24 ++++ .../public/output.js | 23 ++++ .../static-private/exec.js | 72 +++++++++++ .../static-private/input.js | 22 ++++ .../static-private/output.js | 29 +++++ .../static-public/exec.js | 102 ++++++++++++++++ .../static-public/input.js | 24 ++++ .../static-public/output.js | 23 ++++ .../2023-03-getters-and-setters/options.json | 3 + .../private/input.js | 22 ++++ .../private/output.js | 27 +++++ .../public/input.js | 24 ++++ .../public/output.js | 25 ++++ .../static-private/input.js | 22 ++++ .../static-private/output.js | 25 ++++ .../static-public/input.js | 24 ++++ .../static-public/output.js | 23 ++++ .../fixtures/2023-03-getters/options.json | 3 + .../fixtures/2023-03-getters/private/input.js | 13 ++ .../2023-03-getters/private/output.js | 19 +++ .../fixtures/2023-03-getters/public/input.js | 14 +++ .../fixtures/2023-03-getters/public/output.js | 18 +++ .../2023-03-getters/static-private/input.js | 13 ++ .../2023-03-getters/static-private/output.js | 17 +++ .../2023-03-getters/static-public/input.js | 14 +++ .../2023-03-getters/static-public/output.js | 16 +++ .../2023-03-methods--to-es2015/options.json | 8 ++ .../private-with-initializers/exec.js | 44 +++++++ .../private/exec.js | 24 ++++ .../private/input.js | 13 ++ .../private/output.js | 19 +++ .../public-with-initializers/exec.js | 59 +++++++++ .../2023-03-methods--to-es2015/public/exec.js | 27 +++++ .../public/input.js | 14 +++ .../public/output.js | 16 +++ .../static-private-with-initializers/exec.js | 42 +++++++ .../static-private/exec.js | 22 ++++ .../static-private/input.js | 13 ++ .../static-private/output.js | 18 +++ .../static-public-with-initializers/exec.js | 54 +++++++++ .../static-public/exec.js | 25 ++++ .../static-public/input.js | 14 +++ .../static-public/output.js | 16 +++ .../fixtures/2023-03-methods/options.json | 3 + .../fixtures/2023-03-methods/private/input.js | 13 ++ .../2023-03-methods/private/output.js | 17 +++ .../fixtures/2023-03-methods/public/input.js | 14 +++ .../fixtures/2023-03-methods/public/output.js | 18 +++ .../2023-03-methods/static-private/input.js | 13 ++ .../2023-03-methods/static-private/output.js | 15 +++ .../2023-03-methods/static-public/input.js | 14 +++ .../2023-03-methods/static-public/output.js | 16 +++ .../class-and-method-decorators/exec.js | 77 ++++++++++++ .../class-and-property-decorators/exec.js | 45 +++++++ .../decorator-evaluation-scope/exec.js | 12 ++ .../exec.js | 28 +++++ .../input.js | 11 ++ .../output.js | 12 ++ .../initializer-property-ignored/exec.js | 25 ++++ .../initializer-timing/exec.js | 34 ++++++ .../exec.js | 17 +++ .../leaked-context-addInitializer/exec.js | 18 +++ .../2023-03-misc--to-es2015/options.json | 8 ++ .../valid-expression-formats/input.js | 23 ++++ .../valid-expression-formats/output.js | 35 ++++++ .../2023-03-misc/all-decorators/input.js | 27 +++++ .../2023-03-misc/all-decorators/output.js | 71 +++++++++++ .../decorator-evaluation-scope/exec.js | 12 ++ .../decorator-evaluation-scope/options.json | 7 ++ .../input.js | 24 ++++ .../output.js | 28 +++++ .../input.js | 11 ++ .../output.js | 13 ++ .../initializer-property-ignored/exec.js | 25 ++++ .../initializer-property-ignored/options.json | 7 ++ .../test/fixtures/2023-03-misc/options.json | 3 + .../private-keys-in-enclosing-class/input.js | 11 ++ .../private-keys-in-enclosing-class/output.js | 16 +++ .../input.js | 8 ++ .../options.json | 3 + .../input.js | 8 ++ .../options.json | 3 + .../input.js | 8 ++ .../options.json | 3 + .../setting-private-method-via-rest/input.js | 8 ++ .../options.json | 3 + .../input.js | 8 ++ .../options.json | 3 + .../setting-private-method/input.js | 8 ++ .../setting-private-method/options.json | 3 + .../input.js | 7 ++ .../output.js | 14 +++ .../super-in-private-accessor/input.js | 7 ++ .../super-in-private-accessor/output.js | 16 +++ .../super-in-private-method/input.js | 7 ++ .../super-in-private-method/output.js | 14 +++ .../valid-expression-formats/input.js | 23 ++++ .../valid-expression-formats/output.js | 36 ++++++ .../accessor-initializers-fields/exec.js | 67 +++++++++++ .../accessor-method-initializers/exec.js | 75 ++++++++++++ .../exec.js | 51 ++++++++ .../exec.js | 77 ++++++++++++ .../field-initializers-after-methods/exec.js | 27 +++++ .../2023-03-ordering--to-es2015/field/exec.js | 31 +++++ .../initializers/exec.js | 56 +++++++++ .../2023-03-ordering--to-es2015/options.json | 8 ++ .../exec.js | 74 ++++++++++++ .../exec.js | 23 ++++ .../accessor-initializers-fields/exec.js | 67 +++++++++++ .../accessor-method-initializers/exec.js | 75 ++++++++++++ .../exec.js | 51 ++++++++ .../exec.js | 77 ++++++++++++ .../field-initializers-after-methods/exec.js | 27 +++++ .../fixtures/2023-03-ordering/field/exec.js | 31 +++++ .../2023-03-ordering/initializers/exec.js | 56 +++++++++ .../fixtures/2023-03-ordering/options.json | 4 + .../exec.js | 74 ++++++++++++ .../exec.js | 23 ++++ .../invalid-accessor-decorator-return/exec.js | 20 ++++ .../invalid-add-initializer/exec.js | 6 + .../invalid-class-decorator-return/exec.js | 9 ++ .../invalid-field-decorator-return/exec.js | 9 ++ .../invalid-getter-decorator-return/exec.js | 9 ++ .../invalid-method-decorator-return/exec.js | 9 ++ .../invalid-setter-decorator-return/exec.js | 9 ++ .../options.json | 8 ++ .../2023-03-setters--to-es2015/options.json | 8 ++ .../private/exec.js | 44 +++++++ .../private/input.js | 13 ++ .../private/output.js | 22 ++++ .../2023-03-setters--to-es2015/public/exec.js | 52 ++++++++ .../public/input.js | 14 +++ .../public/output.js | 16 +++ .../static-private/exec.js | 42 +++++++ .../static-private/input.js | 13 ++ .../static-private/output.js | 21 ++++ .../static-public/exec.js | 50 ++++++++ .../static-public/input.js | 14 +++ .../static-public/output.js | 16 +++ .../fixtures/2023-03-setters/options.json | 3 + .../fixtures/2023-03-setters/private/input.js | 13 ++ .../2023-03-setters/private/output.js | 19 +++ .../fixtures/2023-03-setters/public/input.js | 14 +++ .../fixtures/2023-03-setters/public/output.js | 18 +++ .../2023-03-setters/static-private/input.js | 13 ++ .../2023-03-setters/static-private/output.js | 17 +++ .../2023-03-setters/static-public/input.js | 14 +++ .../2023-03-setters/static-public/output.js | 16 +++ 324 files changed, 6903 insertions(+) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js new file mode 100644 index 000000000000..3b8e879c54b8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js @@ -0,0 +1,56 @@ +function dec({ get, set }, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return { + get() { + return get.call(this) + 1; + }, + + set(v) { + set.call(this, v + 1); + }, + + init(v) { + return v ? v : 1; + } + } +} + +class Foo { + @dec + accessor #a; + + @dec + accessor #b = 123; +} + +let foo = new Foo(); + +const aContext = foo['#aContext']; +const bContext = foo['#bContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(false); + +expect(aContext.access.get(foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +aContext.access.set(foo, 123); +expect(aContext.access.get(foo)).toBe(125); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('accessor'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.access.get(foo)).toBe(124); +bContext.access.set(foo, 123); +expect(bContext.access.get(foo)).toBe(125); +expect(bContext.name).toBe('#b'); +expect(bContext.kind).toBe('accessor'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(true); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js new file mode 100644 index 000000000000..aa152db91d94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + accessor #a; + + @dec + accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js new file mode 100644 index 000000000000..fd3674330e31 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js @@ -0,0 +1,39 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; +const dec = () => {}; +var _A = /*#__PURE__*/new WeakMap(); +var _a = /*#__PURE__*/new WeakMap(); +var _B = /*#__PURE__*/new WeakMap(); +var _b = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b2, + set: _set_b2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a2, + set: _set_a2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: (_initProto(this), _init_a(this)) + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: _init_b(this, 123) + }); + } +} +function _set_a2(v) { + _set_a(this, v); +} +function _get_a2() { + return _get_a(this); +} +function _set_b2(v) { + _set_b(this, v); +} +function _get_b2() { + return _get_b(this); +} +[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js new file mode 100644 index 000000000000..834c6deaecfe --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js @@ -0,0 +1,80 @@ +function dec({ get, set }, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return { + get() { + return get.call(this) + 1; + }, + + set(v) { + set.call(this, v + 1); + }, + + init(v) { + return v ? v : 1; + } + } +} + +class Foo { + @dec + accessor a; + + @dec + accessor b = 123; + + @dec + accessor ['c'] = 456; +} + +let foo = new Foo(); + +const aContext = foo['aContext']; +const bContext = foo['bContext']; +const cContext = foo['cContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(foo.a).toBe(2); +expect(aContext.access.get(foo)).toBe(2); +foo.a = 123; +expect(foo.a).toBe(125); +expect(aContext.access.get(foo)).toBe(125); +aContext.access.set(foo, 456); +expect(foo.a).toBe(458); +expect(aContext.access.get(foo)).toBe(458); +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('accessor'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); +expect(foo.hasOwnProperty('a')).toBe(false); +expect(Foo.prototype.hasOwnProperty('a')).toBe(true); + +expect(foo.b).toBe(124); +foo.b = 123; +expect(foo.b).toBe(125); +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('accessor'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); +expect(foo.hasOwnProperty('b')).toBe(false); +expect(Foo.prototype.hasOwnProperty('b')).toBe(true); + +expect(foo.c).toBe(457); +foo.c = 456; +expect(foo.c).toBe(458); +expect(cContext.name).toBe('c'); +expect(cContext.kind).toBe('accessor'); +expect(cContext.static).toBe(false); +expect(cContext.private).toBe(false); +expect(typeof cContext.addInitializer).toBe('function'); +expect(foo.hasOwnProperty('c')).toBe(false); +expect(Foo.prototype.hasOwnProperty('c')).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js new file mode 100644 index 000000000000..bd8be5cbe225 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + accessor a; + + @dec + accessor b = 123; + + @dec + accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js new file mode 100644 index 000000000000..22dc762cb4e8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js @@ -0,0 +1,41 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _initProto; +const dec = () => {}; +_computedKey = 'c'; +var _A = /*#__PURE__*/new WeakMap(); +var _B = /*#__PURE__*/new WeakMap(); +var _C = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: (_initProto(this), _init_a(this)) + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: _init_b(this, 123) + }); + babelHelpers.classPrivateFieldInitSpec(this, _C, { + writable: true, + value: _init_computedKey(this, 456) + }); + } + get a() { + return babelHelpers.classPrivateFieldGet(this, _A); + } + set a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); + } + get b() { + return babelHelpers.classPrivateFieldGet(this, _B); + } + set b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); + } + get [_computedKey]() { + return babelHelpers.classPrivateFieldGet(this, _C); + } + set [_computedKey](v) { + babelHelpers.classPrivateFieldSet(this, _C, v); + } +} +[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..14008e61c117 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js @@ -0,0 +1,55 @@ +function dec({ get, set }, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return { + get() { + return get.call(this) + 1; + }, + + set(v) { + set.call(this, v + 1); + }, + + init(v) { + return v ? v : 1; + } + } +} + +class Foo { + @dec + static accessor #a; + + @dec + static accessor #b = 123; +} + +const aContext = Foo['#aContext']; +const bContext = Foo['#bContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(false); + +expect(aContext.access.get(Foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +aContext.access.set(Foo, 123); +expect(aContext.access.get(Foo)).toBe(125); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(aContext.access.get(Foo)).toBe(125); +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('accessor'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.access.get(Foo)).toBe(124); +bContext.access.set(Foo, 123); +expect(bContext.access.get(Foo)).toBe(125); +expect(bContext.name).toBe('#b'); +expect(bContext.kind).toBe('accessor'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(true); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js new file mode 100644 index 000000000000..c30e61d463bc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + static accessor #a; + + @dec + static accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js new file mode 100644 index 000000000000..6280358addc8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js @@ -0,0 +1,40 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +var _b = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b2, + set: _set_b2 + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a2, + set: _set_a2 + }); + } +} +function _set_a2(v) { + _set_a(this, v); +} +function _get_a2() { + return _get_a(this); +} +function _set_b2(v) { + _set_b(this, v); +} +function _get_b2() { + return _get_b(this); +} +(() => { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 6, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [dec, 6, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; + _initStatic(Foo); +})(); +var _A = { + writable: true, + value: _init_a(Foo) +}; +var _B = { + writable: true, + value: _init_b(Foo, 123) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..402618d18490 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js @@ -0,0 +1,75 @@ +function dec({ get, set }, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return { + get() { + return get.call(this) + 1; + }, + + set(v) { + set.call(this, v + 1); + }, + + init(v) { + return v ? v : 1; + } + } +} + +class Foo { + @dec + static accessor a; + + @dec + static accessor b = 123; + + @dec + static accessor ['c'] = 456; +} + +const aContext = Foo['aContext']; +const bContext = Foo['bContext']; +const cContext = Foo['cContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(Foo.a).toBe(2); +expect(aContext.access.get(Foo)).toBe(2); +Foo.a = 123; +expect(Foo.a).toBe(125); +expect(aContext.access.get(Foo)).toBe(125); +aContext.access.set(Foo, 456); +expect(Foo.a).toBe(458); +expect(aContext.access.get(Foo)).toBe(458); +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('accessor'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); +expect(Foo.hasOwnProperty('a')).toBe(true); + +expect(Foo.b).toBe(124); +Foo.b = 123; +expect(Foo.b).toBe(125); +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('accessor'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); +expect(Foo.hasOwnProperty('b')).toBe(true); + +expect(Foo.c).toBe(457); +Foo.c = 456; +expect(Foo.c).toBe(458); +expect(cContext.name).toBe('c'); +expect(cContext.kind).toBe('accessor'); +expect(cContext.static).toBe(true); +expect(cContext.private).toBe(false); +expect(typeof cContext.addInitializer).toBe('function'); +expect(Foo.hasOwnProperty('c')).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js new file mode 100644 index 000000000000..50f05c065848 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + static accessor a; + + @dec + static accessor b = 123; + + @dec + static accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js new file mode 100644 index 000000000000..63f85787b96d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js @@ -0,0 +1,39 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + static get a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + } + static set a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + } + static get b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + } + static set b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + } + static get [_computedKey]() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + } + static set [_computedKey](v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + } +} +(() => { + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []).e; + _initStatic(Foo); +})(); +var _A = { + writable: true, + value: _init_a(Foo) +}; +var _B = { + writable: true, + value: _init_b(Foo, 123) +}; +var _C = { + writable: true, + value: _init_computedKey(Foo, 456) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js new file mode 100644 index 000000000000..51715be9f173 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js @@ -0,0 +1,31 @@ +class Foo { + accessor #a; + + accessor #b = 123; + + getA() { + return this.#a; + } + + setA(v) { + this.#a = v; + } + + getB() { + return this.#b; + } + + setB(v) { + this.#b = v; + } +} + +let foo = new Foo(); + +expect(foo.getA()).toBe(undefined); +foo.setA(123) +expect(foo.getA()).toBe(123); + +expect(foo.getB()).toBe(123); +foo.setB(456) +expect(foo.getB()).toBe(456); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js new file mode 100644 index 000000000000..07804cb8a125 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js @@ -0,0 +1,6 @@ +const dec = () => {}; +class Foo { + accessor #a; + + accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js new file mode 100644 index 000000000000..84ce390b7799 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js @@ -0,0 +1,37 @@ +const dec = () => {}; +var _A = /*#__PURE__*/new WeakMap(); +var _a = /*#__PURE__*/new WeakMap(); +var _B = /*#__PURE__*/new WeakMap(); +var _b = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _b, { + get: _get_b, + set: _set_b + }); + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: _set_a + }); + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: void 0 + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: 123 + }); + } +} +function _get_a() { + return babelHelpers.classPrivateFieldGet(this, _A); +} +function _set_a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); +} +function _get_b() { + return babelHelpers.classPrivateFieldGet(this, _B); +} +function _set_b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js new file mode 100644 index 000000000000..5ccd5dcce44d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js @@ -0,0 +1,27 @@ +class Foo { + accessor a; + + accessor b = 123; + + accessor ['c'] = 456; +} + +let foo = new Foo(); + +expect(foo.a).toBe(undefined); +foo.a = 123; +expect(foo.a).toBe(123); +expect(foo.hasOwnProperty('a')).toBe(false); +expect(Foo.prototype.hasOwnProperty('a')).toBe(true); + +expect(foo.b).toBe(123); +foo.b = 456 +expect(foo.b).toBe(456); +expect(foo.hasOwnProperty('b')).toBe(false); +expect(Foo.prototype.hasOwnProperty('b')).toBe(true); + +expect(foo.c).toBe(456); +foo.c = 789 +expect(foo.c).toBe(789); +expect(foo.hasOwnProperty('c')).toBe(false); +expect(Foo.prototype.hasOwnProperty('c')).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js new file mode 100644 index 000000000000..62dbd0c0381a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + accessor a; + + accessor b = 123; + + accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js new file mode 100644 index 000000000000..070b4006e2e9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js @@ -0,0 +1,38 @@ +const dec = () => {}; +var _A = /*#__PURE__*/new WeakMap(); +var _B = /*#__PURE__*/new WeakMap(); +var _C = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _A, { + writable: true, + value: void 0 + }); + babelHelpers.classPrivateFieldInitSpec(this, _B, { + writable: true, + value: 123 + }); + babelHelpers.classPrivateFieldInitSpec(this, _C, { + writable: true, + value: 456 + }); + } + get a() { + return babelHelpers.classPrivateFieldGet(this, _A); + } + set a(v) { + babelHelpers.classPrivateFieldSet(this, _A, v); + } + get b() { + return babelHelpers.classPrivateFieldGet(this, _B); + } + set b(v) { + babelHelpers.classPrivateFieldSet(this, _B, v); + } + get ['c']() { + return babelHelpers.classPrivateFieldGet(this, _C); + } + set ['c'](v) { + babelHelpers.classPrivateFieldSet(this, _C, v); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js new file mode 100644 index 000000000000..21defb3f24d8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js @@ -0,0 +1,29 @@ +class Foo { + static accessor #a; + + static accessor #b = 123; + + static getA() { + return this.#a; + } + + static setA(v) { + this.#a = v; + } + + static getB() { + return this.#b; + } + + static setB(v) { + this.#b = v; + } +} + +expect(Foo.getA()).toBe(undefined); +Foo.setA(123) +expect(Foo.getA()).toBe(123); + +expect(Foo.getB()).toBe(123); +Foo.setB(456) +expect(Foo.getB()).toBe(456); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js new file mode 100644 index 000000000000..9e893b86b863 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js @@ -0,0 +1,6 @@ +const dec = () => {}; +class Foo { + static accessor #a; + + static accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js new file mode 100644 index 000000000000..ab3a0e1b2678 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js @@ -0,0 +1,30 @@ +const dec = () => {}; +class Foo {} +function _get_a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); +} +function _set_a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); +} +function _get_b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); +} +function _set_b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); +} +var _b = { + get: _get_b, + set: _set_b +}; +var _a = { + get: _get_a, + set: _set_a +}; +var _A = { + writable: true, + value: void 0 +}; +var _B = { + writable: true, + value: 123 +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js new file mode 100644 index 000000000000..d22a4e710dd8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js @@ -0,0 +1,22 @@ +class Foo { + static accessor a; + + static accessor b = 123; + + static accessor ['c'] = 456; +} + +expect(Foo.a).toBe(undefined); +Foo.a = 123; +expect(Foo.a).toBe(123); +expect(Foo.hasOwnProperty('a')).toBe(true); + +expect(Foo.b).toBe(123); +Foo.b = 456 +expect(Foo.b).toBe(456); +expect(Foo.hasOwnProperty('b')).toBe(true); + +expect(Foo.c).toBe(456); +Foo.c = 789 +expect(Foo.c).toBe(789); +expect(Foo.hasOwnProperty('c')).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js new file mode 100644 index 000000000000..eb7463cb9fc1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + static accessor a; + + static accessor b = 123; + + static accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js new file mode 100644 index 000000000000..5041e9a95d6e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js @@ -0,0 +1,33 @@ +const dec = () => {}; +class Foo { + static get a() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + } + static set a(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + } + static get b() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + } + static set b(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + } + static get ['c']() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + } + static set ['c'](v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + } +} +var _A = { + writable: true, + value: void 0 +}; +var _B = { + writable: true, + value: 123 +}; +var _C = { + writable: true, + value: 456 +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js new file mode 100644 index 000000000000..aa152db91d94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + accessor #a; + + @dec + accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js new file mode 100644 index 000000000000..5896a742b32b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js @@ -0,0 +1,21 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; +const dec = () => {}; +class Foo { + static { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a", o => o.#A, (o, v) => o.#A = v], [dec, 1, "b", o => o.#B, (o, v) => o.#B = v]], [], _ => #a in _).e; + } + #A = (_initProto(this), _init_a(this)); + set #a(v) { + _set_a(this, v); + } + get #a() { + return _get_a(this); + } + #B = _init_b(this, 123); + set #b(v) { + _set_b(this, v); + } + get #b() { + return _get_b(this); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js new file mode 100644 index 000000000000..bd8be5cbe225 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + accessor a; + + @dec + accessor b = 123; + + @dec + accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js new file mode 100644 index 000000000000..c8dd2991237c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js @@ -0,0 +1,29 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _initProto; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + static { + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; + } + #A = (_initProto(this), _init_a(this)); + get a() { + return this.#A; + } + set a(v) { + this.#A = v; + } + #B = _init_b(this, 123); + get b() { + return this.#B; + } + set b(v) { + this.#B = v; + } + #C = _init_computedKey(this, 456); + get [_computedKey]() { + return this.#C; + } + set [_computedKey](v) { + this.#C = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js new file mode 100644 index 000000000000..c30e61d463bc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + static accessor #a; + + @dec + static accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js new file mode 100644 index 000000000000..ec458f4bddd2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js @@ -0,0 +1,22 @@ +var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; +const dec = () => {}; +class Foo { + static { + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 6, "a", o => o.#A, (o, v) => o.#A = v], [dec, 6, "b", o => o.#B, (o, v) => o.#B = v]], []).e; + _initStatic(this); + } + static #A = _init_a(this); + set #a(v) { + _set_a(this, v); + } + get #a() { + return _get_a(this); + } + static #B = _init_b(this, 123); + set #b(v) { + _set_b(this, v); + } + get #b() { + return _get_b(this); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js new file mode 100644 index 000000000000..50f05c065848 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + static accessor a; + + @dec + static accessor b = 123; + + @dec + static accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js new file mode 100644 index 000000000000..6d2b1c034626 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js @@ -0,0 +1,30 @@ +var _init_a, _init_b, _computedKey, _init_computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + static { + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []).e; + _initStatic(this); + } + static #A = _init_a(this); + static get a() { + return this.#A; + } + static set a(v) { + this.#A = v; + } + static #B = _init_b(this, 123); + static get b() { + return this.#B; + } + static set b(v) { + this.#B = v; + } + static #C = _init_computedKey(this, 456); + static get [_computedKey]() { + return this.#C; + } + static set [_computedKey](v) { + this.#C = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js new file mode 100644 index 000000000000..07804cb8a125 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js @@ -0,0 +1,6 @@ +const dec = () => {}; +class Foo { + accessor #a; + + accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js new file mode 100644 index 000000000000..50efd9ecf14f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js @@ -0,0 +1,17 @@ +const dec = () => {}; +class Foo { + #A; + get #a() { + return this.#A; + } + set #a(v) { + this.#A = v; + } + #B = 123; + get #b() { + return this.#B; + } + set #b(v) { + this.#B = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js new file mode 100644 index 000000000000..62dbd0c0381a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + accessor a; + + accessor b = 123; + + accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js new file mode 100644 index 000000000000..0082fd52b442 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + #A; + get a() { + return this.#A; + } + set a(v) { + this.#A = v; + } + #B = 123; + get b() { + return this.#B; + } + set b(v) { + this.#B = v; + } + #C = 456; + get ['c']() { + return this.#C; + } + set ['c'](v) { + this.#C = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js new file mode 100644 index 000000000000..9e893b86b863 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js @@ -0,0 +1,6 @@ +const dec = () => {}; +class Foo { + static accessor #a; + + static accessor #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js new file mode 100644 index 000000000000..9268d8a99d07 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js @@ -0,0 +1,17 @@ +const dec = () => {}; +class Foo { + static #A; + static get #a() { + return this.#A; + } + static set #a(v) { + this.#A = v; + } + static #B = 123; + static get #b() { + return this.#B; + } + static set #b(v) { + this.#B = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js new file mode 100644 index 000000000000..eb7463cb9fc1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + static accessor a; + + static accessor b = 123; + + static accessor ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js new file mode 100644 index 000000000000..32b5ee6911b8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + static #A; + static get a() { + return this.#A; + } + static set a(v) { + this.#A = v; + } + static #B = 123; + static get b() { + return this.#B; + } + static set b(v) { + this.#B = v; + } + static #C = 456; + static get ['c']() { + return this.#C; + } + static set ['c'](v) { + this.#C = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json new file mode 100644 index 000000000000..0127175ed0d1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]], + "assumptions": { + "constantSuper": true + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js new file mode 100644 index 000000000000..6bc1a7dbbc4b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +@dec +class Foo extends Bar { + constructor() { + let foo = super(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js new file mode 100644 index 000000000000..da70eb6e4869 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -0,0 +1,14 @@ +var _initClass; +const dec = () => {}; +let _Foo; +class Foo extends Bar { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + constructor() { + let foo = super(); + } + static { + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js new file mode 100644 index 000000000000..b32ea0bd378f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +class Foo extends Bar { + @dec + get #x() { + return super.foo(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js new file mode 100644 index 000000000000..6864ac68019a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js @@ -0,0 +1,16 @@ +var _call_x, _initProto; +const dec = () => {}; +class Foo extends Bar { + static { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + return Bar.prototype.foo.call(this); + }]], [], _ => #x in _).e; + } + constructor(...args) { + super(...args); + _initProto(this); + } + get #x() { + return _call_x(this); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js new file mode 100644 index 000000000000..36f9bd37dfa7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +class Foo extends Bar { + @dec + #x() { + return super.foo(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js new file mode 100644 index 000000000000..c63319616a0a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js @@ -0,0 +1,14 @@ +var _call_x, _initProto; +const dec = () => {}; +class Foo extends Bar { + static { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + return Bar.prototype.foo.call(this); + }]], [], _ => #x in _).e; + } + constructor(...args) { + super(...args); + _initProto(this); + } + #x = _call_x; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js new file mode 100644 index 000000000000..9d5c4bbf3d15 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js @@ -0,0 +1,14 @@ +var value; +const classDec = (Class) => { + value = (new Class).m; + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m; +} + +expect(value).toBe(42); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js new file mode 100644 index 000000000000..8689cf13f9e5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js @@ -0,0 +1,12 @@ +var value; +const classDec = (Class) => { + value = (new Class).p; + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js new file mode 100644 index 000000000000..7e214c498427 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js @@ -0,0 +1,18 @@ +var _initClass, _init_m; +var value; +const classDec = Class => { + value = new Class().p; + return Class; +}; +const memberDec = () => () => 42; +let _C; +class C { + constructor() { + babelHelpers.defineProperty(this, "m", _init_m(this)); + } +} +({ + e: [_init_m], + c: [_C, _initClass] +} = babelHelpers.applyDecs2303(C, [[memberDec, 0, "m"]], [classDec])); +_initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js new file mode 100644 index 000000000000..a85569beafbc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js @@ -0,0 +1,14 @@ +var value; +const classDec = (Class) => { + value = (new Class).m(); + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m() {}; +} + +expect(value).toBe(42); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js new file mode 100644 index 000000000000..7d8094583001 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js @@ -0,0 +1,12 @@ +var value; +const classDec = (Class) => { + value = (new Class).m(); + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m() {}; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js new file mode 100644 index 000000000000..b20c78d9814b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js @@ -0,0 +1,19 @@ +var _initClass, _initProto; +var value; +const classDec = Class => { + value = new Class().m(); + return Class; +}; +const memberDec = () => () => 42; +let _C; +class C { + constructor(...args) { + _initProto(this); + } + m() {} +} +({ + e: [_initProto], + c: [_C, _initClass] +} = babelHelpers.applyDecs2303(C, [[memberDec, 2, "m"]], [classDec])); +_initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js new file mode 100644 index 000000000000..853ac0e6a43b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +const A = @dec class A { static {} } +const B = @dec class C { static {} } +const D = @dec class { static {} } +const E = (@dec class { static {} }, 123); +const F = [@dec class G { static {} }, @dec class { static {} }]; +const H = @dec class extends I { static {} }; +const J = @dec class K extends L { static {} }; + +function classFactory() { + return @dec class { static {} } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js new file mode 100644 index 000000000000..99799da63d68 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js @@ -0,0 +1,67 @@ +var _initClass, _A, _temp, _initClass2, _C, _temp2, _initClass3, _D, _temp3, _initClass4, _decorated_class, _temp4, _class2, _initClass5, _G, _temp5, _initClass6, _decorated_class2, _temp6, _class3, _initClass7, _H, _temp7, _initClass8, _K, _temp8; +const dec = () => {}; +const A = (new (_temp = class extends babelHelpers.identity { + constructor() { + super(_A), (() => {})(), _initClass(); + } +}, (() => { + class A {} + [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [dec]).c; +})(), _temp)(), _A); +const B = (new (_temp2 = class extends babelHelpers.identity { + constructor() { + super(_C), (() => {})(), _initClass2(); + } +}, (() => { + class C {} + [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [dec]).c; +})(), _temp2)(), _C); +const D = (new (_temp3 = class extends babelHelpers.identity { + constructor() { + super(_D), (() => {})(), _initClass3(); + } +}, (() => { + class D {} + [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [dec]).c; +})(), _temp3)(), _D); +const E = ((new (_temp4 = class extends babelHelpers.identity { + constructor() { + super(_decorated_class), (() => {})(), _initClass4(); + } +}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [dec]).c), _temp4)(), _decorated_class), 123); +const F = [(new (_temp5 = class extends babelHelpers.identity { + constructor() { + super(_G), (() => {})(), _initClass5(); + } +}, (() => { + class G {} + [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [dec]).c; +})(), _temp5)(), _G), (new (_temp6 = class extends babelHelpers.identity { + constructor() { + super(_decorated_class2), (() => {})(), _initClass6(); + } +}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [dec]).c), _temp6)(), _decorated_class2)]; +const H = (new (_temp7 = class extends babelHelpers.identity { + constructor() { + super(_H), (() => {})(), _initClass7(); + } +}, (() => { + class H extends I {} + [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [dec]).c; +})(), _temp7)(), _H); +const J = (new (_temp8 = class extends babelHelpers.identity { + constructor() { + super(_K), (() => {})(), _initClass8(); + } +}, (() => { + class K extends L {} + [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [dec]).c; +})(), _temp8)(), _K); +function classFactory() { + var _initClass9, _decorated_class3, _temp9, _class5; + return new (_temp9 = class extends babelHelpers.identity { + constructor() { + super(_decorated_class3), (() => {})(), _initClass9(); + } + }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [dec]).c), _temp9)(), _decorated_class3; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js new file mode 100644 index 000000000000..77060bea50ff --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +const A = @dec class A {} +const B = @dec class C {} +const D = @dec class {} +const E = (@dec class {}, 123); +const F = [@dec class G {}, @dec class {}]; +const H = @dec class extends I {}; +const J = @dec class K extends L {}; + +function classFactory() { + return @dec class {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js new file mode 100644 index 000000000000..0fba5b7a4a85 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js @@ -0,0 +1,13 @@ +var _initClass, _A, _class, _initClass2, _C, _class2, _initClass3, _D, _class3, _initClass4, _decorated_class, _class4, _initClass5, _G, _class5, _initClass6, _decorated_class2, _class6, _initClass7, _H, _class7, _initClass8, _K, _class8; +const dec = () => {}; +const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _A); +const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [dec]).c, _initClass2()), _C); +const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [dec]).c, _initClass3()), _D); +const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [dec]).c, _initClass4()), _decorated_class), 123); +const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [dec]).c, _initClass6()), _decorated_class2)]; +const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [dec]).c, _initClass7()), _H); +const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [dec]).c, _initClass8()), _K); +function classFactory() { + var _initClass9, _decorated_class3, _class9; + return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [dec]).c, _initClass9()), _decorated_class3; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js new file mode 100644 index 000000000000..889e8c102cf4 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js @@ -0,0 +1,18 @@ +let count = 0; + +function dec1(Klass) { + expect(++count).toBe(1); + expect(Klass.name).toBe('Bar'); +} + +@dec1 +class Bar {} + +function dec2(Klass) { + expect(++count).toBe(2); + expect(Klass.name).toBe('Foo'); + expect(Object.getPrototypeOf(Klass)).toBe(Bar); +} + +@dec2 +class Foo extends Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js new file mode 100644 index 000000000000..96a13523506c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js @@ -0,0 +1,7 @@ +const dec1 = () => {}; +const dec2 = () => {}; +@dec1 +class Bar {} + +@dec2 +class Foo extends Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js new file mode 100644 index 000000000000..d975b8c90b39 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js @@ -0,0 +1,11 @@ +var _initClass, _initClass2; +const dec1 = () => {}; +const dec2 = () => {}; +let _Bar; +class Bar {} +[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [dec1]).c; +_initClass(); +let _Foo; +class Foo extends _Bar {} +[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [dec2]).c; +_initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js new file mode 100644 index 000000000000..aefc3ba5b88c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js @@ -0,0 +1,41 @@ +function dec1(Foo, { addInitializer }) { + expect(Foo.field).toBe(undefined); + addInitializer(() => { + Foo.initField = 123; + }); +} + +@dec1 +class Foo { + static { + expect(this.initField).toBe(undefined); + } + + static field = 123; +} + +expect(Foo.initField).toBe(123); +expect(Foo.field).toBe(123); + +function dec2(Bar, { addInitializer }) { + expect(Bar.field).toBe(123); + expect(Bar.otherField).toBe(undefined); + expect(Bar.initField).toBe(123); + addInitializer(() => { + Bar.initField = 456; + }); +} + +@dec2 +class Bar extends Foo { + static { + expect(this.initField).toBe(123); + this.otherField = 456; + } + + static field = 456; +} + +expect(Bar.initField).toBe(456); +expect(Bar.field).toBe(456); +expect(Bar.otherField).toBe(456); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js new file mode 100644 index 000000000000..87c785d39a93 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +@dec +class Foo { + static field = 123; +} + +@dec +class Bar extends Foo { + static { + this.otherField = 456; + } + + static field = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js new file mode 100644 index 000000000000..0da569b21815 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js @@ -0,0 +1,22 @@ +var _initClass, _temp, _initClass2, _temp2; +const dec = () => {}; +let _Foo; +new (_temp = class extends babelHelpers.identity { + constructor() { + (super(_Foo), babelHelpers.defineProperty(this, "field", 123)), _initClass(); + } +}, (() => { + class Foo {} + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; +})(), _temp)(); +let _Bar; +new (_temp2 = class extends babelHelpers.identity { + constructor() { + (super(_Bar), babelHelpers.defineProperty(this, "field", ((() => { + this.otherField = 456; + })(), 123))), _initClass2(); + } +}, (() => { + class Bar extends _Foo {} + [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [dec]).c; +})(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js new file mode 100644 index 000000000000..2f4e342e3eee --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js @@ -0,0 +1,33 @@ +let hasX, hasM, OriginalFoo; + +class Bar {} + +function dec(Foo) { + OriginalFoo = Foo; + return Bar; +} + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} + +expect(hasX(Bar)).toBe(true); +expect(hasM(Bar)).toBe(true); +expect(hasX(OriginalFoo)).toBe(false); +expect(hasM(OriginalFoo)).toBe(false); + +expect(Bar.hasOwnProperty("x")).toBe(true); +expect(OriginalFoo.hasOwnProperty("x")).toBe(false); + +expect(Bar.hasOwnProperty("m")).toBe(false); +expect(OriginalFoo.hasOwnProperty("m")).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js new file mode 100644 index 000000000000..e8c62db59046 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js @@ -0,0 +1,16 @@ +const dec = () => {}; +let hasX, hasM; + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js new file mode 100644 index 000000000000..b640a010c1a9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -0,0 +1,21 @@ +var _initClass, _x, _m, _temp; +const dec = () => {}; +let hasX, hasM; +let _Foo; +new (_x = /*#__PURE__*/new WeakMap(), _m = /*#__PURE__*/new WeakSet(), (_temp = class extends babelHelpers.identity { + constructor() { + (super(_Foo), babelHelpers.classPrivateMethodInitSpec(this, _m), babelHelpers.classPrivateFieldInitSpec(this, _x, { + writable: true, + value: void 0 + }), babelHelpers.defineProperty(this, "x", void 0)), (() => { + hasX = o => _x.has(babelHelpers.checkInRHS(o)); + hasM = o => _m.has(babelHelpers.checkInRHS(o)); + })(), _initClass(); + } +}, (() => { + class Foo { + static m() {} + } + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; +})(), _temp))(); +function _m2() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js new file mode 100644 index 000000000000..6b55df43edc8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js @@ -0,0 +1,19 @@ + +class Bar {} + +let _this, _this2, _this3; + +@(() => Bar) +class Foo { + static { + _this = this; + } + static field = (_this2 = this); + static { + _this3 = this; + } +} + +expect(_this).toBe(Bar); +expect(_this2).toBe(Bar); +expect(_this3).toBe(Bar); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js new file mode 100644 index 000000000000..1b8d46cf3ac0 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +@dec +class Foo { + static { + this + } + static field = this; + static { + this + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js new file mode 100644 index 000000000000..3e9c496a2f5b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js @@ -0,0 +1,15 @@ +var _initClass, _temp; +const dec = () => {}; +let _Foo; +new (_temp = class extends babelHelpers.identity { + constructor() { + (super(_Foo), babelHelpers.defineProperty(this, "field", ((() => { + this; + })(), this))), (() => { + this; + })(), _initClass(); + } +}, (() => { + class Foo {} + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; +})(), _temp)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js new file mode 100644 index 000000000000..739e33a05be5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js @@ -0,0 +1,17 @@ +let replaced; + +function dec(Klass) { + replaced = class extends Klass {}; + + return replaced; +} + +const Foo = @dec class Bar { + static bar = new Bar(); +}; + +const foo = new Foo(); + +expect(Foo).toBe(replaced); +expect(Foo.bar).toBeInstanceOf(replaced); +expect(foo).toBeInstanceOf(replaced); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js new file mode 100644 index 000000000000..0cd5e45110b7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +const Foo = @dec class Bar { + bar = new Bar(); +}; + +const foo = new Foo(); + diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js new file mode 100644 index 000000000000..ba5b7da737a3 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js @@ -0,0 +1,8 @@ +var _initClass, _Bar, _class; +const dec = () => {}; +const Foo = ((_class = class Bar { + constructor() { + babelHelpers.defineProperty(this, "bar", new _Bar()); + } +}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _Bar); +const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js new file mode 100644 index 000000000000..c8dc49c0d85e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js @@ -0,0 +1,19 @@ + +let replaced; + +function dec(Klass) { + replaced = class extends Klass {}; + + return replaced; +} + +@dec +class Foo { + static foo = new Foo(); +} + +const foo = new Foo(); + +expect(Foo).toBe(replaced); +expect(Foo.foo).toBeInstanceOf(replaced); +expect(foo).toBeInstanceOf(replaced); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js new file mode 100644 index 000000000000..8f0a4dfe092f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +@dec +class Foo { + static foo = new Foo(); +} + +const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js new file mode 100644 index 000000000000..ea526413bad4 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js @@ -0,0 +1,12 @@ +var _initClass, _temp; +const dec = () => {}; +let _Foo; +new (_temp = class extends babelHelpers.identity { + constructor() { + (super(_Foo), babelHelpers.defineProperty(this, "foo", new _Foo())), _initClass(); + } +}, (() => { + class Foo {} + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; +})(), _temp)(); +const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js new file mode 100644 index 000000000000..9d5c4bbf3d15 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js @@ -0,0 +1,14 @@ +var value; +const classDec = (Class) => { + value = (new Class).m; + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m; +} + +expect(value).toBe(42); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js new file mode 100644 index 000000000000..8689cf13f9e5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js @@ -0,0 +1,12 @@ +var value; +const classDec = (Class) => { + value = (new Class).p; + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json new file mode 100644 index 000000000000..f97653393918 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js new file mode 100644 index 000000000000..439521f4f065 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js @@ -0,0 +1,20 @@ +var _initClass, _init_m; +var value; +const classDec = Class => { + value = new Class().p; + return Class; +}; +const memberDec = () => () => 42; +let _C; +class C { + static { + ({ + e: [_init_m], + c: [_C, _initClass] + } = babelHelpers.applyDecs2303(this, [[memberDec, 0, "m"]], [classDec])); + } + m = _init_m(this); + static { + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js new file mode 100644 index 000000000000..a85569beafbc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js @@ -0,0 +1,14 @@ +var value; +const classDec = (Class) => { + value = (new Class).m(); + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m() {}; +} + +expect(value).toBe(42); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js new file mode 100644 index 000000000000..7d8094583001 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js @@ -0,0 +1,12 @@ +var value; +const classDec = (Class) => { + value = (new Class).m(); + return Class +}; + +const memberDec = () => () => 42; + +@classDec +class C { + @memberDec m() {}; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json new file mode 100644 index 000000000000..f97653393918 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js new file mode 100644 index 000000000000..e9b3ade00991 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js @@ -0,0 +1,23 @@ +var _initClass, _initProto; +var value; +const classDec = Class => { + value = new Class().m(); + return Class; +}; +const memberDec = () => () => 42; +let _C; +class C { + static { + ({ + e: [_initProto], + c: [_C, _initClass] + } = babelHelpers.applyDecs2303(this, [[memberDec, 2, "m"]], [classDec])); + } + constructor(...args) { + _initProto(this); + } + m() {} + static { + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js new file mode 100644 index 000000000000..853ac0e6a43b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +const A = @dec class A { static {} } +const B = @dec class C { static {} } +const D = @dec class { static {} } +const E = (@dec class { static {} }, 123); +const F = [@dec class G { static {} }, @dec class { static {} }]; +const H = @dec class extends I { static {} }; +const J = @dec class K extends L { static {} }; + +function classFactory() { + return @dec class { static {} } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js new file mode 100644 index 000000000000..3c1e27d025f1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js @@ -0,0 +1,112 @@ +var _initClass, _A, _initClass2, _C, _initClass3, _D, _initClass4, _decorated_class, _initClass5, _G, _initClass6, _decorated_class2, _initClass7, _H, _initClass8, _K; +const dec = () => {}; +const A = (new class extends babelHelpers.identity { + static { + class A { + static { + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_A), (() => {})(), _initClass(); + } +}(), _A); +const B = (new class extends babelHelpers.identity { + static { + class C { + static { + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_C), (() => {})(), _initClass2(); + } +}(), _C); +const D = (new class extends babelHelpers.identity { + static { + class D { + static { + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_D), (() => {})(), _initClass3(); + } +}(), _D); +const E = ((new class extends babelHelpers.identity { + static { + (class { + static { + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + }); + } + constructor() { + super(_decorated_class), (() => {})(), _initClass4(); + } +}(), _decorated_class), 123); +const F = [(new class extends babelHelpers.identity { + static { + class G { + static { + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_G), (() => {})(), _initClass5(); + } +}(), _G), (new class extends babelHelpers.identity { + static { + (class { + static { + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + }); + } + constructor() { + super(_decorated_class2), (() => {})(), _initClass6(); + } +}(), _decorated_class2)]; +const H = (new class extends babelHelpers.identity { + static { + class H extends I { + static { + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_H), (() => {})(), _initClass7(); + } +}(), _H); +const J = (new class extends babelHelpers.identity { + static { + class K extends L { + static { + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + constructor() { + super(_K), (() => {})(), _initClass8(); + } +}(), _K); +function classFactory() { + var _initClass9, _decorated_class3; + return new class extends babelHelpers.identity { + static { + (class { + static { + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + }); + } + constructor() { + super(_decorated_class3), (() => {})(), _initClass9(); + } + }(), _decorated_class3; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js new file mode 100644 index 000000000000..77060bea50ff --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +const A = @dec class A {} +const B = @dec class C {} +const D = @dec class {} +const E = (@dec class {}, 123); +const F = [@dec class G {}, @dec class {}]; +const H = @dec class extends I {}; +const J = @dec class K extends L {}; + +function classFactory() { + return @dec class {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js new file mode 100644 index 000000000000..29db6d8050d3 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js @@ -0,0 +1,76 @@ +var _initClass, _A, _initClass2, _C, _initClass3, _D, _initClass4, _decorated_class, _initClass5, _G, _initClass6, _decorated_class2, _initClass7, _H, _initClass8, _K; +const dec = () => {}; +const A = (class A { + static { + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass(); + } +}, _A); +const B = (class C { + static { + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass2(); + } +}, _C); +const D = (class D { + static { + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass3(); + } +}, _D); +const E = ((class { + static { + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass4(); + } +}, _decorated_class), 123); +const F = [(class G { + static { + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass5(); + } +}, _G), (class { + static { + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass6(); + } +}, _decorated_class2)]; +const H = (class H extends I { + static { + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass7(); + } +}, _H); +const J = (class K extends L { + static { + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass8(); + } +}, _K); +function classFactory() { + var _initClass9, _decorated_class3; + return class { + static { + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static { + _initClass9(); + } + }, _decorated_class3; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js new file mode 100644 index 000000000000..0657f6e2b364 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js @@ -0,0 +1,6 @@ +const dec = () => {}; +@dec1 +class Bar {} + +@dec2 +class Foo extends Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js new file mode 100644 index 000000000000..aa47aff8ef04 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js @@ -0,0 +1,22 @@ +var _initClass, _dec, _initClass2, _dec2; +const dec = () => {}; +let _Bar; +_dec = dec1; +class Bar { + static { + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + } + static { + _initClass(); + } +} +let _Foo; +_dec2 = dec2; +class Foo extends _Bar { + static { + [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [_dec2]).c; + } + static { + _initClass2(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js new file mode 100644 index 000000000000..87c785d39a93 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +@dec +class Foo { + static field = 123; +} + +@dec +class Bar extends Foo { + static { + this.otherField = 456; + } + + static field = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js new file mode 100644 index 000000000000..eecf942bf26e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js @@ -0,0 +1,32 @@ +var _initClass, _initClass2; +const dec = () => {}; +let _Foo; +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + field = 123; + constructor() { + super(_Foo), _initClass(); + } +}(); +let _Bar; +new class extends babelHelpers.identity { + static { + class Bar extends _Foo { + static { + [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + field = ((() => { + this.otherField = 456; + })(), 123); + constructor() { + super(_Bar), _initClass2(); + } +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js new file mode 100644 index 000000000000..e8c62db59046 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js @@ -0,0 +1,16 @@ +const dec = () => {}; +let hasX, hasM; + +@dec +class Foo { + static #x; + static #m() {} + + static x; + static m() {} + + static { + hasX = o => #x in o; + hasM = o => #m in o; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js new file mode 100644 index 000000000000..32335a927df2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js @@ -0,0 +1,23 @@ +var _initClass; +const dec = () => {}; +let hasX, hasM; +let _Foo; +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + static m() {} + } + } + #x; + #m() {} + x; + constructor() { + super(_Foo), (() => { + hasX = o => #x in o; + hasM = o => #m in o; + })(), _initClass(); + } +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js new file mode 100644 index 000000000000..1b8d46cf3ac0 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +@dec +class Foo { + static { + this + } + static field = this; + static { + this + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js new file mode 100644 index 000000000000..e187fdb62453 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js @@ -0,0 +1,20 @@ +var _initClass; +const dec = () => {}; +let _Foo; +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + field = ((() => { + this; + })(), this); + constructor() { + super(_Foo), (() => { + this; + })(), _initClass(); + } +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js new file mode 100644 index 000000000000..0cd5e45110b7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +const Foo = @dec class Bar { + bar = new Bar(); +}; + +const foo = new Foo(); + diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js new file mode 100644 index 000000000000..771c60816010 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js @@ -0,0 +1,12 @@ +var _initClass, _Bar; +const dec = () => {}; +const Foo = (class Bar { + static { + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + bar = new _Bar(); + static { + _initClass(); + } +}, _Bar); +const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js new file mode 100644 index 000000000000..8f0a4dfe092f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +@dec +class Foo { + static foo = new Foo(); +} + +const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js new file mode 100644 index 000000000000..7b4c9179c1c6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js @@ -0,0 +1,17 @@ +var _initClass; +const dec = () => {}; +let _Foo; +new class extends babelHelpers.identity { + static { + class Foo { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + } + } + foo = new _Foo(); + constructor() { + super(_Foo), _initClass(); + } +}(); +const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js new file mode 100644 index 000000000000..49fad189f4e2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js @@ -0,0 +1,33 @@ +var i = 0; + +function getKey() { + return (i++).toString(); +} + +let elements = []; + +function dec(fn, context) { + elements.push({ fn, context }); +} + +class Foo { + @dec + [getKey()]() { + return 1; + } + + @dec + [getKey()]() { + return 2; + } +} + +expect(elements).toHaveLength(2); + +expect(elements[0].context.name).toBe("0"); +expect(elements[0].fn()).toBe(1); + +expect(elements[1].context.name).toBe("1"); +expect(elements[1].fn()).toBe(2); + +expect(i).toBe(2); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js new file mode 100644 index 000000000000..fd4743f81bc7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + [getKey()]() { + return 1; + } + + @dec + [getKey()]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js new file mode 100644 index 000000000000..7ddef3be40d9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -0,0 +1,16 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = getKey(); +_computedKey2 = getKey(); +class Foo { + constructor(...args) { + _initProto(this); + } + [_computedKey]() { + return 1; + } + [_computedKey2]() { + return 2; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js new file mode 100644 index 000000000000..c97e2293ac96 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js @@ -0,0 +1,29 @@ +expect(() => { + var i = 0; + var j = 0; + + function getKeyI() { + return (i++).toString(); + } + function getKeyJ() { + return (j++).toString(); + } + + let elements = []; + + function dec(fn, context) { + elements.push({ fn, context }); + } + + class Foo { + @dec + [getKeyI()]() { + return 1; + } + + @dec + [getKeyJ()]() { + return 2; + } + } +}).toThrow("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: 0") diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js new file mode 100644 index 000000000000..0f6e2ca31d39 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + [getKeyI()]() { + return 1; + } + + @dec + [getKeyJ()]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js new file mode 100644 index 000000000000..9c9448835538 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -0,0 +1,16 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = getKeyI(); +_computedKey2 = getKeyJ(); +class Foo { + constructor(...args) { + _initProto(this); + } + [_computedKey]() { + return 1; + } + [_computedKey2]() { + return 2; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js new file mode 100644 index 000000000000..72e253d55578 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js @@ -0,0 +1,23 @@ +let elements = []; + +function dec(val, context) { + elements.push({ val, context }); +} + +class Foo { + @dec + a = 123; + + @dec + a() { + return 1; + } +} + +expect(elements).toHaveLength(2); + +expect(elements[0].context.name).toBe("a"); +expect(elements[0].val()).toBe(1); + +expect(elements[1].context.name).toBe("a"); +expect(elements[1].val).toBe(undefined); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js new file mode 100644 index 000000000000..e2bfd2a7b415 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js @@ -0,0 +1,10 @@ +const dec = () => {}; +class Foo { + @dec + a = 123; + + @dec + a() { + return 1; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js new file mode 100644 index 000000000000..adc3006a8190 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js @@ -0,0 +1,11 @@ +var _init_a, _initProto; +const dec = () => {}; +class Foo { + constructor() { + babelHelpers.defineProperty(this, "a", (_initProto(this), _init_a(this, 123))); + } + a() { + return 1; + } +} +[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js new file mode 100644 index 000000000000..9e270b2a7488 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js @@ -0,0 +1,19 @@ +expect(() => { + let elements = []; + + function dec(val, context) { + elements.push({ val, context }); + } + + class Foo { + @dec + a() { + return 1; + } + + @dec + a() { + return 2; + } + } +}).toThrow("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: a") diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js new file mode 100644 index 000000000000..ab961fbc9dfb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + a() { + return 1; + } + + @dec + a() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js new file mode 100644 index 000000000000..3fe80ca58e17 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -0,0 +1,14 @@ +var _initProto; +const dec = () => {}; +class Foo { + constructor(...args) { + _initProto(this); + } + a() { + return 1; + } + a() { + return 2; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js new file mode 100644 index 000000000000..fd4743f81bc7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + [getKey()]() { + return 1; + } + + @dec + [getKey()]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js new file mode 100644 index 000000000000..b409741c95c1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js @@ -0,0 +1,18 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = getKey(); +_computedKey2 = getKey(); +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + } + constructor(...args) { + _initProto(this); + } + [_computedKey]() { + return 1; + } + [_computedKey2]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js new file mode 100644 index 000000000000..0f6e2ca31d39 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + [getKeyI()]() { + return 1; + } + + @dec + [getKeyJ()]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js new file mode 100644 index 000000000000..00bd162f0999 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js @@ -0,0 +1,18 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = getKeyI(); +_computedKey2 = getKeyJ(); +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + } + constructor(...args) { + _initProto(this); + } + [_computedKey]() { + return 1; + } + [_computedKey2]() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js new file mode 100644 index 000000000000..e2bfd2a7b415 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js @@ -0,0 +1,10 @@ +const dec = () => {}; +class Foo { + @dec + a = 123; + + @dec + a() { + return 1; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js new file mode 100644 index 000000000000..53f2911d5016 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js @@ -0,0 +1,11 @@ +var _init_a, _initProto; +const dec = () => {}; +class Foo { + static { + [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; + } + a = (_initProto(this), _init_a(this, 123)); + a() { + return 1; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js new file mode 100644 index 000000000000..ab961fbc9dfb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js @@ -0,0 +1,12 @@ +const dec = () => {}; +class Foo { + @dec + a() { + return 1; + } + + @dec + a() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js new file mode 100644 index 000000000000..427a72d2aaf6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js @@ -0,0 +1,16 @@ +var _initProto; +const dec = () => {}; +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; + } + constructor(...args) { + _initProto(this); + } + a() { + return 1; + } + a() { + return 2; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs new file mode 100644 index 000000000000..05db70faed30 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs @@ -0,0 +1 @@ +export default @dec class A {} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs new file mode 100644 index 000000000000..27714fc7f865 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs @@ -0,0 +1,12 @@ +var _initClass, _dec; +let _A; +_dec = dec; +class A { + static { + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + } + static { + _initClass(); + } +} +export { _A as default }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs new file mode 100644 index 000000000000..31cdac17444e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs @@ -0,0 +1 @@ +export default @dec class {} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs new file mode 100644 index 000000000000..4e00a527e4ec --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs @@ -0,0 +1,12 @@ +var _initClass, _dec; +let _default2; +_dec = dec; +class _default { + static { + [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + } + static { + _initClass(); + } +} +export { _default2 as default }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs new file mode 100644 index 000000000000..f72e0e9c2249 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs @@ -0,0 +1,3 @@ +export class A { + @dec x; +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs new file mode 100644 index 000000000000..6a95338049fa --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs @@ -0,0 +1,8 @@ +var _dec, _init_x; +_dec = dec; +export class A { + static { + [_init_x] = babelHelpers.applyDecs2303(this, [[_dec, 0, "x"]], []).e; + } + x = _init_x(this); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs new file mode 100644 index 000000000000..367f946714b0 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs @@ -0,0 +1 @@ +export @dec class A {} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs new file mode 100644 index 000000000000..ccec1e265258 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs @@ -0,0 +1,12 @@ +var _initClass, _dec; +let _A; +_dec = dec; +class A { + static { + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + } + static { + _initClass(); + } +} +export { _A as A }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs new file mode 100644 index 000000000000..bc88730f95a8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs @@ -0,0 +1,4 @@ +export class A {} + +class B {} +export { B }; \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs new file mode 100644 index 000000000000..9ac373c42b10 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs @@ -0,0 +1,3 @@ +export class A {} +class B {} +export { B }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js new file mode 100644 index 000000000000..5d9715ee8ee7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js @@ -0,0 +1,44 @@ +function dec(_v, context) { + return function (v) { + this[context.name + 'Context'] = context; + return (v || 1) + 1; + } +} + +class Foo { + @dec + #a; + + @dec + #b = 123; +} + +let foo = new Foo(); + +const aContext = foo['#aContext']; +const bContext = foo['#bContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(false); + +expect(aContext.access.get(foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +aContext.access.set(foo, 123); +expect(aContext.access.get(foo)).toBe(123); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(aContext.access.get(foo)).toBe(123); +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('field'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('undefined'); + +expect(bContext.access.get(foo)).toBe(124); +bContext.access.set(foo, 123); +expect(bContext.access.get(foo)).toBe(123); +expect(bContext.name).toBe('#b'); +expect(bContext.kind).toBe('field'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('undefined'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js new file mode 100644 index 000000000000..2cd77e99b7e3 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + #a; + + @dec + #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js new file mode 100644 index 000000000000..5de804650b96 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js @@ -0,0 +1,17 @@ +var _init_a, _init_b; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +var _b = /*#__PURE__*/new WeakMap(); +class Foo { + constructor() { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: _init_a(this) + }); + babelHelpers.classPrivateFieldInitSpec(this, _b, { + writable: true, + value: _init_b(this, 123) + }); + } +} +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js new file mode 100644 index 000000000000..df182db7ac21 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js @@ -0,0 +1,67 @@ +function dec(_v, context) { + return function (v) { + this[context.name + 'Context'] = context; + return (v || 1) + 1; + } +} + +class Foo { + @dec + a; + + @dec + b = 123; + + @dec + ['c'] = 456; +} + +let foo = new Foo(); + +const aContext = foo['aContext']; +const bContext = foo['bContext']; +const cContext = foo['cContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(foo.a).toBe(2); +expect(aContext.access.get(foo)).toBe(2); +foo.a = 123; +expect(foo.a).toBe(123); +expect(aContext.access.get(foo)).toBe(123); +aContext.access.set(foo, 456); +expect(foo.a).toBe(456); +expect(aContext.access.get(foo)).toBe(456); +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('field'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('undefined'); +expect(foo.hasOwnProperty('a')).toBe(true); +expect(Foo.prototype.hasOwnProperty('a')).toBe(false); + +expect(foo.b).toBe(124); +foo.b = 123; +expect(foo.b).toBe(123); +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('field'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('undefined'); +expect(foo.hasOwnProperty('b')).toBe(true); +expect(Foo.prototype.hasOwnProperty('b')).toBe(false); + +expect(foo.c).toBe(457); +foo.c = 456; +expect(foo.c).toBe(456); +expect(cContext.name).toBe('c'); +expect(cContext.kind).toBe('field'); +expect(cContext.static).toBe(false); +expect(cContext.private).toBe(false); +expect(typeof cContext.addInitializer).toBe('undefined'); +expect(foo.hasOwnProperty('c')).toBe(true); +expect(Foo.prototype.hasOwnProperty('c')).toBe(false); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js new file mode 100644 index 000000000000..16a36d324047 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + a; + + @dec + b = 123; + + @dec + ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js new file mode 100644 index 000000000000..a022b9921fcb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js @@ -0,0 +1,11 @@ +var _init_a, _init_b, _computedKey, _init_computedKey; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + constructor() { + babelHelpers.defineProperty(this, "a", _init_a(this)); + babelHelpers.defineProperty(this, "b", _init_b(this, 123)); + babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); + } +} +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..bafdfec712f5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js @@ -0,0 +1,42 @@ +function dec(_v, context) { + return function (v) { + this[context.name + 'Context'] = context; + return (v || 1) + 1; + } +} + +class Foo { + @dec + static #a; + + @dec + static #b = 123; +} + +const aContext = Foo['#aContext']; +const bContext = Foo['#bContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(false); + +expect(aContext.access.get(Foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +aContext.access.set(Foo, 123); +expect(aContext.access.get(Foo)).toBe(123); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(aContext.access.get(Foo)).toBe(123); +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('field'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('undefined'); + +expect(bContext.access.get(Foo)).toBe(124); +bContext.access.set(Foo, 123); +expect(bContext.access.get(Foo)).toBe(123); +expect(bContext.name).toBe('#b'); +expect(bContext.kind).toBe('field'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('undefined'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js new file mode 100644 index 000000000000..bc6f56f17527 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + static #a; + + @dec + static #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js new file mode 100644 index 000000000000..0378f626ea36 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js @@ -0,0 +1,12 @@ +var _init_a, _init_b; +const dec = () => {}; +class Foo {} +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 5, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [dec, 5, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; +var _a = { + writable: true, + value: _init_a(Foo) +}; +var _b = { + writable: true, + value: _init_b(Foo, 123) +}; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..36113e23c702 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js @@ -0,0 +1,62 @@ +function dec(_v, context) { + return function (v) { + this[context.name + 'Context'] = context; + return (v || 1) + 1; + } +} + +class Foo { + @dec + static a; + + @dec + static b = 123; + + @dec + static ['c'] = 456; +} + +const aContext = Foo['aContext']; +const bContext = Foo['bContext']; +const cContext = Foo['cContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(Foo.a).toBe(2); +expect(aContext.access.get(Foo)).toBe(2); +Foo.a = 123; +expect(Foo.a).toBe(123); +expect(aContext.access.get(Foo)).toBe(123); +aContext.access.set(Foo, 456); +expect(Foo.a).toBe(456); +expect(aContext.access.get(Foo)).toBe(456); +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('field'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('undefined'); +expect(Foo.hasOwnProperty('a')).toBe(true); + +expect(Foo.b).toBe(124); +Foo.b = 123; +expect(Foo.b).toBe(123); +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('field'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('undefined'); +expect(Foo.hasOwnProperty('b')).toBe(true); + +expect(Foo.c).toBe(457); +Foo.c = 456; +expect(Foo.c).toBe(456); +expect(cContext.name).toBe('c'); +expect(cContext.kind).toBe('field'); +expect(cContext.static).toBe(true); +expect(cContext.private).toBe(false); +expect(typeof cContext.addInitializer).toBe('undefined'); +expect(Foo.hasOwnProperty('c')).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js new file mode 100644 index 000000000000..e7e44bf1ec16 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + static a; + + @dec + static b = 123; + + @dec + static ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js new file mode 100644 index 000000000000..6fa9904d9915 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js @@ -0,0 +1,8 @@ +var _init_a, _init_b, _computedKey, _init_computedKey; +const dec = () => {}; +_computedKey = 'c'; +class Foo {} +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []).e; +babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); +babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); +babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js new file mode 100644 index 000000000000..2cd77e99b7e3 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + #a; + + @dec + #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js new file mode 100644 index 000000000000..dfdeceece86a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js @@ -0,0 +1,9 @@ +var _init_a, _init_b; +const dec = () => {}; +class Foo { + static { + [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[dec, 0, "a", o => o.#a, (o, v) => o.#a = v], [dec, 0, "b", o => o.#b, (o, v) => o.#b = v]], [], _ => #b in _).e; + } + #a = _init_a(this); + #b = _init_b(this, 123); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js new file mode 100644 index 000000000000..16a36d324047 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + a; + + @dec + b = 123; + + @dec + ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js new file mode 100644 index 000000000000..d654f2719616 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js @@ -0,0 +1,11 @@ +var _init_a, _init_b, _computedKey, _init_computedKey; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + static { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; + } + a = _init_a(this); + b = _init_b(this, 123); + [_computedKey] = _init_computedKey(this, 456); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js new file mode 100644 index 000000000000..bc6f56f17527 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec + static #a; + + @dec + static #b = 123; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js new file mode 100644 index 000000000000..1fd091e9e106 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js @@ -0,0 +1,9 @@ +var _init_a, _init_b; +const dec = () => {}; +class Foo { + static { + [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[dec, 5, "a", o => o.#a, (o, v) => o.#a = v], [dec, 5, "b", o => o.#b, (o, v) => o.#b = v]], []).e; + } + static #a = _init_a(this); + static #b = _init_b(this, 123); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js new file mode 100644 index 000000000000..e7e44bf1ec16 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class Foo { + @dec + static a; + + @dec + static b = 123; + + @dec + static ['c'] = 456; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js new file mode 100644 index 000000000000..90223a91b117 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js @@ -0,0 +1,11 @@ +var _init_a, _init_b, _computedKey, _init_computedKey; +const dec = () => {}; +_computedKey = 'c'; +class Foo { + static { + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []).e; + } + static a = _init_a(this); + static b = _init_b(this, 123); + static [_computedKey] = _init_computedKey(this, 456); +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js new file mode 100644 index 000000000000..eab384f77836 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js @@ -0,0 +1,42 @@ +function dec(get, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return get.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + getA() { + return this.#a; + } +} + +let foo = new Foo(); + +const aContext = foo['#aContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(false); + +expect(aContext.access.get(foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +expect(foo.getA()).toBe(2); +foo.value = 123; +expect(aContext.access.get(foo)).toBe(124); +expect(foo.getA()).toBe(124); +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('getter'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js new file mode 100644 index 000000000000..28519502bf46 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js new file mode 100644 index 000000000000..9b0c155a0369 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js @@ -0,0 +1,22 @@ +var _call_a, _initProto; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: void 0 + }); + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + getA() { + return babelHelpers.classPrivateFieldGet(this, _a); + } +} +function _get_a() { + return _call_a(this); +} +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { + return this.value; +}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js new file mode 100644 index 000000000000..1e2bbfd6f644 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js @@ -0,0 +1,56 @@ +function dec(get, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return get.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + get ['b']() { + return this.value; + } +} + +let foo = new Foo(); + +const aContext = foo['aContext']; +const bContext = foo['bContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(foo.a).toBe(2); +expect(foo.b).toBe(2); +expect(aContext.access.get(foo)).toBe(2); +expect(bContext.access.get(foo)).toBe(2); +foo.value = 123; +expect(foo.a).toBe(124); +expect(foo.b).toBe(124); +expect(aContext.access.get(foo)).toBe(124); +expect(bContext.access.get(foo)).toBe(124); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('getter'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('getter'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js new file mode 100644 index 000000000000..392f9e03412f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + get ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js new file mode 100644 index 000000000000..763867651958 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + get a() { + return this.value; + } + get [_computedKey]() { + return this.value; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..082c93bd57ad --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js @@ -0,0 +1,41 @@ +function dec(get, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return get.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + static getA() { + return this.#a; + } +} + +const aContext = Foo['#aContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(false); + +expect(aContext.access.get(Foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +expect(Foo.getA()).toBe(2); +Foo.value = 123; +expect(aContext.access.get(Foo)).toBe(124); +expect(Foo.getA()).toBe(124); + +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('getter'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js new file mode 100644 index 000000000000..9d64c02982da --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + static getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js new file mode 100644 index 000000000000..123c5f4c6f53 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js @@ -0,0 +1,21 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static getA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + } +} +function _get_a() { + return _call_a(this); +} +var _a = { + get: _get_a, + set: void 0 +}; +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", function () { + return this.value; + }]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..aaebed1470da --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js @@ -0,0 +1,54 @@ +function dec(get, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return get.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static get ['b']() { + return this.value; + } +} + +const aContext = Foo['aContext']; +const bContext = Foo['bContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(Foo.a).toBe(2); +expect(Foo.b).toBe(2); +expect(aContext.access.get(Foo)).toBe(2); +expect(bContext.access.get(Foo)).toBe(2); +Foo.value = 123; +expect(Foo.a).toBe(124); +expect(Foo.b).toBe(124); +expect(aContext.access.get(Foo)).toBe(124); +expect(bContext.access.get(Foo)).toBe(124); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('getter'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('getter'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js new file mode 100644 index 000000000000..3bc53fb17cc5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static get ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js new file mode 100644 index 000000000000..5f358f5991cf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static get a() { + return this.value; + } + static get [_computedKey]() { + return this.value; + } +} +(() => { + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 8, _computedKey]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js new file mode 100644 index 000000000000..4fd73c4c5ca1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js @@ -0,0 +1,74 @@ +function dec(value, context) { + context.addInitializer(function() { + this[context.name + '_' + context.kind + 'Context'] = context; + }); + + if (context.kind === 'getter') { + return function () { + return value.call(this) + 1; + } + } else { + return function (v) { + return value.call(this, v + 1); + } + } +} + +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + @dec + set #a(v) { + this.value = v; + } + + getA() { + return this.#a; + } + + setA(v) { + this.#a = v; + } +} + +let foo = new Foo(); + +const a_getterContext = foo['#a_getterContext']; +const a_setterContext = foo['#a_setterContext']; + +expect(a_getterContext.access.has(foo)).toBe(true); +expect(a_getterContext.access.has({})).toBe(false); +expect(a_getterContext.access.has(Object.create(foo))).toBe(false); +expect(a_setterContext.access.has(foo)).toBe(true); +expect(a_setterContext.access.has({})).toBe(false); +expect(a_setterContext.access.has(Object.create(foo))).toBe(false); +expect(a_getterContext.access.has).not.toBe(a_setterContext.access.has); + +expect(a_getterContext.access.get(foo)).toBe(2); +expect(() => a_getterContext.access.get({})).toThrow(TypeError); +expect(foo.getA()).toBe(2); +a_setterContext.access.set(foo, 123); +expect(a_getterContext.access.get(foo)).toBe(125); +expect(() => a_setterContext.access.set({}, 456)).toThrow(TypeError); +expect(a_getterContext.access.get(foo)).toBe(125); +expect(foo.getA()).toBe(125); +foo.setA(456); +expect(a_getterContext.access.get(foo)).toBe(458); +expect(foo.getA()).toBe(458); + +expect(a_getterContext.name).toBe('#a'); +expect(a_getterContext.kind).toBe('getter'); +expect(a_getterContext.static).toBe(false); +expect(a_getterContext.private).toBe(true); +expect(typeof a_getterContext.addInitializer).toBe('function'); + +expect(a_setterContext.name).toBe('#a'); +expect(a_setterContext.kind).toBe('setter'); +expect(a_setterContext.static).toBe(false); +expect(a_setterContext.private).toBe(true); +expect(typeof a_setterContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js new file mode 100644 index 000000000000..fdf137cc4a64 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js @@ -0,0 +1,22 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + @dec + set #a(v) { + this.value = v; + } + + getA() { + return this.#a; + } + + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js new file mode 100644 index 000000000000..046c68a14e9b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js @@ -0,0 +1,30 @@ +var _call_a, _call_a2, _initProto; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: _get_a, + set: _set_a + }); + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + getA() { + return babelHelpers.classPrivateFieldGet(this, _a); + } + setA(v) { + babelHelpers.classPrivateFieldSet(this, _a, v); + } +} +function _get_a() { + return _call_a(this); +} +function _set_a(v) { + _call_a2(this, v); +} +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { + return this.value; +}], [dec, 4, "a", function (v) { + this.value = v; +}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js new file mode 100644 index 000000000000..fa548d8d5c40 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js @@ -0,0 +1,103 @@ +function dec(value, context) { + context.addInitializer(function() { + this[context.name + '_' + context.kind + 'Context'] = context; + }); + + if (context.kind === 'getter') { + return function () { + return value.call(this) + 1; + } + } else { + return function (v) { + return value.call(this, v + 1); + } + } +} + +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + set a(v) { + this.value = v; + } + + @dec + get ['b']() { + return this.value; + } + + @dec + set ['b'](v) { + this.value = v; + } +} + +let foo = new Foo(); + +const a_getterContext = foo['a_getterContext']; +const a_setterContext = foo['a_setterContext']; + +const b_getterContext = foo['b_getterContext']; +const b_setterContext = foo['b_setterContext']; + +expect(a_getterContext.access.has(foo)).toBe(true); +expect(a_getterContext.access.has({})).toBe(false); +expect(a_getterContext.access.has(Object.create(foo))).toBe(true); +expect(a_getterContext.access.has({ a: 1 })).toBe(true); +expect(a_getterContext.access.has(Object.create({ a: 1 }))).toBe(true); +expect(a_setterContext.access.has(foo)).toBe(true); +expect(a_setterContext.access.has({})).toBe(false); +expect(a_setterContext.access.has(Object.create(foo))).toBe(true); +expect(a_setterContext.access.has({ a: 1 })).toBe(true); +expect(a_setterContext.access.has(Object.create({ a: 1 }))).toBe(true); +expect(a_getterContext.access.has).not.toBe(a_setterContext.access.has); + +expect(foo.a).toBe(2); +expect(foo.b).toBe(2); +expect(a_getterContext.access.get(foo)).toBe(2); +expect(b_getterContext.access.get(foo)).toBe(2); +foo.a = 123; +expect(foo.a).toBe(125); +expect(foo.b).toBe(125); +expect(a_getterContext.access.get(foo)).toBe(125); +expect(b_getterContext.access.get(foo)).toBe(125); +foo.b = 456; +expect(foo.a).toBe(458); +expect(foo.b).toBe(458); +expect(a_getterContext.access.get(foo)).toBe(458); +expect(b_getterContext.access.get(foo)).toBe(458); +a_setterContext.access.set(foo, 789); +expect(foo.a).toBe(791); +expect(foo.b).toBe(791); +expect(a_getterContext.access.get(foo)).toBe(791); +expect(b_getterContext.access.get(foo)).toBe(791); + +expect(a_getterContext.name).toBe('a'); +expect(a_getterContext.kind).toBe('getter'); +expect(a_getterContext.static).toBe(false); +expect(a_getterContext.private).toBe(false); +expect(typeof a_getterContext.addInitializer).toBe('function'); + +expect(a_setterContext.name).toBe('a'); +expect(a_setterContext.kind).toBe('setter'); +expect(a_setterContext.static).toBe(false); +expect(a_setterContext.private).toBe(false); +expect(typeof a_setterContext.addInitializer).toBe('function'); + +expect(b_getterContext.name).toBe('b'); +expect(b_getterContext.kind).toBe('getter'); +expect(b_getterContext.static).toBe(false); +expect(b_getterContext.private).toBe(false); +expect(typeof b_getterContext.addInitializer).toBe('function'); + +expect(b_setterContext.name).toBe('b'); +expect(b_setterContext.kind).toBe('setter'); +expect(b_setterContext.static).toBe(false); +expect(b_setterContext.private).toBe(false); +expect(typeof b_setterContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js new file mode 100644 index 000000000000..1af1569ba988 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + set a(v) { + this.value = v; + } + + @dec + get ['b']() { + return this.value; + } + + @dec + set ['b'](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js new file mode 100644 index 000000000000..8d381858681b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js @@ -0,0 +1,23 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = 'b'; +_computedKey2 = 'b'; +class Foo { + constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + get a() { + return this.value; + } + set a(v) { + this.value = v; + } + get [_computedKey]() { + return this.value; + } + set [_computedKey2](v) { + this.value = v; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..c7faf2394242 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js @@ -0,0 +1,72 @@ +function dec(value, context) { + context.addInitializer(function() { + this[context.name + '_' + context.kind + 'Context'] = context; + }); + + if (context.kind === 'getter') { + return function () { + return value.call(this) + 1; + } + } else { + return function (v) { + return value.call(this, v + 1); + } + } +} + +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + @dec + static set #a(v) { + this.value = v; + } + + static getA() { + return this.#a; + } + + static setA(v) { + this.#a = v; + } +} + +const a_getterContext = Foo['#a_getterContext']; +const a_setterContext = Foo['#a_setterContext']; + +expect(a_getterContext.access.has(Foo)).toBe(true); +expect(a_getterContext.access.has({})).toBe(false); +expect(a_getterContext.access.has(Object.create(Foo))).toBe(false); +expect(a_setterContext.access.has(Foo)).toBe(true); +expect(a_setterContext.access.has({})).toBe(false); +expect(a_setterContext.access.has(Object.create(Foo))).toBe(false); +expect(a_getterContext.access.has).not.toBe(a_setterContext.access.has); + +expect(a_getterContext.access.get(Foo)).toBe(2); +expect(() => a_getterContext.access.get({})).toThrow(TypeError); +expect(Foo.getA()).toBe(2); +a_setterContext.access.set(Foo, 123); +expect(a_getterContext.access.get(Foo)).toBe(125); +expect(() => a_setterContext.access.set({}, 456)).toThrow(TypeError); +expect(a_getterContext.access.get(Foo)).toBe(125); +expect(Foo.getA()).toBe(125); +Foo.setA(456); +expect(a_getterContext.access.get(Foo)).toBe(458); +expect(Foo.getA()).toBe(458); + +expect(a_getterContext.name).toBe('#a'); +expect(a_getterContext.kind).toBe('getter'); +expect(a_getterContext.static).toBe(true); +expect(a_getterContext.private).toBe(true); +expect(typeof a_getterContext.addInitializer).toBe('function'); + +expect(a_setterContext.name).toBe('#a'); +expect(a_setterContext.kind).toBe('setter'); +expect(a_setterContext.static).toBe(true); +expect(a_setterContext.private).toBe(true); +expect(typeof a_setterContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js new file mode 100644 index 000000000000..c832634c6b72 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js @@ -0,0 +1,22 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + @dec + static set #a(v) { + this.value = v; + } + + static getA() { + return this.#a; + } + + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js new file mode 100644 index 000000000000..d742fa356d37 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js @@ -0,0 +1,29 @@ +var _call_a, _call_a2, _initStatic; +const dec = () => {}; +class Foo { + static getA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); + } + static setA(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + } +} +function _get_a() { + return _call_a(this); +} +function _set_a(v) { + _call_a2(this, v); +} +var _a = { + get: _get_a, + set: _set_a +}; +(() => { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", function () { + return this.value; + }], [dec, 9, "a", function (v) { + this.value = v; + }]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..9b4f9539e2e4 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js @@ -0,0 +1,102 @@ +function dec(value, context) { + context.addInitializer(function() { + this[context.name + '_' + context.kind + 'Context'] = context; + }); + + if (context.kind === 'getter') { + return function () { + return value.call(this) + 1; + } + } else { + return function (v) { + return value.call(this, v + 1); + } + } +} + +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static set a(v) { + this.value = v; + } + + @dec + static get ['b']() { + return this.value; + } + + @dec + static set ['b'](v) { + this.value = v; + } +} + +const a_getterContext = Foo['a_getterContext']; +const a_setterContext = Foo['a_setterContext']; + +const b_getterContext = Foo['b_getterContext']; +const b_setterContext = Foo['b_setterContext']; + +expect(a_getterContext.access.has(Foo)).toBe(true); +expect(a_getterContext.access.has({})).toBe(false); +expect(a_getterContext.access.has(Object.create(Foo))).toBe(true); +expect(a_getterContext.access.has({ a: 1 })).toBe(true); +expect(a_getterContext.access.has(Object.create({ a: 1 }))).toBe(true); +expect(a_setterContext.access.has(Foo)).toBe(true); +expect(a_setterContext.access.has({})).toBe(false); +expect(a_setterContext.access.has(Object.create(Foo))).toBe(true); +expect(a_setterContext.access.has({ a: 1 })).toBe(true); +expect(a_setterContext.access.has(Object.create({ a: 1 }))).toBe(true); +expect(a_getterContext.access.has).not.toBe(a_setterContext.access.has); + +expect(Foo.a).toBe(2); +expect(Foo.b).toBe(2); +expect(a_getterContext.access.get(Foo)).toBe(2); +expect(b_getterContext.access.get(Foo)).toBe(2); +Foo.a = 123; +expect(Foo.a).toBe(125); +expect(Foo.b).toBe(125); +expect(a_getterContext.access.get(Foo)).toBe(125); +expect(b_getterContext.access.get(Foo)).toBe(125); +Foo.b = 456; +expect(Foo.a).toBe(458); +expect(Foo.b).toBe(458); +expect(a_getterContext.access.get(Foo)).toBe(458); +expect(b_getterContext.access.get(Foo)).toBe(458); +a_setterContext.access.set(Foo, 789); +expect(Foo.a).toBe(791); +expect(Foo.b).toBe(791); +expect(a_getterContext.access.get(Foo)).toBe(791); +expect(b_getterContext.access.get(Foo)).toBe(791); + +expect(a_getterContext.name).toBe('a'); +expect(a_getterContext.kind).toBe('getter'); +expect(a_getterContext.static).toBe(true); +expect(a_getterContext.private).toBe(false); +expect(typeof a_getterContext.addInitializer).toBe('function'); + +expect(a_setterContext.name).toBe('a'); +expect(a_setterContext.kind).toBe('setter'); +expect(a_setterContext.static).toBe(true); +expect(a_setterContext.private).toBe(false); +expect(typeof a_setterContext.addInitializer).toBe('function'); + +expect(b_getterContext.name).toBe('b'); +expect(b_getterContext.kind).toBe('getter'); +expect(b_getterContext.static).toBe(true); +expect(b_getterContext.private).toBe(false); +expect(typeof b_getterContext.addInitializer).toBe('function'); + +expect(b_setterContext.name).toBe('b'); +expect(b_setterContext.kind).toBe('setter'); +expect(b_setterContext.static).toBe(true); +expect(b_setterContext.private).toBe(false); +expect(typeof b_setterContext.addInitializer).toBe('function'); + diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js new file mode 100644 index 000000000000..bbad4af972ed --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static set a(v) { + this.value = v; + } + + @dec + static get ['b']() { + return this.value; + } + + @dec + static set ['b'](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js new file mode 100644 index 000000000000..37ee531419e0 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js @@ -0,0 +1,23 @@ +var _computedKey, _computedKey2, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +_computedKey2 = 'b'; +class Foo { + static get a() { + return this.value; + } + static set a(v) { + this.value = v; + } + static get [_computedKey]() { + return this.value; + } + static set [_computedKey2](v) { + this.value = v; + } +} +(() => { + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js new file mode 100644 index 000000000000..fdf137cc4a64 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js @@ -0,0 +1,22 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + @dec + set #a(v) { + this.value = v; + } + + getA() { + return this.#a; + } + + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js new file mode 100644 index 000000000000..46c0c9b4b885 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js @@ -0,0 +1,27 @@ +var _call_a, _call_a2, _initProto; +const dec = () => {}; +class Foo { + static { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + return this.value; + }], [dec, 4, "a", function (v) { + this.value = v; + }]], [], _ => #a in _).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + get #a() { + return _call_a(this); + } + set #a(v) { + _call_a2(this, v); + } + getA() { + return this.#a; + } + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js new file mode 100644 index 000000000000..1af1569ba988 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + set a(v) { + this.value = v; + } + + @dec + get ['b']() { + return this.value; + } + + @dec + set ['b'](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js new file mode 100644 index 000000000000..319f7189bd08 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js @@ -0,0 +1,25 @@ +var _computedKey, _computedKey2, _initProto; +const dec = () => {}; +_computedKey = 'b'; +_computedKey2 = 'b'; +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + get a() { + return this.value; + } + set a(v) { + this.value = v; + } + get [_computedKey]() { + return this.value; + } + set [_computedKey2](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js new file mode 100644 index 000000000000..c832634c6b72 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js @@ -0,0 +1,22 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + @dec + static set #a(v) { + this.value = v; + } + + static getA() { + return this.#a; + } + + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js new file mode 100644 index 000000000000..5c210ea575f1 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js @@ -0,0 +1,25 @@ +var _call_a, _call_a2, _initStatic; +const dec = () => {}; +class Foo { + static { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a", function () { + return this.value; + }], [dec, 9, "a", function (v) { + this.value = v; + }]], []).e; + _initStatic(this); + } + static value = 1; + static get #a() { + return _call_a(this); + } + static set #a(v) { + _call_a2(this, v); + } + static getA() { + return this.#a; + } + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js new file mode 100644 index 000000000000..bbad4af972ed --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static set a(v) { + this.value = v; + } + + @dec + static get ['b']() { + return this.value; + } + + @dec + static set ['b'](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js new file mode 100644 index 000000000000..50114f4400b2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js @@ -0,0 +1,23 @@ +var _computedKey, _computedKey2, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +_computedKey2 = 'b'; +class Foo { + static { + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []).e; + _initStatic(this); + } + static value = 1; + static get a() { + return this.value; + } + static set a(v) { + this.value = v; + } + static get [_computedKey]() { + return this.value; + } + static set [_computedKey2](v) { + this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js new file mode 100644 index 000000000000..28519502bf46 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get #a() { + return this.value; + } + + getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js new file mode 100644 index 000000000000..ff26d8f468f4 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js @@ -0,0 +1,19 @@ +var _call_a, _initProto; +const dec = () => {}; +class Foo { + static { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + return this.value; + }]], [], _ => #a in _).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + get #a() { + return _call_a(this); + } + getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js new file mode 100644 index 000000000000..392f9e03412f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + get a() { + return this.value; + } + + @dec + get ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js new file mode 100644 index 000000000000..f9255dccc6ec --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js @@ -0,0 +1,18 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + get a() { + return this.value; + } + get [_computedKey]() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js new file mode 100644 index 000000000000..9d64c02982da --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get #a() { + return this.value; + } + + static getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js new file mode 100644 index 000000000000..839a0bc60ffc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js @@ -0,0 +1,17 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a", function () { + return this.value; + }]], []).e; + _initStatic(this); + } + static value = 1; + static get #a() { + return _call_a(this); + } + static getA() { + return this.#a; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js new file mode 100644 index 000000000000..3bc53fb17cc5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static get a() { + return this.value; + } + + @dec + static get ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js new file mode 100644 index 000000000000..08b8044e1d50 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 8, _computedKey]], []).e; + _initStatic(this); + } + static value = 1; + static get a() { + return this.value; + } + static get [_computedKey]() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js new file mode 100644 index 000000000000..493327c91c46 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js @@ -0,0 +1,44 @@ +function dec(fn, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + #a() { + return this.value; + } + + callA() { + return this.#a(); + } +} + +let foo = new Foo(); + +const aContext = foo['#aContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(false); + +// First call gets the method, second call calls the method with correct `this` +expect(aContext.access.get(foo).call(foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +expect(foo.callA()).toBe(2); +foo.value = 123; +expect(aContext.access.get(foo).call(foo)).toBe(124); +expect(foo.callA()).toBe(124); + +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('method'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js new file mode 100644 index 000000000000..a74cb2331eca --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js @@ -0,0 +1,24 @@ +function dec(fn, context) { + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + #a() { + return this.value; + } + + callA() { + return this.#a(); + } +} + +let foo = new Foo(); + +expect(foo.callA()).toBe(2); +foo.value = 123; +expect(foo.callA()).toBe(124); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js new file mode 100644 index 000000000000..098bbbb687f2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + #a() { + return this.value; + } + + callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js new file mode 100644 index 000000000000..ce2bf1b28264 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js @@ -0,0 +1,19 @@ +var _call_a, _initProto; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: _call_a + }); + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + callA() { + return babelHelpers.classPrivateFieldGet(this, _a).call(this); + } +} +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a", function () { + return this.value; +}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js new file mode 100644 index 000000000000..d7f969ca466e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js @@ -0,0 +1,59 @@ +function dec(fn, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + a() { + return this.value; + } + + @dec + ['b']() { + return this.value; + } +} + +let foo = new Foo(); + +const aContext = foo['aContext']; +const bContext = foo['bContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(foo.a()).toBe(2); +expect(aContext.access.get(foo).call(foo)).toBe(2); +expect(foo.b()).toBe(2); +expect(bContext.access.get(foo).call(foo)).toBe(2); +foo.value = 123; +expect(aContext.access.get(foo).call(foo)).toBe(124); +expect(foo.a()).toBe(124); +expect(bContext.access.get(foo).call(foo)).toBe(124); +expect(foo.b()).toBe(124); + +expect(aContext.access.get({})).toBe(undefined); +expect(aContext.access.get({ a: 3 })).toBe(3); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('method'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('method'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js new file mode 100644 index 000000000000..b9ec2b92e328 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js @@ -0,0 +1,27 @@ +function dec(fn, context) { + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + value = 1; + + @dec + a() { + return this.value; + } + + @dec + ['b']() { + return this.value; + } +} + +let foo = new Foo(); + +expect(foo.a()).toBe(2); +expect(foo.b()).toBe(2); +foo.value = 123; +expect(foo.a()).toBe(124); +expect(foo.b()).toBe(124); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js new file mode 100644 index 000000000000..3a7f4cfaae9c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + a() { + return this.value; + } + + @dec + ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js new file mode 100644 index 000000000000..570adc92fb1a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + a() { + return this.value; + } + [_computedKey]() { + return this.value; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js new file mode 100644 index 000000000000..b94e75710e49 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js @@ -0,0 +1,42 @@ +function dec(fn, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static #a() { + return this.value; + } + + static callA() { + return this.#a(); + } +} + +const aContext = Foo['#aContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(false); + +// First call gets the method, second call calls the method with correct `this` +expect(aContext.access.get(Foo).call(Foo)).toBe(2); +expect(() => aContext.access.get({})).toThrow(TypeError); +expect(Foo.callA()).toBe(2); +Foo.value = 123; +expect(aContext.access.get(Foo).call(Foo)).toBe(124); +expect(Foo.callA()).toBe(124); + +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('method'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..47deb64ec304 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js @@ -0,0 +1,22 @@ +function dec(fn, context) { + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static #a() { + return this.value; + } + + static callA() { + return this.#a(); + } +} + +expect(Foo.callA()).toBe(2); +Foo.value = 123; +expect(Foo.callA()).toBe(124); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js new file mode 100644 index 000000000000..4a6ae5d4d7fd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static #a() { + return this.value; + } + + static callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js new file mode 100644 index 000000000000..ffada9380550 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js @@ -0,0 +1,18 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static callA() { + return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a).call(this); + } +} +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 7, "a", function () { + return this.value; + }]], []).e; + _initStatic(Foo); +})(); +var _a = { + writable: true, + value: _call_a +}; +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js new file mode 100644 index 000000000000..910dae50598e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js @@ -0,0 +1,54 @@ +function dec(fn, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static a() { + return this.value; + } + + @dec + static ['b']() { + return this.value; + } +} + +const aContext = Foo['aContext']; +const bContext = Foo['bContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(Foo.a()).toBe(2); +expect(aContext.access.get(Foo).call(Foo)).toBe(2); +expect(Foo.b()).toBe(2); +expect(bContext.access.get(Foo).call(Foo)).toBe(2); +Foo.value = 123; +expect(aContext.access.get(Foo).call(Foo)).toBe(124); +expect(Foo.a()).toBe(124); +expect(bContext.access.get(Foo).call(Foo)).toBe(124); +expect(Foo.b()).toBe(124); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('method'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('method'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..e5d03ee48021 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js @@ -0,0 +1,25 @@ +function dec(fn, context) { + return function () { + return fn.call(this) + 1; + } +} + +class Foo { + static value = 1; + + @dec + static a() { + return this.value; + } + + @dec + static ['b']() { + return this.value; + } +} + +expect(Foo.a()).toBe(2); +expect(Foo.b()).toBe(2); +Foo.value = 123; +expect(Foo.a()).toBe(124); +expect(Foo.b()).toBe(124); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js new file mode 100644 index 000000000000..5f81da5c0405 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static a() { + return this.value; + } + + @dec + static ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js new file mode 100644 index 000000000000..673eb9a464d6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static a() { + return this.value; + } + static [_computedKey]() { + return this.value; + } +} +(() => { + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 7, "a"], [dec, 7, _computedKey]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js new file mode 100644 index 000000000000..098bbbb687f2 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + #a() { + return this.value; + } + + callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js new file mode 100644 index 000000000000..b455e2693f87 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js @@ -0,0 +1,17 @@ +var _call_a, _initProto; +const dec = () => {}; +class Foo { + static { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a", function () { + return this.value; + }]], [], _ => #a in _).e; + } + constructor(...args) { + _initProto(this); + } + #a = _call_a; + value = 1; + callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js new file mode 100644 index 000000000000..3a7f4cfaae9c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + a() { + return this.value; + } + + @dec + ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js new file mode 100644 index 000000000000..ecb55e9ba21f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js @@ -0,0 +1,18 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + a() { + return this.value; + } + [_computedKey]() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js new file mode 100644 index 000000000000..4a6ae5d4d7fd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static #a() { + return this.value; + } + + static callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js new file mode 100644 index 000000000000..acfa495bcdbc --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js @@ -0,0 +1,15 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 7, "a", function () { + return this.value; + }]], []).e; + _initStatic(this); + } + static #a = _call_a; + static value = 1; + static callA() { + return this.#a(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js new file mode 100644 index 000000000000..5f81da5c0405 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static a() { + return this.value; + } + + @dec + static ['b']() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js new file mode 100644 index 000000000000..1f5b6f3b8759 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 7, "a"], [dec, 7, _computedKey]], []).e; + _initStatic(this); + } + static value = 1; + static a() { + return this.value; + } + static [_computedKey]() { + return this.value; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js new file mode 100644 index 000000000000..11aae499cb0d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js @@ -0,0 +1,77 @@ +function dec() {} + +var i = 0; +var log = []; + +function push(x) { log.push(x); return x; } + +function decWithInitializer(_, { addInitializer }) { + addInitializer(() => push(i++) ); +} + +new @dec class C1 { + @dec static m() {} +} + +new @dec class C2 { + @dec static #m() {} +} + +new @dec class C3 { + @dec m() {} +} + +new @dec class C4 { + @dec #m() {} +} + +new @decWithInitializer class C5 { + @dec static m() {} +} + +new @decWithInitializer class C6 { + @dec static #m() {} +} + +new @decWithInitializer class C7 { + @dec m() {} +} + +new @decWithInitializer class C8 { + @dec #m() {} +} + +new @dec class C9 { + @decWithInitializer static m() {} +} + +new @dec class C10 { + @decWithInitializer static #m() {} +} + +new @dec class C11 { + @decWithInitializer m() {} +} + +new @dec class C12 { + @decWithInitializer #m() {} +} + +new @decWithInitializer class C13 { + @decWithInitializer static m() {} +} + +new @decWithInitializer class C14 { + @decWithInitializer static #m() {} +} + +new @decWithInitializer class C15 { + @decWithInitializer m() {} +} + +new @decWithInitializer class C16 { + @decWithInitializer #m() {} +} + +var nums = Array.from({ length: 16 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js new file mode 100644 index 000000000000..3993d925adec --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js @@ -0,0 +1,45 @@ +function dec() {} + +var i = 0; +var log = []; + +function push(x) { log.push(x); return x; } + +function decWithInitializer(_, { addInitializer }) { + addInitializer(() => push(i++) ); +} + +new @dec class C1 { + @dec static p +} + +new @dec class C2 { + @dec static #p +} + +new @dec class C3 { + @dec p +} + +new @dec class C4 { + @dec #p +} + +new @decWithInitializer class C5 { + @dec static p +} + +new @decWithInitializer class C6 { + @dec static #p +} + +new @decWithInitializer class C7 { + @dec p +} + +new @decWithInitializer class C8 { + @dec #p +} + +var nums = Array.from({ length: 4 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js new file mode 100644 index 000000000000..ec8beb3b8cbf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js @@ -0,0 +1,12 @@ +let receivedName; +function decFactory(name) { receivedName = name; return x => x } +class B { + static m() { + class C { + @decFactory(this.name) p; + } + } +} + +B.m(); +expect(receivedName).toBe("B"); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js new file mode 100644 index 000000000000..3d81b8cdf452 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js @@ -0,0 +1,28 @@ +let self, a, initCalled; + +function deco(_, context) { + context.addInitializer(() => { + initCalled = true; + }) +} + +class B { + constructor(s) { + a = s; + } +} + +class A extends B { + constructor() { + let a = 2; + self = super(a); + } + + @deco + method() {} +} + +let instance = new A(); +expect(self).toBe(instance); +expect(a).toBe(2); +expect(initCalled).toBe(true); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js new file mode 100644 index 000000000000..68484c72749d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class A extends B { + constructor() { + let a = 2; + super(a); + foo(); + } + + @deco + method() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js new file mode 100644 index 000000000000..41f3d5c3604b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -0,0 +1,12 @@ +var _dec, _initProto; +const dec = () => {}; +_dec = deco; +class A extends B { + constructor() { + let a = 2; + _initProto(super(a)); + foo(); + } + method() {} +} +[_initProto] = babelHelpers.applyDecs2303(A, [[_dec, 2, "method"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js new file mode 100644 index 000000000000..2828e1c22408 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js @@ -0,0 +1,25 @@ +let init = false; +let initializer = false; + +function decorator() { + return { + get init() { + init = true; + return () => {}; + }, + get initializer() { + initializer = true; + return () => {}; + } + }; +} + +class A { + @decorator + accessor x; +} + +new A(); + +expect(init).toBe(true); +expect(initializer).toBe(false); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js new file mode 100644 index 000000000000..ac5920dcd16a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js @@ -0,0 +1,34 @@ +function dec1(fn, context) { + context.addInitializer((instance) => { + expect(instance.value).toBe(undefined); + }); + + return fn; +} + +class Foo { + value = 1; + + @dec1 + foo() {} +} + +function dec2(fn, context) { + context.addInitializer((instance) => { + expect(instance.value).toBe(1); + }); + + return fn; +} + + +class Bar extends Foo { + constructor() { + super(); + + this.value = 2; + } + + @dec2 + bar() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js new file mode 100644 index 000000000000..ccf93163d0fa --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js @@ -0,0 +1,17 @@ +let addInitializer; + +function decMethod(_, context) { + ({ addInitializer } = context); + addInitializer(() => null); +} + +try { + class C { + @decMethod + m() {} + } +} finally {} + +expect(() => { + addInitializer(() => null); +}).toThrow('attempted to call addInitializer after decoration was finished') diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js new file mode 100644 index 000000000000..61cd2063364c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js @@ -0,0 +1,18 @@ +let addInitializer; + +function callCapturedFunc() { + addInitializer(() => null); +} + +function decMethod(_, context) { + ({ addInitializer } = context); + addInitializer(() => null); +} + +expect(() => { + class C { + @callCapturedFunc + @decMethod + m() {} + } +}).toThrow('attempted to call addInitializer after decoration was finished') diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js new file mode 100644 index 000000000000..586564c5e219 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js @@ -0,0 +1,23 @@ +const dec = () => {}; +@dec +@call() +@chain.expr() +@(arbitrary + expr) +@(array[expr]) +class Foo { + #a; + + @dec + @call() + @chain.expr() + @(arbitrary + expr) + @(array[expr]) + method() {} + + makeClass() { + return class Nested { + @(this.#a) + bar; + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js new file mode 100644 index 000000000000..a9557b7dce63 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js @@ -0,0 +1,35 @@ +var _initClass, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _initProto; +const dec = () => {}; +let _Foo; +_dec = call(); +_dec2 = chain.expr(); +_dec3 = arbitrary + expr; +_dec4 = array[expr]; +_dec5 = call(); +_dec6 = chain.expr(); +_dec7 = arbitrary + expr; +_dec8 = array[expr]; +var _a = /*#__PURE__*/new WeakMap(); +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + writable: true, + value: void 0 + }); + _initProto(this); + } + method() {} + makeClass() { + var _dec9, _init_bar, _class; + return _dec9 = babelHelpers.classPrivateFieldGet(this, _a), (_class = class Nested { + constructor() { + babelHelpers.defineProperty(this, "bar", _init_bar(this)); + } + }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[_dec9, 0, "bar"]], []).e, _class); + } +} +({ + e: [_initProto], + c: [_Foo, _initClass] +} = babelHelpers.applyDecs2303(Foo, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4])); +_initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js new file mode 100644 index 000000000000..6986908e606d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js @@ -0,0 +1,27 @@ +const dec = () => {}; +@dec +class Class { + @dec a; + @dec b() {} + @dec get c() {} + @dec set c(v) {} + @dec accessor d; + + @dec #e; + @dec #f() {} + @dec get #g() {} + @dec set #g(v) {} + @dec accessor #h; + + @dec static i; + @dec static j() {} + @dec static get k() {} + @dec static set l(v) {} + @dec static accessor m; + + @dec static #n; + @dec static #o() {} + @dec static get #p() {} + @dec static set #q(v) {} + @dec static accessor #r; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js new file mode 100644 index 000000000000..ddf2ed3d2c62 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js @@ -0,0 +1,71 @@ +var _initClass, _init_a, _init_d, _init_e, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_m, _init_n, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _initProto, _initStatic; +const dec = () => {}; +let _Class; +new class extends babelHelpers.identity { + static { + class Class { + static { + ({ + e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_n, _init_a, _init_e, _initProto, _initStatic], + c: [_Class, _initClass] + } = babelHelpers.applyDecs2303(this, [[dec, 7, "j"], [dec, 8, "k"], [dec, 9, "l"], [dec, 6, "m"], [dec, 7, "o", function () {}], [dec, 8, "p", function () {}], [dec, 9, "q", function (v) {}], [dec, 6, "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, 5, "i"], [dec, 5, "n", o => o.#n, (o, v) => o.#n = v], [dec, 0, "a"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v]], [dec], _ => #e in _)); + _initStatic(this); + } + #f = _call_f; + a = (_initProto(this), _init_a(this)); + b() {} + get c() {} + set c(v) {} + #A = _init_d(this); + get d() { + return this.#A; + } + set d(v) { + this.#A = v; + } + #e = _init_e(this); + get #g() { + return _call_g(this); + } + set #g(v) { + _call_g2(this, v); + } + #B = _init_h(this); + set #h(v) { + _set_h(this, v); + } + get #h() { + return _get_h(this); + } + static j() {} + static get k() {} + static set l(v) {} + static get m() { + return this.#C; + } + static set m(v) { + this.#C = v; + } + set #r(v) { + _set_r(this, v); + } + get #r() { + return _get_r(this); + } + } + } + #o = _call_o; + i = _init_i(this); + #C = _init_m(this); + #n = _init_n(this); + get #p() { + return _call_p(this); + } + set #q(v) { + _call_q(this, v); + } + #D = _init_r(this); + constructor() { + super(_Class), _initClass(); + } +}(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js new file mode 100644 index 000000000000..ec8beb3b8cbf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js @@ -0,0 +1,12 @@ +let receivedName; +function decFactory(name) { receivedName = name; return x => x } +class B { + static m() { + class C { + @decFactory(this.name) p; + } + } +} + +B.m(); +expect(receivedName).toBe("B"); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json new file mode 100644 index 000000000000..fa55e7652b1a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-static-block" + ], + "minNodeVersion": "12.0.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js new file mode 100644 index 000000000000..a8da039942d6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js @@ -0,0 +1,24 @@ +const dec = () => {}; +class A extends B { + constructor() { + if (Math.random() > 0.5) { + super(true); + } else { + super(false); + } + } + + @deco + method() {} +} + +class C extends B { + constructor() { + try { + super(super(), null.x); + } catch {} + } + + @deco + method() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js new file mode 100644 index 000000000000..e90a08e474bd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -0,0 +1,28 @@ +var _dec, _initProto, _dec2, _initProto2; +const dec = () => {}; +_dec = deco; +class A extends B { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[_dec, 2, "method"]], []).e; + } + constructor() { + if (Math.random() > 0.5) { + _initProto(super(true)); + } else { + _initProto(super(false)); + } + } + method() {} +} +_dec2 = deco; +class C extends B { + static { + [_initProto2] = babelHelpers.applyDecs2303(this, [[_dec2, 2, "method"]], []).e; + } + constructor() { + try { + _initProto2(super(_initProto2(super()), null.x)); + } catch {} + } + method() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js new file mode 100644 index 000000000000..b3c7b6f85e9b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class A extends B { + constructor() { + let a = 2; + super(a); + foo(); + } + + @dec + method() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js new file mode 100644 index 000000000000..e20913dffe63 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js @@ -0,0 +1,13 @@ +var _initProto; +const dec = () => {}; +class A extends B { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "method"]], []).e; + } + constructor() { + let a = 2; + _initProto(super(a)); + foo(); + } + method() {} +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js new file mode 100644 index 000000000000..2828e1c22408 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js @@ -0,0 +1,25 @@ +let init = false; +let initializer = false; + +function decorator() { + return { + get init() { + init = true; + return () => {}; + }, + get initializer() { + initializer = true; + return () => {}; + } + }; +} + +class A { + @decorator + accessor x; +} + +new A(); + +expect(init).toBe(true); +expect(initializer).toBe(false); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json new file mode 100644 index 000000000000..fa55e7652b1a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-static-block" + ], + "minNodeVersion": "12.0.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js new file mode 100644 index 000000000000..0e7ac6161824 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js @@ -0,0 +1,11 @@ +const dec = () => {}; +class A { + #A = 1; + static B = class B extends A { + accessor a = 2; + + getA() { + return this.#A; + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js new file mode 100644 index 000000000000..ec3d19f84d2a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js @@ -0,0 +1,16 @@ +const dec = () => {}; +class A { + #A = 1; + static B = class B extends A { + #B = 2; + get a() { + return this.#B; + } + set a(v) { + this.#B = v; + } + getA() { + return this.#A; + } + }; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js new file mode 100644 index 000000000000..53848c42cb07 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + ([this.#x] = this.baz); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js new file mode 100644 index 000000000000..2ffabb75d901 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + for (this.#x of this.baz); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js new file mode 100644 index 000000000000..a60de2bae344 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + ({ x: this.#x } = this.baz); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js new file mode 100644 index 000000000000..6b513a380627 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + ([...this.#x] = this.baz); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js new file mode 100644 index 000000000000..7d01837e1b51 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + this.#x++; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js new file mode 100644 index 000000000000..b6417214fec7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js @@ -0,0 +1,8 @@ +const dec = () => {}; +class Foo { + @dec #x() {} + + bar() { + this.#x = 123; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json new file mode 100644 index 000000000000..188eae592ec5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Decorated private methods are not updatable, but \"#x\" is updated via this expression." +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js new file mode 100644 index 000000000000..6bc1a7dbbc4b --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +@dec +class Foo extends Bar { + constructor() { + let foo = super(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js new file mode 100644 index 000000000000..da70eb6e4869 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js @@ -0,0 +1,14 @@ +var _initClass; +const dec = () => {}; +let _Foo; +class Foo extends Bar { + static { + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + } + constructor() { + let foo = super(); + } + static { + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js new file mode 100644 index 000000000000..b32ea0bd378f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +class Foo extends Bar { + @dec + get #x() { + return super.foo(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js new file mode 100644 index 000000000000..3f622864ec2d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js @@ -0,0 +1,16 @@ +var _call_x, _initProto; +const dec = () => {}; +class Foo extends Bar { + static { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); + }]], [], _ => #x in _).e; + } + constructor(...args) { + super(...args); + _initProto(this); + } + get #x() { + return _call_x(this); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js new file mode 100644 index 000000000000..36f9bd37dfa7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js @@ -0,0 +1,7 @@ +const dec = () => {}; +class Foo extends Bar { + @dec + #x() { + return super.foo(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js new file mode 100644 index 000000000000..849f2d54e54f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js @@ -0,0 +1,14 @@ +var _call_x, _initProto; +const dec = () => {}; +class Foo extends Bar { + static { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); + }]], [], _ => #x in _).e; + } + constructor(...args) { + super(...args); + _initProto(this); + } + #x = _call_x; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js new file mode 100644 index 000000000000..586564c5e219 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js @@ -0,0 +1,23 @@ +const dec = () => {}; +@dec +@call() +@chain.expr() +@(arbitrary + expr) +@(array[expr]) +class Foo { + #a; + + @dec + @call() + @chain.expr() + @(arbitrary + expr) + @(array[expr]) + method() {} + + makeClass() { + return class Nested { + @(this.#a) + bar; + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js new file mode 100644 index 000000000000..54ae1fd38f96 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js @@ -0,0 +1,36 @@ +var _initClass, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _initProto; +const dec = () => {}; +let _Foo; +_dec = call(); +_dec2 = chain.expr(); +_dec3 = arbitrary + expr; +_dec4 = array[expr]; +_dec5 = call(); +_dec6 = chain.expr(); +_dec7 = arbitrary + expr; +_dec8 = array[expr]; +class Foo { + static { + ({ + e: [_initProto], + c: [_Foo, _initClass] + } = babelHelpers.applyDecs2303(this, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4])); + } + constructor(...args) { + _initProto(this); + } + #a; + method() {} + makeClass() { + var _dec9, _init_bar; + return _dec9 = this.#a, class Nested { + static { + [_init_bar] = babelHelpers.applyDecs2303(this, [[_dec9, 0, "bar"]], []).e; + } + bar = _init_bar(this); + }; + } + static { + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js new file mode 100644 index 000000000000..a59b51cc2314 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js @@ -0,0 +1,67 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logFieldDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logClassDecoratorRun(0, 19, 21) +@logClassDecoratorRun(1, 18, 20) +class A { + @logAccessorDecoratorRun(2, 11, 23, 27) + @logAccessorDecoratorRun(3, 10, 22, 26) + accessor a; + + @logFieldDecoratorRun(4, 15) + @logFieldDecoratorRun(5, 14) + b; + + @logFieldDecoratorRun(6, 17) + @logFieldDecoratorRun(7, 16) + #c; + + @logAccessorDecoratorRun(8, 13, 25, 29) + @logAccessorDecoratorRun(9, 12, 24, 28) + accessor #d; + + constructor() { + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js new file mode 100644 index 000000000000..a3efd8e40a6d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js @@ -0,0 +1,75 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 21) +@logClassDecoratorRun(1, 18, 20) +class A { + @logAccessorDecoratorRun(2, 11, 23, 31) + @logAccessorDecoratorRun(3, 10, 22, 30) + accessor a; + + @logMethodDecoratorRun(4, 13, 25, 35) + @logMethodDecoratorRun(5, 12, 24, 34) + b() {}; + + @logMethodDecoratorRun(6, 15, 27, 37) + @logMethodDecoratorRun(7, 14, 26, 36) + #c() {}; + + @logAccessorDecoratorRun(8, 17, 29, 33) + @logAccessorDecoratorRun(9, 16, 28, 32) + accessor #d; + + constructor() { + this.b(); + this.#c(); + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js new file mode 100644 index 000000000000..448854862950 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js @@ -0,0 +1,51 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return { + init: () => push(d) + }; + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + @logAccessorDecoratorRun(2, 15, 31, 35) + @logAccessorDecoratorRun(3, 14, 30, 34) + accessor a; + + @logAccessorDecoratorRun(4, 11, 21, 25) + @logAccessorDecoratorRun(5, 10, 20, 24) + static accessor b; + + @logAccessorDecoratorRun(6, 13, 23, 27) + @logAccessorDecoratorRun(7, 12, 22, 26) + static accessor #c; + + @logAccessorDecoratorRun(8, 17, 33, 37) + @logAccessorDecoratorRun(9, 16, 32, 36) + accessor #d; +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js new file mode 100644 index 000000000000..d940e8c8f379 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js @@ -0,0 +1,77 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + static { + A.b(), A.#c(); + } + + @logAccessorDecoratorRun(2, 15, 31, 35) + @logAccessorDecoratorRun(3, 14, 30, 34) + accessor a; + + @logMethodDecoratorRun(4, 11, 21, 25) + @logMethodDecoratorRun(5, 10, 20, 24) + static b() {}; + + @logMethodDecoratorRun(6, 13, 23, 27) + @logMethodDecoratorRun(7, 12, 22, 26) + static #c() {}; + + @logAccessorDecoratorRun(8, 17, 33, 37) + @logAccessorDecoratorRun(9, 16, 32, 36) + accessor #d; + + constructor() { + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js new file mode 100644 index 000000000000..46e71f7281db --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js @@ -0,0 +1,27 @@ +var counter = 0; + +@(x => x) +class A { + foo = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBeUndefined(); + expect(this.bar).toBeUndefined(); + return "foo"; + })(); + + method() {} + + bar = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBe("foo"); + expect(this.bar).toBeUndefined(); + })(); +} + +expect(counter).toBe(0); + +new A(); + +expect(counter).toBe(2); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js new file mode 100644 index 000000000000..7a51e8b93b7e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js @@ -0,0 +1,31 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logDecoratorRun(0, 21) +@logDecoratorRun(1, 20) +class A { + @logDecoratorRun(2, 17) + @logDecoratorRun(3, 16) + [push(4)]; + + @logDecoratorRun(5, 13) + @logDecoratorRun(6, 12) + static [push(7)]; + + @logDecoratorRun(8, 15) + @logDecoratorRun(9, 14) + static #c; + + @logDecoratorRun(10, 19) + @logDecoratorRun(11, 18) + #d; +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js new file mode 100644 index 000000000000..2a43cb651ee9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js @@ -0,0 +1,56 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return el; + }; +} + +@logDecoratorRun(0, 35, 45) +@logDecoratorRun(1, 34, 44) +class A { + @logDecoratorRun(2, 27, 47) + @logDecoratorRun(3, 26, 46) + a() {}; + + @logDecoratorRun(4, 19, 37) + @logDecoratorRun(5, 18, 36) + static b() {}; + + @logDecoratorRun(6, 21, 39) + @logDecoratorRun(7, 20, 38) + static #c() {}; + + @logDecoratorRun(8, 29, 49) + @logDecoratorRun(9, 28, 48) + #d() {}; + + @logDecoratorRun(10, 31, 51) + @logDecoratorRun(11, 30, 50) + accessor e; + + @logDecoratorRun(12, 23, 41) + @logDecoratorRun(13, 22, 40) + static accessor f; + + @logDecoratorRun(14, 25, 43) + @logDecoratorRun(15, 24, 42) + static accessor #g; + + @logDecoratorRun(16, 33, 53) + @logDecoratorRun(17, 32, 52) + accessor #h; +} + +var nums = Array.from({ length: 46 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 54 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js new file mode 100644 index 000000000000..e1ec45be3190 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js @@ -0,0 +1,74 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + @logMethodDecoratorRun(2, 15, 31, 35) + @logMethodDecoratorRun(3, 14, 30, 34) + a() {} + + @logAccessorDecoratorRun(4, 11, 21, 25) + @logAccessorDecoratorRun(5, 10, 20, 24) + static accessor b; + + @logAccessorDecoratorRun(6, 13, 23, 27) + @logAccessorDecoratorRun(7, 12, 22, 26) + static accessor #c; + + @logMethodDecoratorRun(8, 17, 33, 37) + @logMethodDecoratorRun(9, 16, 32, 36) + #d() {} + + constructor() { + this.a(); + this.#d(); + } +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js new file mode 100644 index 000000000000..0703f091cc8d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js @@ -0,0 +1,23 @@ +var counter = 0; + +@(x => x) +class A { + static foo = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBeUndefined(); + expect(this.bar).toBeUndefined(); + return "foo"; + })(); + + static method() {} + + static bar = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBe("foo"); + expect(this.bar).toBeUndefined(); + })(); +} + +expect(counter).toBe(2); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js new file mode 100644 index 000000000000..a59b51cc2314 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js @@ -0,0 +1,67 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logFieldDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logClassDecoratorRun(0, 19, 21) +@logClassDecoratorRun(1, 18, 20) +class A { + @logAccessorDecoratorRun(2, 11, 23, 27) + @logAccessorDecoratorRun(3, 10, 22, 26) + accessor a; + + @logFieldDecoratorRun(4, 15) + @logFieldDecoratorRun(5, 14) + b; + + @logFieldDecoratorRun(6, 17) + @logFieldDecoratorRun(7, 16) + #c; + + @logAccessorDecoratorRun(8, 13, 25, 29) + @logAccessorDecoratorRun(9, 12, 24, 28) + accessor #d; + + constructor() { + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js new file mode 100644 index 000000000000..a3efd8e40a6d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js @@ -0,0 +1,75 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 21) +@logClassDecoratorRun(1, 18, 20) +class A { + @logAccessorDecoratorRun(2, 11, 23, 31) + @logAccessorDecoratorRun(3, 10, 22, 30) + accessor a; + + @logMethodDecoratorRun(4, 13, 25, 35) + @logMethodDecoratorRun(5, 12, 24, 34) + b() {}; + + @logMethodDecoratorRun(6, 15, 27, 37) + @logMethodDecoratorRun(7, 14, 26, 36) + #c() {}; + + @logAccessorDecoratorRun(8, 17, 29, 33) + @logAccessorDecoratorRun(9, 16, 28, 32) + accessor #d; + + constructor() { + this.b(); + this.#c(); + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js new file mode 100644 index 000000000000..448854862950 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js @@ -0,0 +1,51 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return { + init: () => push(d) + }; + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + @logAccessorDecoratorRun(2, 15, 31, 35) + @logAccessorDecoratorRun(3, 14, 30, 34) + accessor a; + + @logAccessorDecoratorRun(4, 11, 21, 25) + @logAccessorDecoratorRun(5, 10, 20, 24) + static accessor b; + + @logAccessorDecoratorRun(6, 13, 23, 27) + @logAccessorDecoratorRun(7, 12, 22, 26) + static accessor #c; + + @logAccessorDecoratorRun(8, 17, 33, 37) + @logAccessorDecoratorRun(9, 16, 32, 36) + accessor #d; +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js new file mode 100644 index 000000000000..d940e8c8f379 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js @@ -0,0 +1,77 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + static { + A.b(), A.#c(); + } + + @logAccessorDecoratorRun(2, 15, 31, 35) + @logAccessorDecoratorRun(3, 14, 30, 34) + accessor a; + + @logMethodDecoratorRun(4, 11, 21, 25) + @logMethodDecoratorRun(5, 10, 20, 24) + static b() {}; + + @logMethodDecoratorRun(6, 13, 23, 27) + @logMethodDecoratorRun(7, 12, 22, 26) + static #c() {}; + + @logAccessorDecoratorRun(8, 17, 33, 37) + @logAccessorDecoratorRun(9, 16, 32, 36) + accessor #d; + + constructor() { + this.a = this.#d = null; + } +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js new file mode 100644 index 000000000000..46e71f7281db --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js @@ -0,0 +1,27 @@ +var counter = 0; + +@(x => x) +class A { + foo = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBeUndefined(); + expect(this.bar).toBeUndefined(); + return "foo"; + })(); + + method() {} + + bar = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBe("foo"); + expect(this.bar).toBeUndefined(); + })(); +} + +expect(counter).toBe(0); + +new A(); + +expect(counter).toBe(2); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js new file mode 100644 index 000000000000..7a51e8b93b7e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js @@ -0,0 +1,31 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logDecoratorRun(0, 21) +@logDecoratorRun(1, 20) +class A { + @logDecoratorRun(2, 17) + @logDecoratorRun(3, 16) + [push(4)]; + + @logDecoratorRun(5, 13) + @logDecoratorRun(6, 12) + static [push(7)]; + + @logDecoratorRun(8, 15) + @logDecoratorRun(9, 14) + static #c; + + @logDecoratorRun(10, 19) + @logDecoratorRun(11, 18) + #d; +} + +var nums = Array.from({ length: 22 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js new file mode 100644 index 000000000000..2a43cb651ee9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js @@ -0,0 +1,56 @@ +var log = []; + +function push(x) { log.push(x); return x; } + +function logDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { push(c); }); + return el; + }; +} + +@logDecoratorRun(0, 35, 45) +@logDecoratorRun(1, 34, 44) +class A { + @logDecoratorRun(2, 27, 47) + @logDecoratorRun(3, 26, 46) + a() {}; + + @logDecoratorRun(4, 19, 37) + @logDecoratorRun(5, 18, 36) + static b() {}; + + @logDecoratorRun(6, 21, 39) + @logDecoratorRun(7, 20, 38) + static #c() {}; + + @logDecoratorRun(8, 29, 49) + @logDecoratorRun(9, 28, 48) + #d() {}; + + @logDecoratorRun(10, 31, 51) + @logDecoratorRun(11, 30, 50) + accessor e; + + @logDecoratorRun(12, 23, 41) + @logDecoratorRun(13, 22, 40) + static accessor f; + + @logDecoratorRun(14, 25, 43) + @logDecoratorRun(15, 24, 42) + static accessor #g; + + @logDecoratorRun(16, 33, 53) + @logDecoratorRun(17, 32, 52) + accessor #h; +} + +var nums = Array.from({ length: 46 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 54 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json new file mode 100644 index 000000000000..b48aa6db604e --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]], + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js new file mode 100644 index 000000000000..e1ec45be3190 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js @@ -0,0 +1,74 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + }; + }; +} + +function logMethodDecoratorRun(a, b, c, d) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return () => (el(), push(d)) + }; +} + +@logClassDecoratorRun(0, 19, 29) +@logClassDecoratorRun(1, 18, 28) +class A { + @logMethodDecoratorRun(2, 15, 31, 35) + @logMethodDecoratorRun(3, 14, 30, 34) + a() {} + + @logAccessorDecoratorRun(4, 11, 21, 25) + @logAccessorDecoratorRun(5, 10, 20, 24) + static accessor b; + + @logAccessorDecoratorRun(6, 13, 23, 27) + @logAccessorDecoratorRun(7, 12, 22, 26) + static accessor #c; + + @logMethodDecoratorRun(8, 17, 33, 37) + @logMethodDecoratorRun(9, 16, 32, 36) + #d() {} + + constructor() { + this.a(); + this.#d(); + } +} + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 38 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js new file mode 100644 index 000000000000..0703f091cc8d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js @@ -0,0 +1,23 @@ +var counter = 0; + +@(x => x) +class A { + static foo = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBeUndefined(); + expect(this.bar).toBeUndefined(); + return "foo"; + })(); + + static method() {} + + static bar = (() => { + counter++; + expect(typeof this.method).toBe("function"); + expect(this.foo).toBe("foo"); + expect(this.bar).toBeUndefined(); + })(); +} + +expect(counter).toBe(2); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js new file mode 100644 index 000000000000..cd977fce13e0 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js @@ -0,0 +1,20 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {} +const returnsGetSet = () => ({ set(v) {}, get() {} }); +const returnsInit = () => ({ init() {} }); +const returnsGetFalse = () => ({ get: false }); +const returnsSetFalse = () => ({ set: false }); +const returnsInitFalse = () => ({ init: false }); + +expect(() => class { @returnsNull accessor a }).toThrow("accessor decorators must return an object with get, set, or init properties or void 0") +expect(() => class { @returnsFalse accessor a }).toThrow("accessor decorators must return an object with get, set, or init properties or void 0") +expect(() => class { @returnsFunction accessor a }).toThrow("accessor decorators must return an object with get, set, or init properties or void 0") +expect(() => class { @returnsGetFalse accessor a }).toThrow("accessor.get must be a function"); +expect(() => class { @returnsSetFalse accessor a }).toThrow("accessor.set must be a function"); +expect(() => class { @returnsInitFalse accessor a }).toThrow("accessor.init must be a function"); + +expect(() => class { @returnsGetSet accessor a }).not.toThrow(); +expect(() => class { @returnsInit accessor a }).not.toThrow(); +expect(() => class { @returnsUndefined accessor a }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js new file mode 100644 index 000000000000..a91c771ca9b8 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js @@ -0,0 +1,6 @@ +const decWithInitializer = (init) => (_, context) => { context.addInitializer(init) } + +expect(() => class { @decWithInitializer(null) static m() {} }).toThrow("An initializer must be a function") +expect(() => class { @decWithInitializer(false) static m() {} }).toThrow("An initializer must be a function") +expect(() => class { @decWithInitializer(void 0) static m() {} }).toThrow("An initializer must be a function"); +expect(() => class { @decWithInitializer(() => {}) static m() {} }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js new file mode 100644 index 000000000000..dc0b566937ae --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js @@ -0,0 +1,9 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {}; + +expect(() => @returnsNull class {}).toThrow("class decorators must return a function or void 0") +expect(() => @returnsFalse class {}).toThrow("class decorators must return a function or void 0") +expect(() => @returnsFunction class {}).not.toThrow(); +expect(() => @returnsUndefined class {}).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js new file mode 100644 index 000000000000..2776eb4561c6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js @@ -0,0 +1,9 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {}; + +expect(() => class { @returnsNull m() {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFalse m() {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFunction m() {} }).not.toThrow(); +expect(() => class { @returnsUndefined m() {} }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js new file mode 100644 index 000000000000..eb9e8bcdcc03 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js @@ -0,0 +1,9 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {}; + +expect(() => class { @returnsNull get p() {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFalse get p() {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFunction get p() {} }).not.toThrow(); +expect(() => class { @returnsUndefined get p() {} }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js new file mode 100644 index 000000000000..181333cf4840 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js @@ -0,0 +1,9 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {}; + +expect(() => class { @returnsNull p }).toThrow("field decorators must return a function or void 0") +expect(() => class { @returnsFalse p }).toThrow("field decorators must return a function or void 0") +expect(() => class { @returnsFunction p }).not.toThrow(); +expect(() => class { @returnsUndefined p }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js new file mode 100644 index 000000000000..d0f7f5115a97 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js @@ -0,0 +1,9 @@ +const returnsUndefined = () => void 0; +const returnsNull = () => null; +const returnsFalse = () => false; +const returnsFunction = () => () => {}; + +expect(() => class { @returnsNull set p(v) {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFalse set p(v) {} }).toThrow("method decorators must return a function or void 0") +expect(() => class { @returnsFunction set p(v) {} }).not.toThrow(); +expect(() => class { @returnsUndefined set p(v) {} }).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json new file mode 100644 index 000000000000..78dfc85292c5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-03" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js new file mode 100644 index 000000000000..2e5ed8d74721 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js @@ -0,0 +1,44 @@ +function dec(set, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function (v) { + return set.call(this, v + 1); + } +} + +class Foo { + value = 1; + + @dec + set #a(v) { + return this.value = v; + } + + setA(v) { + this.#a = v; + } +} + +let foo = new Foo(); + +const aContext = foo['#aContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(false); + +expect(foo.value).toBe(1); +aContext.access.set(foo, 123); +expect(foo.value).toBe(124); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(foo.value).toBe(124); +foo.setA(456); +expect(foo.value).toBe(457); + +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('setter'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js new file mode 100644 index 000000000000..66dd78268d19 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + set #a(v) { + return this.value = v; + } + + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js new file mode 100644 index 000000000000..c5293d4c9980 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js @@ -0,0 +1,22 @@ +var _call_a, _initProto; +const dec = () => {}; +var _a = /*#__PURE__*/new WeakMap(); +class Foo { + constructor(...args) { + babelHelpers.classPrivateFieldInitSpec(this, _a, { + get: void 0, + set: _set_a + }); + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + setA(v) { + babelHelpers.classPrivateFieldSet(this, _a, v); + } +} +function _set_a(v) { + _call_a(this, v); +} +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a", function (v) { + return this.value = v; +}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js new file mode 100644 index 000000000000..f82fb5e637da --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js @@ -0,0 +1,52 @@ +function dec(set, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function (v) { + return set.call(this, v + 1); + } +} + +class Foo { + value = 1; + + @dec + set a(v) { + return this.value = v; + } + + @dec + set ['b'](v) { + return this.value = v; + } +} + +let foo = new Foo(); + +const aContext = foo['aContext']; +const bContext = foo['bContext']; + +expect(aContext.access.has(foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(foo.value).toBe(1); +foo.a = 123; +expect(foo.value).toBe(124); +aContext.access.set(foo, 456); +expect(foo.value).toBe(457); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('setter'); +expect(aContext.static).toBe(false); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('setter'); +expect(bContext.static).toBe(false); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js new file mode 100644 index 000000000000..9a7faf175edd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + set a(v) { + return this.value = v; + } + + @dec + set ['b'](v) { + return this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js new file mode 100644 index 000000000000..48da3f7bfcfb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + constructor(...args) { + babelHelpers.defineProperty(this, "value", 1); + _initProto(this); + } + set a(v) { + return this.value = v; + } + set [_computedKey](v) { + return this.value = v; + } +} +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js new file mode 100644 index 000000000000..6314a3393e05 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js @@ -0,0 +1,42 @@ +function dec(set, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function (v) { + return set.call(this, v + 1); + } +} + +class Foo { + static value = 1; + + @dec + static set #a(v) { + return this.value = v; + } + + static setA(v) { + this.#a = v; + } +} + +const aContext = Foo['#aContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(false); + +expect(Foo.value).toBe(1); +aContext.access.set(Foo, 123); +expect(Foo.value).toBe(124); +expect(() => aContext.access.set({}, 456)).toThrow(TypeError); +expect(Foo.value).toBe(124); +Foo.setA(456); +expect(Foo.value).toBe(457); + +expect(aContext.name).toBe('#a'); +expect(aContext.kind).toBe('setter'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(true); +expect(typeof aContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js new file mode 100644 index 000000000000..6bf29a2a2c94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static set #a(v) { + return this.value = v; + } + + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js new file mode 100644 index 000000000000..3d8caceaa7a5 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js @@ -0,0 +1,21 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static setA(v) { + babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); + } +} +function _set_a(v) { + _call_a(this, v); +} +var _a = { + get: void 0, + set: _set_a +}; +(() => { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a", function (v) { + return this.value = v; + }]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js new file mode 100644 index 000000000000..e6c67fe0217d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js @@ -0,0 +1,50 @@ +function dec(set, context) { + context.addInitializer(function() { + this[context.name + 'Context'] = context; + }); + + return function (v) { + return set.call(this, v + 1); + } +} + +class Foo { + static value = 1; + + @dec + static set a(v) { + return this.value = v; + } + + @dec + static set ['b'](v) { + return this.value = v; + } +} + +const aContext = Foo['aContext']; +const bContext = Foo['bContext']; + +expect(aContext.access.has(Foo)).toBe(true); +expect(aContext.access.has({})).toBe(false); +expect(aContext.access.has(Object.create(Foo))).toBe(true); +expect(aContext.access.has({ a: 1 })).toBe(true); +expect(aContext.access.has(Object.create({ a: 1 }))).toBe(true); + +expect(Foo.value).toBe(1); +Foo.a = 123; +expect(Foo.value).toBe(124); +aContext.access.set(Foo, 456); +expect(Foo.value).toBe(457); + +expect(aContext.name).toBe('a'); +expect(aContext.kind).toBe('setter'); +expect(aContext.static).toBe(true); +expect(aContext.private).toBe(false); +expect(typeof aContext.addInitializer).toBe('function'); + +expect(bContext.name).toBe('b'); +expect(bContext.kind).toBe('setter'); +expect(bContext.static).toBe(true); +expect(bContext.private).toBe(false); +expect(typeof bContext.addInitializer).toBe('function'); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js new file mode 100644 index 000000000000..ed0a661dcb2d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static set a(v) { + return this.value = v; + } + + @dec + static set ['b'](v) { + return this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js new file mode 100644 index 000000000000..4b5afa5e10de --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static set a(v) { + return this.value = v; + } + static set [_computedKey](v) { + return this.value = v; + } +} +(() => { + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a"], [dec, 9, _computedKey]], []).e; + _initStatic(Foo); +})(); +babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json new file mode 100644 index 000000000000..3878fe79a69c --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-03" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js new file mode 100644 index 000000000000..66dd78268d19 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + set #a(v) { + return this.value = v; + } + + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js new file mode 100644 index 000000000000..f4020f172e07 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js @@ -0,0 +1,19 @@ +var _call_a, _initProto; +const dec = () => {}; +class Foo { + static { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a", function (v) { + return this.value = v; + }]], [], _ => #a in _).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + set #a(v) { + _call_a(this, v); + } + setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js new file mode 100644 index 000000000000..9a7faf175edd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + value = 1; + + @dec + set a(v) { + return this.value = v; + } + + @dec + set ['b'](v) { + return this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js new file mode 100644 index 000000000000..5fea5ec2b8cb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js @@ -0,0 +1,18 @@ +var _computedKey, _initProto; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; + } + constructor(...args) { + _initProto(this); + } + value = 1; + set a(v) { + return this.value = v; + } + set [_computedKey](v) { + return this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js new file mode 100644 index 000000000000..6bf29a2a2c94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js @@ -0,0 +1,13 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static set #a(v) { + return this.value = v; + } + + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js new file mode 100644 index 000000000000..df9d68208bf7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js @@ -0,0 +1,17 @@ +var _call_a, _initStatic; +const dec = () => {}; +class Foo { + static { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a", function (v) { + return this.value = v; + }]], []).e; + _initStatic(this); + } + static value = 1; + static set #a(v) { + _call_a(this, v); + } + static setA(v) { + this.#a = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js new file mode 100644 index 000000000000..ed0a661dcb2d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js @@ -0,0 +1,14 @@ +const dec = () => {}; +class Foo { + static value = 1; + + @dec + static set a(v) { + return this.value = v; + } + + @dec + static set ['b'](v) { + return this.value = v; + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js new file mode 100644 index 000000000000..e55c604c3434 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js @@ -0,0 +1,16 @@ +var _computedKey, _initStatic; +const dec = () => {}; +_computedKey = 'b'; +class Foo { + static { + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a"], [dec, 9, _computedKey]], []).e; + _initStatic(this); + } + static value = 1; + static set a(v) { + return this.value = v; + } + static set [_computedKey](v) { + return this.value = v; + } +} From 2e11511c46c9a85b79f8a7e97707d8e85ac10b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sun, 16 Apr 2023 14:24:45 +0200 Subject: [PATCH 05/15] Preserve `this` in decorators --- .../babel-helpers/src/helpers-generated.ts | 2 +- .../src/helpers/applyDecs2303.js | 116 ++++++++---------- .../src/transformer-2023-03.ts | 85 +++++++++---- .../2023-03-misc--to-es2015/this/exec.js | 26 ++++ .../2023-03-misc--to-es2015/this/input.js | 12 ++ .../2023-03-misc--to-es2015/this/output.js | 25 ++++ .../test/fixtures/2023-03-misc/this/exec.js | 26 ++++ .../test/fixtures/2023-03-misc/this/input.js | 12 ++ .../test/fixtures/2023-03-misc/this/output.js | 27 ++++ 9 files changed, 240 insertions(+), 91 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 70af2f13efb6..78985a05fcd6 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -39,7 +39,7 @@ export default Object.freeze({ ), applyDecs2303: helper( "7.21.0", - 'import checkInRHS from"checkInRHS";function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){assertNotFinished(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec(value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertNotFinished(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":10===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis1(fn){return function(){return fn(this)}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,newValue,get,set,decs=decInfo[0];if(isPrivate?desc=0===kind||1===kind?{get:curryThis1(decInfo[3]),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set),"function"==typeof decs)void 0!==(newValue=memberDec(decs,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand))&&(assertValidReturnValue(kind,newValue),0===kind?init=newValue:1===kind?(init=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue);else for(var i=decs.length-1;i>=0;i--){var newInit;if(void 0!==(newValue=memberDec(decs[i],name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,i=classDecs.length-1;i>=0;i--){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i](newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=1;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],hasThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,hasThis=1===classDecs[0],inc=hasThis?2:1,i=classDecs.length-1;i>=1;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(hasThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i= 1; i -= inc) { + var dec = decs[i]; + newValue = memberDec( - decs, + dec, + hasThis ? decs[i - 1] : undefined, name, desc, initializers, @@ -269,11 +276,12 @@ function applyMemberDec( if (newValue !== void 0) { assertValidReturnValue(kind, newValue); + var newInit; if (kind === 0 /* FIELD */) { - init = newValue; + newInit = newValue; } else if (kind === 1 /* ACCESSOR */) { - init = newValue.init; + newInit = newValue.init; get = newValue.get || value.get; set = newValue.set || value.set; @@ -281,47 +289,14 @@ function applyMemberDec( } else { value = newValue; } - } - } else { - for (var i = decs.length - 1; i >= 0; i--) { - var dec = decs[i]; - - newValue = memberDec( - dec, - name, - desc, - initializers, - kind, - isStatic, - isPrivate, - value, - hasPrivateBrand - ); - - if (newValue !== void 0) { - assertValidReturnValue(kind, newValue); - var newInit; - if (kind === 0 /* FIELD */) { - newInit = newValue; - } else if (kind === 1 /* ACCESSOR */) { - newInit = newValue.init; - get = newValue.get || value.get; - set = newValue.set || value.set; - - value = { get: get, set: set }; + if (newInit !== void 0) { + if (init === void 0) { + init = newInit; + } else if (typeof init === "function") { + init = [init, newInit]; } else { - value = newValue; - } - - if (newInit !== void 0) { - if (init === void 0) { - init = newInit; - } else if (typeof init === "function") { - init = [init, newInit]; - } else { - init.push(newInit); - } + init.push(newInit); } } } @@ -494,18 +469,25 @@ function applyClassDecs(targetClass, classDecs) { var newClass = targetClass; var name = targetClass.name; - for (var i = classDecs.length - 1; i >= 0; i--) { + var hasThis = classDecs[0] === 1; + var inc = hasThis ? 2 : 1; + + for (var i = classDecs.length - 1; i >= 1; i -= inc) { var decoratorFinishedRef = { v: false }; try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod( - initializers, - decoratorFinishedRef - ), - }); + var nextNewClass = classDecs[i].call( + hasThis ? classDecs[i - 1] : undefined, + newClass, + { + kind: "class", + name: name, + addInitializer: createAddInitializerMethod( + initializers, + decoratorFinishedRef + ), + } + ); } finally { decoratorFinishedRef.v = true; } @@ -537,7 +519,7 @@ function applyClassDecs(targetClass, classDecs) { [ // member decorators [ - dec, // dec or array of decs + decs, // array of decs or of decs and this values 0, // kind of value being decorated 'prop', // name of public prop on class containing the value being decorated, '#p', // the name of the private property (if is private, void 0 otherwise), @@ -608,21 +590,21 @@ function applyClassDecs(targetClass, classDecs) { let ret = applyDecs( this, [ - [dec, 0, 'a'], - [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], - [[dec, dec2], 1, 'b'], - [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], - [dec, 2, 'c'], - [dec, 2, 'c', () => console.log('privC')], - [dec, 3, 'd'], - [dec, 3, 'd', () => console.log('privD')], - [dec, 4, 'e'], - [dec, 4, 'e', () => console.log('privE')], + [[0, dec], 0, 'a'], + [[0, dec], 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[0, dec, dec2], 1, 'b'], + [[0, dec], 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [[0, dec], 2, 'c'], + [[0, dec], 2, 'c', () => console.log('privC')], + [[0, dec], 3, 'd'], + [[0, dec], 3, 'd', () => console.log('privD')], + [[0, dec], 4, 'e'], + [[0, dec], 4, 'e', () => console.log('privE')], ], [ - dec + 0, dec ] - ) + ); initA = ret[0]; @@ -675,7 +657,7 @@ function applyClassDecs(targetClass, classDecs) { initializeClass(Class); */ -export default function applyDecs2301( +export default function applyDecs2303( targetClass, memberDecs, classDecs, diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index 108b24136e9c..6f152f362632 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -288,6 +288,7 @@ function getElementKind(element: NodePath): number { interface DecoratorInfo { // The expressions of the decorators themselves decorators: t.Expression[]; + decoratorsThis: t.Expression[]; // The kind of the decorated value, matches the kind value passed to applyDecs kind: number; @@ -337,21 +338,45 @@ function filteredOrderedDecoratorInfo( ]; } +function generateDecorationList( + decorators: t.Expression[], + decoratorsThis: (t.Expression | null)[], + version: DecoratorVersionKind, +) { + const decsCount = decorators.length; + const hasOneThis = decoratorsThis.some(Boolean); + const decs: t.Expression[] = []; + for (let i = 0; i < decsCount; i++) { + if (version === "2023-03" && hasOneThis) { + decs.push( + decoratorsThis[i] || t.unaryExpression("void", t.numericLiteral(0)), + ); + } + decs.push(decorators[i]); + } + + if (version === "2023-03") { + decs.unshift(t.numericLiteral(hasOneThis ? 1 : 0)); + } + return decs; +} + function generateDecorationExprs( info: (DecoratorInfo | ComputedPropInfo)[], + version: DecoratorVersionKind, ): t.ArrayExpression { return t.arrayExpression( filteredOrderedDecoratorInfo(info).map(el => { - const decs = - el.decorators.length > 1 - ? t.arrayExpression(el.decorators) - : el.decorators[0]; - - const kind = el.isStatic ? el.kind + STATIC : el.kind; - + const decs = generateDecorationList( + el.decorators, + el.decoratorsThis, + version, + ); return t.arrayExpression([ - decs, - t.numericLiteral(kind), + version !== "2023-03" && decs.length === 1 + ? decs[0] + : t.arrayExpression(decs), + t.numericLiteral(el.isStatic ? el.kind + STATIC : el.kind), el.name, ...(el.privateMethods || []), ]); @@ -544,6 +569,20 @@ function transformClass( return t.cloneNode(localEvaluatedId); }; + const decoratorsThis = new Map(); + const maybeExtractDecorator = (decorator: t.Decorator) => { + const { expression } = decorator; + if (version === "2023-03" && t.isMemberExpression(expression)) { + if (!scopeParent.isStatic(expression)) { + expression.object = memoiseExpression(expression.object, "obj"); + } + decoratorsThis.set(decorator, t.cloneNode(expression.object)); + } + if (!scopeParent.isStatic(expression)) { + decorator.expression = memoiseExpression(expression, "dec"); + } + }; + if (classDecorators) { classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass"); @@ -554,12 +593,7 @@ function transformClass( path.node.decorators = null; for (const classDecorator of classDecorators) { - if (!scopeParent.isStatic(classDecorator.expression)) { - classDecorator.expression = memoiseExpression( - classDecorator.expression, - "dec", - ); - } + maybeExtractDecorator(classDecorator); } } else { if (!path.node.id) { @@ -584,12 +618,7 @@ function transformClass( if (hasDecorators) { for (const decoratorPath of decorators) { - if (!scopeParent.isStatic(decoratorPath.node.expression)) { - decoratorPath.node.expression = memoiseExpression( - decoratorPath.node.expression, - "dec", - ); - } + maybeExtractDecorator(decoratorPath.node); } } @@ -759,6 +788,7 @@ function transformClass( elementDecoratorInfo.push({ kind, decorators: decorators.map(d => d.node.expression), + decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)), name: nameExpr, isStatic, privateMethods, @@ -790,9 +820,18 @@ function transformClass( } } - const elementDecorations = generateDecorationExprs(elementDecoratorInfo); + const elementDecorations = generateDecorationExprs( + elementDecoratorInfo, + version, + ); const classDecorations = t.arrayExpression( - (classDecorators || []).map(d => d.expression), + classDecorators + ? generateDecorationList( + classDecorators.map(el => el.expression), + classDecorators.map(dec => decoratorsThis.get(dec)), + version, + ) + : [], ); const elementLocals: t.Identifier[] = diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js new file mode 100644 index 000000000000..e418f72569e9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js @@ -0,0 +1,26 @@ +"use strict"; + +let _this = []; + +function dec() { + _this.push(this); +} + +let o1 = { dec }; +let o2 = { dec }; +let o3 = { o: { dec } }; + +@o1.dec +@dec +@o2.dec +class A { + @o2.dec + @o3.o.dec + x; + + @o2.dec + @dec + y; +} + +expect(_this).toEqual([o3.o, o2, undefined, o2, o2, undefined, o1]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js new file mode 100644 index 000000000000..c95350691ddb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js @@ -0,0 +1,12 @@ +@o1.dec +@dec +@o2.dec +class A { + @o2.dec + @o3.o.dec + x; + + @o2.dec + @dec + y; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js new file mode 100644 index 000000000000..d49cea52fc93 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js @@ -0,0 +1,25 @@ +var _initClass, _obj, _dec, _dec2, _obj2, _dec3, _obj3, _dec4, _obj4, _dec5, _init_x, _obj5, _dec6, _dec7, _init_y; +let _A; +_obj = o1; +_dec = _obj.dec; +_dec2 = dec; +_obj2 = o2; +_dec3 = _obj2.dec; +_obj3 = o2; +_dec4 = _obj3.dec; +_obj4 = o3.o; +_dec5 = _obj4.dec; +_obj5 = o2; +_dec6 = _obj5.dec; +_dec7 = dec; +class A { + constructor() { + babelHelpers.defineProperty(this, "x", _init_x(this)); + babelHelpers.defineProperty(this, "y", _init_y(this)); + } +} +({ + e: [_init_x, _init_y], + c: [_A, _initClass] +} = babelHelpers.applyDecs2303(A, [[[1, _obj3, _dec4, _obj4, _dec5], 0, "x"], [[1, _obj5, _dec6, void 0, _dec7], 0, "y"]], [1, _obj, _dec, void 0, _dec2, _obj2, _dec3])); +_initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js new file mode 100644 index 000000000000..e418f72569e9 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js @@ -0,0 +1,26 @@ +"use strict"; + +let _this = []; + +function dec() { + _this.push(this); +} + +let o1 = { dec }; +let o2 = { dec }; +let o3 = { o: { dec } }; + +@o1.dec +@dec +@o2.dec +class A { + @o2.dec + @o3.o.dec + x; + + @o2.dec + @dec + y; +} + +expect(_this).toEqual([o3.o, o2, undefined, o2, o2, undefined, o1]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js new file mode 100644 index 000000000000..c95350691ddb --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js @@ -0,0 +1,12 @@ +@o1.dec +@dec +@o2.dec +class A { + @o2.dec + @o3.o.dec + x; + + @o2.dec + @dec + y; +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js new file mode 100644 index 000000000000..de46480a91ab --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js @@ -0,0 +1,27 @@ +var _initClass, _obj, _dec, _dec2, _obj2, _dec3, _obj3, _dec4, _obj4, _dec5, _init_x, _obj5, _dec6, _dec7, _init_y; +let _A; +_obj = o1; +_dec = _obj.dec; +_dec2 = dec; +_obj2 = o2; +_dec3 = _obj2.dec; +_obj3 = o2; +_dec4 = _obj3.dec; +_obj4 = o3.o; +_dec5 = _obj4.dec; +_obj5 = o2; +_dec6 = _obj5.dec; +_dec7 = dec; +class A { + static { + ({ + e: [_init_x, _init_y], + c: [_A, _initClass] + } = babelHelpers.applyDecs2303(this, [[[1, _obj3, _dec4, _obj4, _dec5], 0, "x"], [[1, _obj5, _dec6, void 0, _dec7], 0, "y"]], [1, _obj, _dec, void 0, _dec2, _obj2, _dec3])); + } + x = _init_x(this); + y = _init_y(this); + static { + _initClass(); + } +} From 3f1c3d2f5e7f8f6a47c7ca5e80b7569e82eab819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sun, 16 Apr 2023 14:25:07 +0200 Subject: [PATCH 06/15] Update 2023-03 fixtures --- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-accessors/private/output.js | 2 +- .../2023-03-accessors/public/output.js | 2 +- .../2023-03-accessors/static-private/output.js | 2 +- .../2023-03-accessors/static-public/output.js | 2 +- .../output.js | 2 +- .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/output.js | 2 +- .../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 +- .../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-03-classes/expressions/output.js | 18 +++++++++--------- .../2023-03-classes/inheritance/output.js | 4 ++-- .../2023-03-classes/initializers/output.js | 4 ++-- .../output.js | 2 +- .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/output.js | 2 +- .../2023-03-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-03-exported/default-named/output.mjs | 2 +- .../member-decorator/output.mjs | 2 +- .../fixtures/2023-03-exported/named/output.mjs | 2 +- .../private/output.js | 2 +- .../2023-03-fields--to-es2015/public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../fixtures/2023-03-fields/private/output.js | 2 +- .../fixtures/2023-03-fields/public/output.js | 2 +- .../2023-03-fields/static-private/output.js | 2 +- .../2023-03-fields/static-public/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../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 +- .../fixtures/2023-03-getters/private/output.js | 2 +- .../fixtures/2023-03-getters/public/output.js | 2 +- .../2023-03-getters/static-private/output.js | 2 +- .../2023-03-getters/static-public/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../fixtures/2023-03-methods/private/output.js | 2 +- .../fixtures/2023-03-methods/public/output.js | 2 +- .../2023-03-methods/static-private/output.js | 2 +- .../2023-03-methods/static-public/output.js | 2 +- .../output.js | 2 +- .../valid-expression-formats/output.js | 12 +++++++----- .../2023-03-misc/all-decorators/output.js | 2 +- .../output.js | 4 ++-- .../output.js | 2 +- .../output.js | 2 +- .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/output.js | 2 +- .../valid-expression-formats/output.js | 16 +++++++++------- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../fixtures/2023-03-setters/private/output.js | 2 +- .../fixtures/2023-03-setters/public/output.js | 2 +- .../2023-03-setters/static-private/output.js | 2 +- .../2023-03-setters/static-public/output.js | 2 +- 92 files changed, 146 insertions(+), 142 deletions(-) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js index fd3674330e31..83ab40cca0ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js @@ -36,4 +36,4 @@ function _set_b2(v) { function _get_b2() { return _get_b(this); } -[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [[0, dec], 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js index 22dc762cb4e8..3c83dab4633a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js @@ -38,4 +38,4 @@ class Foo { babelHelpers.classPrivateFieldSet(this, _C, v); } } -[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 1, "a"], [[0, dec], 1, "b"], [[0, dec], 1, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js index 6280358addc8..10bae5b30f07 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js @@ -27,7 +27,7 @@ function _get_b2() { return _get_b(this); } (() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 6, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [dec, 6, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 6, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [[0, dec], 6, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js index 63f85787b96d..b822ec929a9d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js @@ -22,7 +22,7 @@ class Foo { } } (() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 6, "a"], [[0, dec], 6, "b"], [[0, dec], 6, _computedKey]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js index 5896a742b32b..863a4e0980f5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a", o => o.#A, (o, v) => o.#A = v], [dec, 1, "b", o => o.#B, (o, v) => o.#B = v]], [], _ => #a in _).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 1, "a", o => o.#A, (o, v) => o.#A = v], [[0, dec], 1, "b", o => o.#B, (o, v) => o.#B = v]], [], _ => #a in _).e; } #A = (_initProto(this), _init_a(this)); set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js index c8dd2991237c..9ce1efaee312 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 1, "a"], [[0, dec], 1, "b"], [[0, dec], 1, _computedKey]], []).e; } #A = (_initProto(this), _init_a(this)); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js index ec458f4bddd2..5e85f7271639 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 6, "a", o => o.#A, (o, v) => o.#A = v], [dec, 6, "b", o => o.#B, (o, v) => o.#B = v]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 6, "a", o => o.#A, (o, v) => o.#A = v], [[0, dec], 6, "b", o => o.#B, (o, v) => o.#B = v]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js index 6d2b1c034626..fe6f5da9582b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 6, "a"], [[0, dec], 6, "b"], [[0, dec], 6, _computedKey]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js index da70eb6e4869..1015d11e6670 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js index 6864ac68019a..8165174092d6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "x", function () { return Bar.prototype.foo.call(this); }]], [], _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js index c63319616a0a..739f7edf174f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "x", function () { return Bar.prototype.foo.call(this); }]], [], _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js index 7e214c498427..2be3bf7ffc09 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js @@ -14,5 +14,5 @@ class C { ({ e: [_init_m], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[memberDec, 0, "m"]], [classDec])); +} = babelHelpers.applyDecs2303(C, [[[0, memberDec], 0, "m"]], [0, classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js index b20c78d9814b..a7c00643e7b4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js @@ -15,5 +15,5 @@ class C { ({ e: [_initProto], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[memberDec, 2, "m"]], [classDec])); +} = babelHelpers.applyDecs2303(C, [[[0, memberDec], 2, "m"]], [0, classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js index 99799da63d68..df1aa1149f72 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js @@ -6,7 +6,7 @@ const A = (new (_temp = class extends babelHelpers.identity { } }, (() => { class A {} - [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [0, dec]).c; })(), _temp)(), _A); const B = (new (_temp2 = class extends babelHelpers.identity { constructor() { @@ -14,7 +14,7 @@ const B = (new (_temp2 = class extends babelHelpers.identity { } }, (() => { class C {} - [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [0, dec]).c; })(), _temp2)(), _C); const D = (new (_temp3 = class extends babelHelpers.identity { constructor() { @@ -22,32 +22,32 @@ const D = (new (_temp3 = class extends babelHelpers.identity { } }, (() => { class D {} - [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [0, dec]).c; })(), _temp3)(), _D); const E = ((new (_temp4 = class extends babelHelpers.identity { constructor() { super(_decorated_class), (() => {})(), _initClass4(); } -}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [dec]).c), _temp4)(), _decorated_class), 123); +}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [0, dec]).c), _temp4)(), _decorated_class), 123); const F = [(new (_temp5 = class extends babelHelpers.identity { constructor() { super(_G), (() => {})(), _initClass5(); } }, (() => { class G {} - [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [0, dec]).c; })(), _temp5)(), _G), (new (_temp6 = class extends babelHelpers.identity { constructor() { super(_decorated_class2), (() => {})(), _initClass6(); } -}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [dec]).c), _temp6)(), _decorated_class2)]; +}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [0, dec]).c), _temp6)(), _decorated_class2)]; const H = (new (_temp7 = class extends babelHelpers.identity { constructor() { super(_H), (() => {})(), _initClass7(); } }, (() => { class H extends I {} - [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [0, dec]).c; })(), _temp7)(), _H); const J = (new (_temp8 = class extends babelHelpers.identity { constructor() { @@ -55,7 +55,7 @@ const J = (new (_temp8 = class extends babelHelpers.identity { } }, (() => { class K extends L {} - [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [0, dec]).c; })(), _temp8)(), _K); function classFactory() { var _initClass9, _decorated_class3, _temp9, _class5; @@ -63,5 +63,5 @@ function classFactory() { constructor() { super(_decorated_class3), (() => {})(), _initClass9(); } - }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [dec]).c), _temp9)(), _decorated_class3; + }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [0, dec]).c), _temp9)(), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js index 0fba5b7a4a85..381a43e64a8e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js @@ -1,13 +1,13 @@ var _initClass, _A, _class, _initClass2, _C, _class2, _initClass3, _D, _class3, _initClass4, _decorated_class, _class4, _initClass5, _G, _class5, _initClass6, _decorated_class2, _class6, _initClass7, _H, _class7, _initClass8, _K, _class8; const dec = () => {}; -const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _A); -const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [dec]).c, _initClass2()), _C); -const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [dec]).c, _initClass3()), _D); -const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [dec]).c, _initClass4()), _decorated_class), 123); -const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [dec]).c, _initClass6()), _decorated_class2)]; -const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [dec]).c, _initClass7()), _H); -const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [dec]).c, _initClass8()), _K); +const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [0, dec]).c, _initClass()), _A); +const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [0, dec]).c, _initClass2()), _C); +const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [0, dec]).c, _initClass3()), _D); +const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [0, dec]).c, _initClass4()), _decorated_class), 123); +const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [0, dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [0, dec]).c, _initClass6()), _decorated_class2)]; +const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [0, dec]).c, _initClass7()), _H); +const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [0, dec]).c, _initClass8()), _K); function classFactory() { var _initClass9, _decorated_class3, _class9; - return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [dec]).c, _initClass9()), _decorated_class3; + return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [0, dec]).c, _initClass9()), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js index d975b8c90b39..5e4a57c6c8db 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js @@ -3,9 +3,9 @@ const dec1 = () => {}; const dec2 = () => {}; let _Bar; class Bar {} -[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [dec1]).c; +[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [0, dec1]).c; _initClass(); let _Foo; class Foo extends _Bar {} -[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [dec2]).c; +[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [0, dec2]).c; _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js index 0da569b21815..2460dba86a08 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js @@ -7,7 +7,7 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; })(), _temp)(); let _Bar; new (_temp2 = class extends babelHelpers.identity { @@ -18,5 +18,5 @@ new (_temp2 = class extends babelHelpers.identity { } }, (() => { class Bar extends _Foo {} - [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [0, dec]).c; })(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js index b640a010c1a9..5c6b52e7c6d2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -16,6 +16,6 @@ new (_x = /*#__PURE__*/new WeakMap(), _m = /*#__PURE__*/new WeakSet(), (_temp = class Foo { static m() {} } - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; })(), _temp))(); function _m2() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js index 3e9c496a2f5b..9e9670897116 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js @@ -11,5 +11,5 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; })(), _temp)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js index ba5b7da737a3..f8ff1791ebc5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js @@ -4,5 +4,5 @@ const Foo = ((_class = class Bar { constructor() { babelHelpers.defineProperty(this, "bar", new _Bar()); } -}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _Bar); +}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [0, dec]).c, _initClass()), _Bar); const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js index ea526413bad4..38c8f76c003f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js @@ -7,6 +7,6 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; })(), _temp)(); const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js index 439521f4f065..eb7079a1cf6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_init_m], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[memberDec, 0, "m"]], [classDec])); + } = babelHelpers.applyDecs2303(this, [[[0, memberDec], 0, "m"]], [0, classDec])); } m = _init_m(this); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js index e9b3ade00991..01a495a1910d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[memberDec, 2, "m"]], [classDec])); + } = babelHelpers.applyDecs2303(this, [[[0, memberDec], 2, "m"]], [0, classDec])); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js index 3c1e27d025f1..8ad6ff736d9b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js @@ -4,7 +4,7 @@ const A = (new class extends babelHelpers.identity { static { class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -16,7 +16,7 @@ const B = (new class extends babelHelpers.identity { static { class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -28,7 +28,7 @@ const D = (new class extends babelHelpers.identity { static { class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -40,7 +40,7 @@ const E = ((new class extends babelHelpers.identity { static { (class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } }); } @@ -52,7 +52,7 @@ const F = [(new class extends babelHelpers.identity { static { class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -63,7 +63,7 @@ const F = [(new class extends babelHelpers.identity { static { (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } }); } @@ -75,7 +75,7 @@ const H = (new class extends babelHelpers.identity { static { class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -87,7 +87,7 @@ const J = (new class extends babelHelpers.identity { static { class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -101,7 +101,7 @@ function classFactory() { static { (class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } }); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js index 29db6d8050d3..ba43e110e5e5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-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.applyDecs2303(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass(); @@ -10,7 +10,7 @@ const A = (class A { }, _A); const B = (class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass2(); @@ -18,7 +18,7 @@ const B = (class C { }, _C); const D = (class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass3(); @@ -26,7 +26,7 @@ const D = (class D { }, _D); const E = ((class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass4(); @@ -34,14 +34,14 @@ const E = ((class { }, _decorated_class), 123); const F = [(class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass5(); } }, _G), (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass6(); @@ -49,7 +49,7 @@ const F = [(class G { }, _decorated_class2)]; const H = (class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass7(); @@ -57,7 +57,7 @@ const H = (class H extends I { }, _H); const J = (class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass8(); @@ -67,7 +67,7 @@ function classFactory() { var _initClass9, _decorated_class3; return class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static { _initClass9(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js index aa47aff8ef04..5c9d3831abcc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js @@ -4,7 +4,7 @@ let _Bar; _dec = dec1; class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; } static { _initClass(); @@ -14,7 +14,7 @@ let _Foo; _dec2 = dec2; class Foo extends _Bar { static { - [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [_dec2]).c; + [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, _dec2]).c; } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js index eecf942bf26e..33f809421c7f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } @@ -19,7 +19,7 @@ new class extends babelHelpers.identity { static { class Bar extends _Foo { static { - [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js index 32335a927df2..a6ba56a4418c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-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.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } static m() {} } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js index e187fdb62453..999e6fcbf8ba 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js index 771c60816010..dea1f930346a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js @@ -2,7 +2,7 @@ var _initClass, _Bar; const dec = () => {}; const Foo = (class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } bar = new _Bar(); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js index 7b4c9179c1c6..9024d0717359 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 7ddef3be40d9..71a68b04d0ce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 9c9448835538..8bf48446759b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js index adc3006a8190..09b81628f8ca 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js @@ -8,4 +8,4 @@ class Foo { return 1; } } -[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; +[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 0, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js index 3fe80ca58e17..cf4eae2ffb91 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -11,4 +11,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 2, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js index b409741c95c1..d7f14131095b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js @@ -4,7 +4,7 @@ _computedKey = getKey(); _computedKey2 = getKey(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js index 00bd162f0999..6d481fcdba41 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js @@ -4,7 +4,7 @@ _computedKey = getKeyI(); _computedKey2 = getKeyJ(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js index 53f2911d5016..bbc222972f0c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js @@ -2,7 +2,7 @@ var _init_a, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; + [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 0, "a"]], []).e; } a = (_initProto(this), _init_a(this, 123)); a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js index 427a72d2aaf6..1d2971f1940b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 2, "a"]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs index 27714fc7f865..45065646e2b9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs index 4e00a527e4ec..2fe3d6b69479 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs @@ -3,7 +3,7 @@ let _default2; _dec = dec; class _default { static { - [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs index 6a95338049fa..5242aa384405 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs @@ -2,7 +2,7 @@ var _dec, _init_x; _dec = dec; export class A { static { - [_init_x] = babelHelpers.applyDecs2303(this, [[_dec, 0, "x"]], []).e; + [_init_x] = babelHelpers.applyDecs2303(this, [[[0, _dec], 0, "x"]], []).e; } x = _init_x(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs index ccec1e265258..adabea42b18f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js index 5de804650b96..87e2749469ce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js @@ -14,4 +14,4 @@ class Foo { }); } } -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], _ => _b.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [[0, dec], 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js index a022b9921fcb..7e5e55b76130 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js @@ -8,4 +8,4 @@ class Foo { babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); } } -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 0, "a"], [[0, dec], 0, "b"], [[0, dec], 0, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js index 0378f626ea36..63fb9c0b2bae 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js @@ -1,7 +1,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo {} -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 5, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [dec, 5, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 5, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [[0, dec], 5, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; var _a = { writable: true, value: _init_a(Foo) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js index 6fa9904d9915..96821176f64f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b, _computedKey, _init_computedKey; const dec = () => {}; _computedKey = 'c'; class Foo {} -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 5, "a"], [[0, dec], 5, "b"], [[0, dec], 5, _computedKey]], []).e; babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js index dfdeceece86a..750020507262 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[dec, 0, "a", o => o.#a, (o, v) => o.#a = v], [dec, 0, "b", o => o.#b, (o, v) => o.#b = v]], [], _ => #b in _).e; + [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[[0, dec], 0, "a", o => o.#a, (o, v) => o.#a = v], [[0, dec], 0, "b", o => o.#b, (o, v) => o.#b = v]], [], _ => #b in _).e; } #a = _init_a(this); #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js index d654f2719616..c726513f8da7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[0, dec], 0, "a"], [[0, dec], 0, "b"], [[0, dec], 0, _computedKey]], []).e; } a = _init_a(this); b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js index 1fd091e9e106..d64b9c6b86b9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[dec, 5, "a", o => o.#a, (o, v) => o.#a = v], [dec, 5, "b", o => o.#b, (o, v) => o.#b = v]], []).e; + [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[[0, dec], 5, "a", o => o.#a, (o, v) => o.#a = v], [[0, dec], 5, "b", o => o.#b, (o, v) => o.#b = v]], []).e; } static #a = _init_a(this); static #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js index 90223a91b117..e44ae0faa01b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[0, dec], 5, "a"], [[0, dec], 5, "b"], [[0, dec], 5, _computedKey]], []).e; } static a = _init_a(this); static b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js index 9b0c155a0369..94ac5a6b4da7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _get_a() { return _call_a(this); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a", function () { return this.value; }]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js index 763867651958..4e0141b976d2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a"], [[0, dec], 3, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js index 123c5f4c6f53..523b5d69fc51 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: void 0 }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js index 5f358f5991cf..f4934e1c4a7b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 8, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a"], [[0, dec], 8, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js index 046c68a14e9b..e2c5ce24372f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js @@ -23,8 +23,8 @@ function _get_a() { function _set_a(v) { _call_a2(this, v); } -[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a", function () { return this.value; -}], [dec, 4, "a", function (v) { +}], [[0, dec], 4, "a", function (v) { this.value = v; }]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js index 8d381858681b..180517ac52a8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js @@ -20,4 +20,4 @@ class Foo { this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a"], [[0, dec], 4, "a"], [[0, dec], 3, _computedKey], [[0, dec], 4, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js index d742fa356d37..9c5025fbaf8c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js @@ -19,9 +19,9 @@ var _a = { set: _set_a }; (() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a", function () { return this.value; - }], [dec, 9, "a", function (v) { + }], [[0, dec], 9, "a", function (v) { this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js index 37ee531419e0..c2c84cbeb947 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js @@ -17,7 +17,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a"], [[0, dec], 9, "a"], [[0, dec], 8, _computedKey], [[0, dec], 9, _computedKey2]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js index 46c0c9b4b885..522b660d5269 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js @@ -2,9 +2,9 @@ var _call_a, _call_a2, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a", function () { return this.value; - }], [dec, 4, "a", function (v) { + }], [[0, dec], 4, "a", function (v) { this.value = v; }]], [], _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js index 319f7189bd08..1367302379e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a"], [[0, dec], 4, "a"], [[0, dec], 3, _computedKey], [[0, dec], 4, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js index 5c210ea575f1..808f4111566e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js @@ -2,9 +2,9 @@ var _call_a, _call_a2, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a", function () { return this.value; - }], [dec, 9, "a", function (v) { + }], [[0, dec], 9, "a", function (v) { this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js index 50114f4400b2..04ca0ea03c55 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a"], [[0, dec], 9, "a"], [[0, dec], 8, _computedKey], [[0, dec], 9, _computedKey2]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js index ff26d8f468f4..030c3593dc6b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a", function () { return this.value; }]], [], _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js index f9255dccc6ec..9c86ed9b52a5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a"], [[0, dec], 3, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js index 839a0bc60ffc..7ddc3df3f780 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js index 08b8044e1d50..53a3b1b839f3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 8, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a"], [[0, dec], 8, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js index ce2bf1b28264..889f8cec63bd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js @@ -14,6 +14,6 @@ class Foo { return babelHelpers.classPrivateFieldGet(this, _a).call(this); } } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a", function () { return this.value; }]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js index 570adc92fb1a..7d7014b6e493 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 2, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js index ffada9380550..ed1a37ada8a7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js @@ -6,7 +6,7 @@ class Foo { } } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 7, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 7, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js index 673eb9a464d6..d4b1a1fb09e9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 7, "a"], [dec, 7, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 7, "a"], [[0, dec], 7, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js index b455e2693f87..bb4cd1084e2f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a", function () { return this.value; }]], [], _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js index ecb55e9ba21f..fa65a5326ff5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 2, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js index acfa495bcdbc..874783046b5e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 7, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js index 1f5b6f3b8759..1b3629944fce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 7, "a"], [dec, 7, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "a"], [[0, dec], 7, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js index 41f3d5c3604b..c8722f4efdf0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -9,4 +9,4 @@ class A extends B { } method() {} } -[_initProto] = babelHelpers.applyDecs2303(A, [[_dec, 2, "method"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(A, [[[0, _dec], 2, "method"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js index a9557b7dce63..d78ae30ecd7e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js @@ -1,14 +1,16 @@ -var _initClass, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _initProto; +var _initClass, _dec, _dec2, _dec3, _obj, _dec4, _dec5, _dec6, _dec7, _obj2, _dec8, _initProto; const dec = () => {}; let _Foo; _dec = call(); _dec2 = chain.expr(); _dec3 = arbitrary + expr; -_dec4 = array[expr]; +_obj = array; +_dec4 = _obj[expr]; _dec5 = call(); _dec6 = chain.expr(); _dec7 = arbitrary + expr; -_dec8 = array[expr]; +_obj2 = array; +_dec8 = _obj2[expr]; var _a = /*#__PURE__*/new WeakMap(); class Foo { constructor(...args) { @@ -25,11 +27,11 @@ class Foo { constructor() { babelHelpers.defineProperty(this, "bar", _init_bar(this)); } - }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[_dec9, 0, "bar"]], []).e, _class); + }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[[0, _dec9], 0, "bar"]], []).e, _class); } } ({ e: [_initProto], c: [_Foo, _initClass] -} = babelHelpers.applyDecs2303(Foo, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4])); +} = babelHelpers.applyDecs2303(Foo, [[[1, void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 2, "method"]], [1, void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js index ddf2ed3d2c62..91cced17103e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_n, _init_a, _init_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2303(this, [[dec, 7, "j"], [dec, 8, "k"], [dec, 9, "l"], [dec, 6, "m"], [dec, 7, "o", function () {}], [dec, 8, "p", function () {}], [dec, 9, "q", function (v) {}], [dec, 6, "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, 5, "i"], [dec, 5, "n", o => o.#n, (o, v) => o.#n = v], [dec, 0, "a"], [dec, 0, "e", o => o.#e, (o, v) => o.#e = v]], [dec], _ => #e in _)); + } = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "j"], [[0, dec], 8, "k"], [[0, dec], 9, "l"], [[0, dec], 6, "m"], [[0, dec], 7, "o", function () {}], [[0, dec], 8, "p", function () {}], [[0, dec], 9, "q", function (v) {}], [[0, dec], 6, "r", o => o.#D, (o, v) => o.#D = v], [[0, dec], 2, "b"], [[0, dec], 3, "c"], [[0, dec], 4, "c"], [[0, dec], 1, "d"], [[0, dec], 2, "f", function () {}], [[0, dec], 3, "g", function () {}], [[0, dec], 4, "g", function (v) {}], [[0, dec], 1, "h", o => o.#B, (o, v) => o.#B = v], [[0, dec], 5, "i"], [[0, dec], 5, "n", o => o.#n, (o, v) => o.#n = v], [[0, dec], 0, "a"], [[0, dec], 0, "e", o => o.#e, (o, v) => o.#e = v]], [0, dec], _ => #e in _)); _initStatic(this); } #f = _call_f; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js index e90a08e474bd..0ca7056b4b0d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _dec = deco; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[_dec, 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, _dec], 2, "method"]], []).e; } constructor() { if (Math.random() > 0.5) { @@ -17,7 +17,7 @@ class A extends B { _dec2 = deco; class C extends B { static { - [_initProto2] = babelHelpers.applyDecs2303(this, [[_dec2, 2, "method"]], []).e; + [_initProto2] = babelHelpers.applyDecs2303(this, [[[0, _dec2], 2, "method"]], []).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js index e20913dffe63..ef3121a5b656 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "method"]], []).e; } constructor() { let a = 2; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js index da70eb6e4869..1015d11e6670 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js index 3f622864ec2d..45eafd4fa0a9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js index 849f2d54e54f..c94ae53322f5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js index 54ae1fd38f96..e43ff08dfbf1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js @@ -1,20 +1,22 @@ -var _initClass, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _initProto; +var _initClass, _dec, _dec2, _dec3, _obj, _dec4, _dec5, _dec6, _dec7, _obj2, _dec8, _initProto; const dec = () => {}; let _Foo; _dec = call(); _dec2 = chain.expr(); _dec3 = arbitrary + expr; -_dec4 = array[expr]; +_obj = array; +_dec4 = _obj[expr]; _dec5 = call(); _dec6 = chain.expr(); _dec7 = arbitrary + expr; -_dec8 = array[expr]; +_obj2 = array; +_dec8 = _obj2[expr]; class Foo { static { ({ e: [_initProto], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2303(this, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4])); + } = babelHelpers.applyDecs2303(this, [[[1, void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 2, "method"]], [1, void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4])); } constructor(...args) { _initProto(this); @@ -22,10 +24,10 @@ class Foo { #a; method() {} makeClass() { - var _dec9, _init_bar; - return _dec9 = this.#a, class Nested { + var _obj3, _dec9, _init_bar; + return _obj3 = this, _dec9 = _obj3.#a, class Nested { static { - [_init_bar] = babelHelpers.applyDecs2303(this, [[_dec9, 0, "bar"]], []).e; + [_init_bar] = babelHelpers.applyDecs2303(this, [[[1, _obj3, _dec9], 0, "bar"]], []).e; } bar = _init_bar(this); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js index c5293d4c9980..424dcee16130 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _set_a(v) { _call_a(this, v); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a", function (v) { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 4, "a", function (v) { return this.value = v; }]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js index 48da3f7bfcfb..bd594ebc5bd4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 4, "a"], [[0, dec], 4, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js index 3d8caceaa7a5..8155c28781dd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: _set_a }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 9, "a", function (v) { return this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js index 4b5afa5e10de..986ba5639b7b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a"], [dec, 9, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 9, "a"], [[0, dec], 9, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js index f4020f172e07..681556c1be0d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a", function (v) { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 4, "a", function (v) { return this.value = v; }]], [], _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js index 5fea5ec2b8cb..e97ff8a407fe 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 4, "a"], [[0, dec], 4, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js index df9d68208bf7..6b90b55d4540 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 9, "a", function (v) { return this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js index e55c604c3434..9f9eb50508b3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a"], [dec, 9, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 9, "a"], [[0, dec], 9, _computedKey]], []).e; _initStatic(this); } static value = 1; From 1f566b88aaebd614371da78d7b3a26aaf97777cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sun, 16 Apr 2023 14:36:09 +0200 Subject: [PATCH 07/15] Fix static accessors with subclasses --- .../src/transformer-2023-03.ts | 27 ++++++++++++++++--- .../static-public-this/exec.js | 12 +++++++++ .../static-public/output.js | 12 ++++----- .../undecorated-static-private/output.js | 8 +++--- .../undecorated-static-public/output.js | 12 ++++----- .../static-public-inherited/exec.js | 12 +++++++++ .../static-public-inherited/options.json | 3 +++ .../2023-03-accessors/static-public/output.js | 12 ++++----- .../undecorated-static-private/output.js | 8 +++--- .../undecorated-static-public/output.js | 12 ++++----- .../2023-03-misc/all-decorators/output.js | 4 +-- .../fixtures/2023-03-misc/this/options.json | 3 +++ 12 files changed, 87 insertions(+), 38 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index 6f152f362632..5738f6d8112f 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -165,16 +165,21 @@ function generateClassProperty( } function addProxyAccessorsFor( + className: t.Identifier, element: NodePath, originalKey: t.PrivateName | t.Expression, targetKey: t.PrivateName, + version: DecoratorVersionKind, isComputed = false, ): void { const { static: isStatic } = element.node; + const thisArg = + version === "2023-03" && isStatic ? className : t.thisExpression(); + const getterBody = t.blockStatement([ t.returnStatement( - t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)), + t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)), ), ]); @@ -182,7 +187,7 @@ function addProxyAccessorsFor( t.expressionStatement( t.assignmentExpression( "=", - t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)), + t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)), t.identifier("v"), ), ), @@ -538,7 +543,14 @@ function transformClass( const newField = generateClassProperty(newId, valueNode, isStatic); const [newPath] = element.replaceWith(newField); - addProxyAccessorsFor(newPath, key, newId, computed); + addProxyAccessorsFor( + path.node.id, + newPath, + key, + newId, + version, + computed, + ); } } @@ -698,7 +710,14 @@ function transformClass( locals = [newFieldInitId, getId, setId]; } else { - addProxyAccessorsFor(newPath, key, newId, isComputed); + addProxyAccessorsFor( + path.node.id, + newPath, + key, + newId, + version, + isComputed, + ); locals = newFieldInitId; } } else if (kind === FIELD) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js new file mode 100644 index 000000000000..e981fac69393 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js @@ -0,0 +1,12 @@ +// https://github.com/tc39/proposal-decorators/issues/468 + +class A { + static accessor x; + + @(() => {}) static accessor y; +} + +class B extends A {} + +expect(() => B.x).not.toThrow(); +expect(() => B.y).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js index b822ec929a9d..2a86080e3545 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js @@ -3,22 +3,22 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static get a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _A); } static set a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _A, v); } static get b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _B); } static set b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _B, v); } static get [_computedKey]() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _C); } static set [_computedKey](v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _C, v); } } (() => { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js index ab3a0e1b2678..a4d71f4cc5a1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js @@ -1,16 +1,16 @@ const dec = () => {}; class Foo {} function _get_a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _A); } function _set_a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _A, v); } function _get_b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _B); } function _set_b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _B, v); } var _b = { get: _get_b, diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js index 5041e9a95d6e..ea1636ad8321 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js @@ -1,22 +1,22 @@ const dec = () => {}; class Foo { static get a() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _A); } static set a(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _A, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _A, v); } static get b() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _B); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _B); } static set b(v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _B, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _B, v); } static get ['c']() { - return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _C); + return babelHelpers.classStaticPrivateFieldSpecGet(Foo, Foo, _C); } static set ['c'](v) { - babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _C, v); + babelHelpers.classStaticPrivateFieldSpecSet(Foo, Foo, _C, v); } } var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js new file mode 100644 index 000000000000..e981fac69393 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js @@ -0,0 +1,12 @@ +// https://github.com/tc39/proposal-decorators/issues/468 + +class A { + static accessor x; + + @(() => {}) static accessor y; +} + +class B extends A {} + +expect(() => B.x).not.toThrow(); +expect(() => B.y).not.toThrow(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json new file mode 100644 index 000000000000..f97653393918 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js index fe6f5da9582b..9db071fbeee2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js @@ -8,23 +8,23 @@ class Foo { } static #A = _init_a(this); static get a() { - return this.#A; + return Foo.#A; } static set a(v) { - this.#A = v; + Foo.#A = v; } static #B = _init_b(this, 123); static get b() { - return this.#B; + return Foo.#B; } static set b(v) { - this.#B = v; + Foo.#B = v; } static #C = _init_computedKey(this, 456); static get [_computedKey]() { - return this.#C; + return Foo.#C; } static set [_computedKey](v) { - this.#C = v; + Foo.#C = v; } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js index 9268d8a99d07..7c864b31413f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js @@ -2,16 +2,16 @@ const dec = () => {}; class Foo { static #A; static get #a() { - return this.#A; + return Foo.#A; } static set #a(v) { - this.#A = v; + Foo.#A = v; } static #B = 123; static get #b() { - return this.#B; + return Foo.#B; } static set #b(v) { - this.#B = v; + Foo.#B = v; } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js index 32b5ee6911b8..dc2012f8012f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js @@ -2,23 +2,23 @@ const dec = () => {}; class Foo { static #A; static get a() { - return this.#A; + return Foo.#A; } static set a(v) { - this.#A = v; + Foo.#A = v; } static #B = 123; static get b() { - return this.#B; + return Foo.#B; } static set b(v) { - this.#B = v; + Foo.#B = v; } static #C = 456; static get ['c']() { - return this.#C; + return Foo.#C; } static set ['c'](v) { - this.#C = v; + Foo.#C = v; } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js index 91cced17103e..91b5c479fb54 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js @@ -41,10 +41,10 @@ new class extends babelHelpers.identity { static get k() {} static set l(v) {} static get m() { - return this.#C; + return Class.#C; } static set m(v) { - this.#C = v; + Class.#C = v; } set #r(v) { _set_r(this, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json new file mode 100644 index 000000000000..f97653393918 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "16.11.0" +} From c46b609ef54c6756475e5bb00d1b926215ec1df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sun, 16 Apr 2023 22:07:34 +0200 Subject: [PATCH 08/15] Fix super in decorators --- .../src/transformer-2023-03.ts | 15 ++++++++--- .../super-in-decorator/input.js | 9 +++++++ .../super-in-decorator/output.js | 21 ++++++++++++++++ .../2023-03-misc/super-in-decorator/input.js | 9 +++++++ .../2023-03-misc/super-in-decorator/output.js | 25 +++++++++++++++++++ .../valid-expression-formats/output.js | 2 +- 6 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index 5738f6d8112f..ff0075a2ba1d 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -585,10 +585,19 @@ function transformClass( const maybeExtractDecorator = (decorator: t.Decorator) => { const { expression } = decorator; if (version === "2023-03" && t.isMemberExpression(expression)) { - if (!scopeParent.isStatic(expression)) { - expression.object = memoiseExpression(expression.object, "obj"); + let object; + if ( + t.isSuper(expression.object) || + t.isThisExpression(expression.object) + ) { + object = memoiseExpression(t.thisExpression(), "obj"); + } else if (!scopeParent.isStatic(expression.object)) { + object = memoiseExpression(expression.object, "obj"); + expression.object = object; + } else { + object = expression.object; } - decoratorsThis.set(decorator, t.cloneNode(expression.object)); + decoratorsThis.set(decorator, t.cloneNode(object)); } if (!scopeParent.isStatic(expression)) { decorator.expression = memoiseExpression(expression, "dec"); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js new file mode 100644 index 000000000000..7e75b7766176 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js @@ -0,0 +1,9 @@ +class A extends B { + m() { + @(super.dec1) + class C { + @(super.dec2) + m2() {} + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js new file mode 100644 index 000000000000..362f72e318f6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js @@ -0,0 +1,21 @@ +class A extends B { + m() { + var _initClass, _obj, _dec, _obj2, _dec2, _initProto; + let _C; + _obj = this; + _dec = super.dec1; + _obj2 = this; + _dec2 = super.dec2; + class C { + constructor(...args) { + _initProto(this); + } + m2() {} + } + ({ + e: [_initProto], + c: [_C, _initClass] + } = babelHelpers.applyDecs2303(C, [[[1, _obj2, _dec2], 2, "m2"]], [1, _obj, _dec])); + _initClass(); + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js new file mode 100644 index 000000000000..7e75b7766176 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js @@ -0,0 +1,9 @@ +class A extends B { + m() { + @(super.dec1) + class C { + @(super.dec2) + m2() {} + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js new file mode 100644 index 000000000000..9e0efc55f199 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js @@ -0,0 +1,25 @@ +class A extends B { + m() { + var _initClass, _obj, _dec, _obj2, _dec2, _initProto; + let _C; + _obj = this; + _dec = super.dec1; + _obj2 = this; + _dec2 = super.dec2; + class C { + static { + ({ + e: [_initProto], + c: [_C, _initClass] + } = babelHelpers.applyDecs2303(this, [[[1, _obj2, _dec2], 2, "m2"]], [1, _obj, _dec])); + } + constructor(...args) { + _initProto(this); + } + m2() {} + static { + _initClass(); + } + } + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js index e43ff08dfbf1..3ed7702e9847 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js @@ -25,7 +25,7 @@ class Foo { method() {} makeClass() { var _obj3, _dec9, _init_bar; - return _obj3 = this, _dec9 = _obj3.#a, class Nested { + return _obj3 = this, _dec9 = this.#a, class Nested { static { [_init_bar] = babelHelpers.applyDecs2303(this, [[[1, _obj3, _dec9], 0, "bar"]], []).e; } From 81b737340e4c7aa8f88b762173eb56f3b0f5793c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 17 Apr 2023 18:30:26 +0200 Subject: [PATCH 09/15] Pack new flag with the others --- .../babel-helpers/src/helpers-generated.ts | 2 +- .../src/helpers/applyDecs2303.js | 36 +++++++------- .../src/transformer-2023-03.ts | 48 ++++++++++++------- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-accessors/private/output.js | 2 +- .../2023-03-accessors/public/output.js | 2 +- .../static-private/output.js | 2 +- .../2023-03-accessors/static-public/output.js | 2 +- .../output.js | 2 +- .../super-in-private-accessor/output.js | 4 +- .../super-in-private-method/output.js | 4 +- .../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 +- .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/output.js | 2 +- .../replacement/output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../expressions-static-blocks/output.js | 18 +++---- .../2023-03-classes/expressions/output.js | 18 +++---- .../2023-03-classes/inheritance/output.js | 4 +- .../2023-03-classes/initializers/output.js | 4 +- .../output.js | 2 +- .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/output.js | 2 +- .../2023-03-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-03-exported/default-named/output.mjs | 2 +- .../member-decorator/output.mjs | 2 +- .../2023-03-exported/named/output.mjs | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../fixtures/2023-03-fields/private/output.js | 2 +- .../fixtures/2023-03-fields/public/output.js | 2 +- .../2023-03-fields/static-private/output.js | 2 +- .../2023-03-fields/static-public/output.js | 2 +- .../private/output.js | 4 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../private/output.js | 6 +-- .../public/output.js | 2 +- .../static-private/output.js | 4 +- .../static-public/output.js | 2 +- .../private/output.js | 6 +-- .../public/output.js | 2 +- .../static-private/output.js | 4 +- .../static-public/output.js | 2 +- .../2023-03-getters/private/output.js | 4 +- .../fixtures/2023-03-getters/public/output.js | 2 +- .../2023-03-getters/static-private/output.js | 2 +- .../2023-03-getters/static-public/output.js | 2 +- .../private/output.js | 4 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-methods/private/output.js | 4 +- .../fixtures/2023-03-methods/public/output.js | 2 +- .../2023-03-methods/static-private/output.js | 2 +- .../2023-03-methods/static-public/output.js | 2 +- .../output.js | 2 +- .../super-in-decorator/output.js | 2 +- .../2023-03-misc--to-es2015/this/output.js | 2 +- .../valid-expression-formats/output.js | 4 +- .../2023-03-misc/all-decorators/output.js | 2 +- .../output.js | 4 +- .../output.js | 2 +- .../2023-03-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-03-misc/this/output.js | 2 +- .../valid-expression-formats/output.js | 4 +- .../private/output.js | 4 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-setters/private/output.js | 4 +- .../fixtures/2023-03-setters/public/output.js | 2 +- .../2023-03-setters/static-private/output.js | 2 +- .../2023-03-setters/static-public/output.js | 2 +- 99 files changed, 202 insertions(+), 184 deletions(-) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 78985a05fcd6..453546618ac2 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -39,7 +39,7 @@ export default Object.freeze({ ), applyDecs2303: helper( "7.21.0", - 'import checkInRHS from"checkInRHS";function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){assertNotFinished(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,thisArg,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec.call(thisArg,value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertNotFinished(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":10===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis1(fn){return function(){return fn(this)}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,newValue,get,set,decs=decInfo[0];isPrivate?desc=0===kind||1===kind?{get:curryThis1(decInfo[3]),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set);for(var hasThis=1===decs[0],inc=hasThis?2:1,i=decs.length-1;i>=1;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],hasThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,hasThis=1===classDecs[0],inc=hasThis?2:1,i=classDecs.length-1;i>=1;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(hasThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,inc=decoratorsHaveThis?2:1,i=classDecs.length-1;i>=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i= 1; i -= inc) { + for (var i = decs.length - 1; i >= 0; i -= inc) { var dec = decs[i]; newValue = memberDec( dec, - hasThis ? decs[i - 1] : undefined, + decoratorsHaveThis ? decs[i - 1] : undefined, name, desc, initializers, @@ -383,14 +384,16 @@ function applyMemberDecs(Class, decInfos, instanceBrand) { var name = decInfo[2]; var isPrivate = decInfo.length > 3; - var isStatic = kind >= 5; /* STATIC */ + var decoratorsHaveThis = kind & 16; /* DECORATORS_HAVE_THIS */ + var isStatic = !!(kind & 8); /* STATIC */ var base; var initializers; var hasPrivateBrand = instanceBrand; + kind &= 7 /* 0b111 */; + if (isStatic) { base = Class; - kind = kind - 5 /* STATIC */; // initialize staticInitializers when we see a non-field static member if (kind !== 0 /* FIELD */) { staticInitializers = staticInitializers || []; @@ -438,6 +441,7 @@ function applyMemberDecs(Class, decInfos, instanceBrand) { ret, base, decInfo, + decoratorsHaveThis, name, kind, isStatic, @@ -463,21 +467,20 @@ function pushInitializers(ret, initializers) { } } -function applyClassDecs(targetClass, classDecs) { +function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) { if (classDecs.length > 0) { var initializers = []; var newClass = targetClass; var name = targetClass.name; - var hasThis = classDecs[0] === 1; - var inc = hasThis ? 2 : 1; + var inc = decoratorsHaveThis ? 2 : 1; - for (var i = classDecs.length - 1; i >= 1; i -= inc) { + for (var i = classDecs.length - 1; i >= 0; i -= inc) { var decoratorFinishedRef = { v: false }; try { var nextNewClass = classDecs[i].call( - hasThis ? classDecs[i - 1] : undefined, + decoratorsHaveThis ? classDecs[i - 1] : undefined, newClass, { kind: "class", @@ -493,7 +496,7 @@ function applyClassDecs(targetClass, classDecs) { } if (nextNewClass !== undefined) { - assertValidReturnValue(10 /* CLASS */, nextNewClass); + assertValidReturnValue(5 /* CLASS */, nextNewClass); newClass = nextNewClass; } } @@ -661,13 +664,14 @@ export default function applyDecs2303( targetClass, memberDecs, classDecs, + classDecsHaveThis, instanceBrand ) { return { e: applyMemberDecs(targetClass, memberDecs, instanceBrand), // Lazily apply class decorations so that member init locals can be properly bound. get c() { - return applyClassDecs(targetClass, classDecs); + return applyClassDecs(targetClass, classDecs, classDecsHaveThis); }, }; } diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index ff0075a2ba1d..0a26c99610c1 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -262,13 +262,16 @@ function extractProxyAccessorsFor( ]; } +// 3 bits reserved to this (0-7) const FIELD = 0; const ACCESSOR = 1; const METHOD = 2; const GETTER = 3; const SETTER = 4; -const STATIC = 5; +const STATIC_OLD_VERSION = 5; // Before 2023-03 +const STATIC = 8; // 1 << 3 +const DECORATORS_HAVE_THIS = 16; // 1 << 3 function getElementKind(element: NodePath): number { switch (element.node.type) { @@ -360,10 +363,7 @@ function generateDecorationList( decs.push(decorators[i]); } - if (version === "2023-03") { - decs.unshift(t.numericLiteral(hasOneThis ? 1 : 0)); - } - return decs; + return { hasThis: hasOneThis, decs }; } function generateDecorationExprs( @@ -372,16 +372,23 @@ function generateDecorationExprs( ): t.ArrayExpression { return t.arrayExpression( filteredOrderedDecoratorInfo(info).map(el => { - const decs = generateDecorationList( + const { decs, hasThis } = generateDecorationList( el.decorators, el.decoratorsThis, version, ); + + let flag = el.kind; + if (el.isStatic) { + flag += version === "2023-03" ? STATIC : STATIC_OLD_VERSION; + } + if (hasThis) flag += DECORATORS_HAVE_THIS; + return t.arrayExpression([ version !== "2023-03" && decs.length === 1 ? decs[0] : t.arrayExpression(decs), - t.numericLiteral(el.isStatic ? el.kind + STATIC : el.kind), + t.numericLiteral(flag), el.name, ...(el.privateMethods || []), ]); @@ -852,15 +859,17 @@ function transformClass( elementDecoratorInfo, version, ); - const classDecorations = t.arrayExpression( - classDecorators - ? generateDecorationList( - classDecorators.map(el => el.expression), - classDecorators.map(dec => decoratorsThis.get(dec)), - version, - ) - : [], - ); + let classDecorationsFlag = 0; + let classDecorations: t.Expression[] = []; + if (classDecorators) { + const { hasThis, decs } = generateDecorationList( + classDecorators.map(el => el.expression), + classDecorators.map(dec => decoratorsThis.get(dec)), + version, + ); + classDecorationsFlag = hasThis ? 1 : 0; + classDecorations = decs; + } const elementLocals: t.Identifier[] = extractElementLocalAssignments(elementDecoratorInfo); @@ -1070,7 +1079,8 @@ function transformClass( elementLocals, classLocals, elementDecorations, - classDecorations, + t.arrayExpression(classDecorations), + t.numericLiteral(classDecorationsFlag), needsInstancePrivateBrandCheck ? lastInstancePrivateName : null, state, version, @@ -1101,6 +1111,7 @@ function createLocalsAssignment( classLocals: t.Identifier[], elementDecorations: t.ArrayExpression, classDecorations: t.ArrayExpression, + classDecorationsFlag: t.NumericLiteral, maybePrivateBranName: t.PrivateName | null, state: PluginPass, version: DecoratorVersionKind, @@ -1124,6 +1135,9 @@ function createLocalsAssignment( } else { // TODO(Babel 8): Only keep the if branch if (version === "2023-03") { + if (maybePrivateBranName || classDecorationsFlag.value !== 0) { + args.push(classDecorationsFlag); + } if (maybePrivateBranName) { args.push( template.expression.ast` diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js index 83ab40cca0ff..fe52e85046bb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js @@ -36,4 +36,4 @@ function _set_b2(v) { function _get_b2() { return _get_b(this); } -[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [[0, dec], 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [[dec], 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js index 3c83dab4633a..5bce0150b22c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js @@ -38,4 +38,4 @@ class Foo { babelHelpers.classPrivateFieldSet(this, _C, v); } } -[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 1, "a"], [[0, dec], 1, "b"], [[0, dec], 1, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 1, "a"], [[dec], 1, "b"], [[dec], 1, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js index 10bae5b30f07..90ffa5e35289 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js @@ -27,7 +27,7 @@ function _get_b2() { return _get_b(this); } (() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 6, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [[0, dec], 6, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 9, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [[dec], 9, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js index 2a86080e3545..1d5d0992f421 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js @@ -22,7 +22,7 @@ class Foo { } } (() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 6, "a"], [[0, dec], 6, "b"], [[0, dec], 6, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 9, "a"], [[dec], 9, "b"], [[dec], 9, _computedKey]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js index 863a4e0980f5..0b6dc60e7e89 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 1, "a", o => o.#A, (o, v) => o.#A = v], [[0, dec], 1, "b", o => o.#B, (o, v) => o.#B = v]], [], _ => #a in _).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(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; } #A = (_initProto(this), _init_a(this)); set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js index 9ce1efaee312..6eaddbf76fe3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 1, "a"], [[0, dec], 1, "b"], [[0, dec], 1, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 1, "a"], [[dec], 1, "b"], [[dec], 1, _computedKey]], []).e; } #A = (_initProto(this), _init_a(this)); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js index 5e85f7271639..b212655fcbb5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 6, "a", o => o.#A, (o, v) => o.#A = v], [[0, dec], 6, "b", o => o.#B, (o, v) => o.#B = v]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 9, "a", o => o.#A, (o, v) => o.#A = v], [[dec], 9, "b", o => o.#B, (o, v) => o.#B = v]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js index 9db071fbeee2..a033c974ca33 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 6, "a"], [[0, dec], 6, "b"], [[0, dec], 6, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 9, "a"], [[dec], 9, "b"], [[dec], 9, _computedKey]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js index 1015d11e6670..da70eb6e4869 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js index 8165174092d6..a530b18a7f6d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js @@ -2,9 +2,9 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "x", function () { return Bar.prototype.foo.call(this); - }]], [], _ => #x in _).e; + }]], [], 0, _ => #x in _).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js index 739f7edf174f..b59dd576492a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js @@ -2,9 +2,9 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "x", function () { return Bar.prototype.foo.call(this); - }]], [], _ => #x in _).e; + }]], [], 0, _ => #x in _).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js index 2be3bf7ffc09..6f408d3c2f2a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js @@ -14,5 +14,5 @@ class C { ({ e: [_init_m], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[[0, memberDec], 0, "m"]], [0, classDec])); +} = babelHelpers.applyDecs2303(C, [[[memberDec], 0, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js index a7c00643e7b4..7756495b8b17 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js @@ -15,5 +15,5 @@ class C { ({ e: [_initProto], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[[0, memberDec], 2, "m"]], [0, classDec])); +} = babelHelpers.applyDecs2303(C, [[[memberDec], 2, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js index df1aa1149f72..99799da63d68 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js @@ -6,7 +6,7 @@ const A = (new (_temp = class extends babelHelpers.identity { } }, (() => { class A {} - [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [0, dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [dec]).c; })(), _temp)(), _A); const B = (new (_temp2 = class extends babelHelpers.identity { constructor() { @@ -14,7 +14,7 @@ const B = (new (_temp2 = class extends babelHelpers.identity { } }, (() => { class C {} - [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [0, dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [dec]).c; })(), _temp2)(), _C); const D = (new (_temp3 = class extends babelHelpers.identity { constructor() { @@ -22,32 +22,32 @@ const D = (new (_temp3 = class extends babelHelpers.identity { } }, (() => { class D {} - [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [0, dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [dec]).c; })(), _temp3)(), _D); const E = ((new (_temp4 = class extends babelHelpers.identity { constructor() { super(_decorated_class), (() => {})(), _initClass4(); } -}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [0, dec]).c), _temp4)(), _decorated_class), 123); +}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [dec]).c), _temp4)(), _decorated_class), 123); const F = [(new (_temp5 = class extends babelHelpers.identity { constructor() { super(_G), (() => {})(), _initClass5(); } }, (() => { class G {} - [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [0, dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [dec]).c; })(), _temp5)(), _G), (new (_temp6 = class extends babelHelpers.identity { constructor() { super(_decorated_class2), (() => {})(), _initClass6(); } -}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [0, dec]).c), _temp6)(), _decorated_class2)]; +}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [dec]).c), _temp6)(), _decorated_class2)]; const H = (new (_temp7 = class extends babelHelpers.identity { constructor() { super(_H), (() => {})(), _initClass7(); } }, (() => { class H extends I {} - [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [0, dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [dec]).c; })(), _temp7)(), _H); const J = (new (_temp8 = class extends babelHelpers.identity { constructor() { @@ -55,7 +55,7 @@ const J = (new (_temp8 = class extends babelHelpers.identity { } }, (() => { class K extends L {} - [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [0, dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [dec]).c; })(), _temp8)(), _K); function classFactory() { var _initClass9, _decorated_class3, _temp9, _class5; @@ -63,5 +63,5 @@ function classFactory() { constructor() { super(_decorated_class3), (() => {})(), _initClass9(); } - }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [0, dec]).c), _temp9)(), _decorated_class3; + }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [dec]).c), _temp9)(), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js index 381a43e64a8e..0fba5b7a4a85 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js @@ -1,13 +1,13 @@ var _initClass, _A, _class, _initClass2, _C, _class2, _initClass3, _D, _class3, _initClass4, _decorated_class, _class4, _initClass5, _G, _class5, _initClass6, _decorated_class2, _class6, _initClass7, _H, _class7, _initClass8, _K, _class8; const dec = () => {}; -const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [0, dec]).c, _initClass()), _A); -const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [0, dec]).c, _initClass2()), _C); -const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [0, dec]).c, _initClass3()), _D); -const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [0, dec]).c, _initClass4()), _decorated_class), 123); -const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [0, dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [0, dec]).c, _initClass6()), _decorated_class2)]; -const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [0, dec]).c, _initClass7()), _H); -const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [0, dec]).c, _initClass8()), _K); +const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _A); +const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [dec]).c, _initClass2()), _C); +const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [dec]).c, _initClass3()), _D); +const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [dec]).c, _initClass4()), _decorated_class), 123); +const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [dec]).c, _initClass6()), _decorated_class2)]; +const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [dec]).c, _initClass7()), _H); +const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [dec]).c, _initClass8()), _K); function classFactory() { var _initClass9, _decorated_class3, _class9; - return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [0, dec]).c, _initClass9()), _decorated_class3; + return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [dec]).c, _initClass9()), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js index 5e4a57c6c8db..d975b8c90b39 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js @@ -3,9 +3,9 @@ const dec1 = () => {}; const dec2 = () => {}; let _Bar; class Bar {} -[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [0, dec1]).c; +[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [dec1]).c; _initClass(); let _Foo; class Foo extends _Bar {} -[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [0, dec2]).c; +[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [dec2]).c; _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js index 2460dba86a08..0da569b21815 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js @@ -7,7 +7,7 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; })(), _temp)(); let _Bar; new (_temp2 = class extends babelHelpers.identity { @@ -18,5 +18,5 @@ new (_temp2 = class extends babelHelpers.identity { } }, (() => { class Bar extends _Foo {} - [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [0, dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [dec]).c; })(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js index 5c6b52e7c6d2..b640a010c1a9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -16,6 +16,6 @@ new (_x = /*#__PURE__*/new WeakMap(), _m = /*#__PURE__*/new WeakSet(), (_temp = class Foo { static m() {} } - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; })(), _temp))(); function _m2() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js index 9e9670897116..3e9c496a2f5b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js @@ -11,5 +11,5 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; })(), _temp)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js index f8ff1791ebc5..ba5b7da737a3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js @@ -4,5 +4,5 @@ const Foo = ((_class = class Bar { constructor() { babelHelpers.defineProperty(this, "bar", new _Bar()); } -}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [0, dec]).c, _initClass()), _Bar); +}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _Bar); const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js index 38c8f76c003f..ea526413bad4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js @@ -7,6 +7,6 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; })(), _temp)(); const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js index eb7079a1cf6d..276068382a89 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_init_m], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[0, memberDec], 0, "m"]], [0, classDec])); + } = babelHelpers.applyDecs2303(this, [[[memberDec], 0, "m"]], [classDec])); } m = _init_m(this); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js index 01a495a1910d..94d54e626ec2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[0, memberDec], 2, "m"]], [0, classDec])); + } = babelHelpers.applyDecs2303(this, [[[memberDec], 2, "m"]], [classDec])); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js index 8ad6ff736d9b..3c1e27d025f1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js @@ -4,7 +4,7 @@ const A = (new class extends babelHelpers.identity { static { class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -16,7 +16,7 @@ const B = (new class extends babelHelpers.identity { static { class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -28,7 +28,7 @@ const D = (new class extends babelHelpers.identity { static { class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -40,7 +40,7 @@ const E = ((new class extends babelHelpers.identity { static { (class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; } }); } @@ -52,7 +52,7 @@ const F = [(new class extends babelHelpers.identity { static { class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -63,7 +63,7 @@ const F = [(new class extends babelHelpers.identity { static { (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; } }); } @@ -75,7 +75,7 @@ const H = (new class extends babelHelpers.identity { static { class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -87,7 +87,7 @@ const J = (new class extends babelHelpers.identity { static { class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -101,7 +101,7 @@ function classFactory() { static { (class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; } }); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js index ba43e110e5e5..29db6d8050d3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-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.applyDecs2303(this, [], [0, dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass(); @@ -10,7 +10,7 @@ const A = (class A { }, _A); const B = (class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass2(); @@ -18,7 +18,7 @@ const B = (class C { }, _C); const D = (class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass3(); @@ -26,7 +26,7 @@ const D = (class D { }, _D); const E = ((class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass4(); @@ -34,14 +34,14 @@ const E = ((class { }, _decorated_class), 123); const F = [(class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass5(); } }, _G), (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass6(); @@ -49,7 +49,7 @@ const F = [(class G { }, _decorated_class2)]; const H = (class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass7(); @@ -57,7 +57,7 @@ const H = (class H extends I { }, _H); const J = (class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass8(); @@ -67,7 +67,7 @@ function classFactory() { var _initClass9, _decorated_class3; return class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static { _initClass9(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js index 5c9d3831abcc..aa47aff8ef04 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js @@ -4,7 +4,7 @@ let _Bar; _dec = dec1; class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; } static { _initClass(); @@ -14,7 +14,7 @@ let _Foo; _dec2 = dec2; class Foo extends _Bar { static { - [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, _dec2]).c; + [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [_dec2]).c; } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js index 33f809421c7f..eecf942bf26e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } @@ -19,7 +19,7 @@ new class extends babelHelpers.identity { static { class Bar extends _Foo { static { - [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js index a6ba56a4418c..32335a927df2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-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.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } static m() {} } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js index 999e6fcbf8ba..e187fdb62453 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js index dea1f930346a..771c60816010 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js @@ -2,7 +2,7 @@ var _initClass, _Bar; const dec = () => {}; const Foo = (class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } bar = new _Bar(); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js index 9024d0717359..7b4c9179c1c6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 71a68b04d0ce..89be29add86e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 8bf48446759b..9d82d81c9958 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js index 09b81628f8ca..43479f097249 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js @@ -8,4 +8,4 @@ class Foo { return 1; } } -[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 0, "a"]], []).e; +[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 0, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js index cf4eae2ffb91..2ce72028d6b8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -11,4 +11,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 2, "a"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 2, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js index d7f14131095b..4871c6b6a614 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js @@ -4,7 +4,7 @@ _computedKey = getKey(); _computedKey2 = getKey(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js index 6d481fcdba41..f077d14382d9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js @@ -4,7 +4,7 @@ _computedKey = getKeyI(); _computedKey2 = getKeyJ(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, _computedKey], [[0, dec], 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js index bbc222972f0c..cb8dea3db5ce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js @@ -2,7 +2,7 @@ var _init_a, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 0, "a"]], []).e; + [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 0, "a"]], []).e; } a = (_initProto(this), _init_a(this, 123)); a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js index 1d2971f1940b..198742f6dab1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 2, "a"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 2, "a"]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs index 45065646e2b9..27714fc7f865 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs index 2fe3d6b69479..4e00a527e4ec 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs @@ -3,7 +3,7 @@ let _default2; _dec = dec; class _default { static { - [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; + [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs index 5242aa384405..f1281d2a0a4f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs @@ -2,7 +2,7 @@ var _dec, _init_x; _dec = dec; export class A { static { - [_init_x] = babelHelpers.applyDecs2303(this, [[[0, _dec], 0, "x"]], []).e; + [_init_x] = babelHelpers.applyDecs2303(this, [[[_dec], 0, "x"]], []).e; } x = _init_x(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs index adabea42b18f..ccec1e265258 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [0, _dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js index 87e2749469ce..58fca80b5a6a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js @@ -14,4 +14,4 @@ class Foo { }); } } -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [[0, dec], 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], _ => _b.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[dec], 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [[dec], 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js index 7e5e55b76130..f7978fe9c7e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js @@ -8,4 +8,4 @@ class Foo { babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); } } -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 0, "a"], [[0, dec], 0, "b"], [[0, dec], 0, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[dec], 0, "a"], [[dec], 0, "b"], [[dec], 0, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js index 63fb9c0b2bae..42ec565d4e43 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js @@ -1,7 +1,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo {} -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 5, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [[0, dec], 5, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[dec], 8, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [[dec], 8, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; var _a = { writable: true, value: _init_a(Foo) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js index 96821176f64f..73178097f283 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b, _computedKey, _init_computedKey; const dec = () => {}; _computedKey = 'c'; class Foo {} -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 5, "a"], [[0, dec], 5, "b"], [[0, dec], 5, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[dec], 8, "a"], [[dec], 8, "b"], [[dec], 8, _computedKey]], []).e; babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js index 750020507262..991832724286 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[[0, dec], 0, "a", o => o.#a, (o, v) => o.#a = v], [[0, dec], 0, "b", o => o.#b, (o, v) => o.#b = v]], [], _ => #b in _).e; + [_init_a, _init_b] = babelHelpers.applyDecs2303(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; } #a = _init_a(this); #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js index c726513f8da7..c77534e65d22 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[0, dec], 0, "a"], [[0, dec], 0, "b"], [[0, dec], 0, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[dec], 0, "a"], [[dec], 0, "b"], [[dec], 0, _computedKey]], []).e; } a = _init_a(this); b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js index d64b9c6b86b9..392c34628ca5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(this, [[[0, dec], 5, "a", o => o.#a, (o, v) => o.#a = v], [[0, dec], 5, "b", o => o.#b, (o, v) => o.#b = v]], []).e; + [_init_a, _init_b] = babelHelpers.applyDecs2303(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(this); static #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js index e44ae0faa01b..cbbabaf09139 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[0, dec], 5, "a"], [[0, dec], 5, "b"], [[0, dec], 5, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[dec], 8, "a"], [[dec], 8, "b"], [[dec], 8, _computedKey]], []).e; } static a = _init_a(this); static b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js index 94ac5a6b4da7..d165dcc09f40 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _get_a() { return _call_a(this); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a", function () { return this.value; -}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js index 4e0141b976d2..5f8479bbab81 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a"], [[0, dec], 3, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a"], [[dec], 3, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js index 523b5d69fc51..1d3221479853 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: void 0 }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js index f4934e1c4a7b..d595e411f380 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a"], [[0, dec], 8, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a"], [[dec], 11, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js index e2c5ce24372f..6a548fd5a3d0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js @@ -23,8 +23,8 @@ function _get_a() { function _set_a(v) { _call_a2(this, v); } -[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a", function () { +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a", function () { return this.value; -}], [[0, dec], 4, "a", function (v) { +}], [[dec], 4, "a", function (v) { this.value = v; -}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js index 180517ac52a8..3bb0d87b5b8d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js @@ -20,4 +20,4 @@ class Foo { this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 3, "a"], [[0, dec], 4, "a"], [[0, dec], 3, _computedKey], [[0, dec], 4, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a"], [[dec], 4, "a"], [[dec], 3, _computedKey], [[dec], 4, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js index 9c5025fbaf8c..502fa0427181 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js @@ -19,9 +19,9 @@ var _a = { set: _set_a }; (() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a", function () { return this.value; - }], [[0, dec], 9, "a", function (v) { + }], [[dec], 12, "a", function (v) { this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js index c2c84cbeb947..5a897b8c631d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js @@ -17,7 +17,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 8, "a"], [[0, dec], 9, "a"], [[0, dec], 8, _computedKey], [[0, dec], 9, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a"], [[dec], 12, "a"], [[dec], 11, _computedKey], [[dec], 12, _computedKey2]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js index 522b660d5269..7240af78bd2f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js @@ -2,11 +2,11 @@ var _call_a, _call_a2, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a", function () { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a", function () { return this.value; - }], [[0, dec], 4, "a", function (v) { + }], [[dec], 4, "a", function (v) { this.value = v; - }]], [], _ => #a in _).e; + }]], [], 0, _ => #a in _).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js index 1367302379e3..0a6706b5c7b0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a"], [[0, dec], 4, "a"], [[0, dec], 3, _computedKey], [[0, dec], 4, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a"], [[dec], 4, "a"], [[dec], 3, _computedKey], [[dec], 4, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js index 808f4111566e..e81e78dafe38 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js @@ -2,9 +2,9 @@ var _call_a, _call_a2, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a", function () { return this.value; - }], [[0, dec], 9, "a", function (v) { + }], [[dec], 12, "a", function (v) { this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js index 04ca0ea03c55..a96ee92311f0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a"], [[0, dec], 9, "a"], [[0, dec], 8, _computedKey], [[0, dec], 9, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a"], [[dec], 12, "a"], [[dec], 11, _computedKey], [[dec], 12, _computedKey2]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js index 030c3593dc6b..6e2e7df441be 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js @@ -2,9 +2,9 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a", function () { return this.value; - }]], [], _ => #a in _).e; + }]], [], 0, _ => #a in _).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js index 9c86ed9b52a5..70afa551ebc1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "a"], [[0, dec], 3, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a"], [[dec], 3, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js index 7ddc3df3f780..a19cd0c6e253 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js index 53a3b1b839f3..029d0e26ce3c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 8, "a"], [[0, dec], 8, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a"], [[dec], 11, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js index 889f8cec63bd..33c11d2e34ce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js @@ -14,6 +14,6 @@ class Foo { return babelHelpers.classPrivateFieldGet(this, _a).call(this); } } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a", function () { return this.value; -}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js index 7d7014b6e493..0676d0a55ddb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 2, "a"], [[0, dec], 2, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 2, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js index ed1a37ada8a7..db9a0178e544 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js @@ -6,7 +6,7 @@ class Foo { } } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 7, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 10, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js index d4b1a1fb09e9..562c83085300 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 7, "a"], [[0, dec], 7, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 10, "a"], [[dec], 10, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js index bb4cd1084e2f..8f688decfb5b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js @@ -2,9 +2,9 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a", function () { return this.value; - }]], [], _ => #a in _).e; + }]], [], 0, _ => #a in _).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js index fa65a5326ff5..b39440bce869 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "a"], [[0, dec], 2, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 2, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js index 874783046b5e..1b01c47138f2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 10, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js index 1b3629944fce..fb4de5281c0e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "a"], [[0, dec], 7, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 10, "a"], [[dec], 10, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js index c8722f4efdf0..666975f3b029 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -9,4 +9,4 @@ class A extends B { } method() {} } -[_initProto] = babelHelpers.applyDecs2303(A, [[[0, _dec], 2, "method"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(A, [[[_dec], 2, "method"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js index 362f72e318f6..df26042793a7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js @@ -15,7 +15,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(C, [[[1, _obj2, _dec2], 2, "m2"]], [1, _obj, _dec])); + } = babelHelpers.applyDecs2303(C, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); _initClass(); } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js index d49cea52fc93..4bc5ec015b5f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js @@ -21,5 +21,5 @@ class A { ({ e: [_init_x, _init_y], c: [_A, _initClass] -} = babelHelpers.applyDecs2303(A, [[[1, _obj3, _dec4, _obj4, _dec5], 0, "x"], [[1, _obj5, _dec6, void 0, _dec7], 0, "y"]], [1, _obj, _dec, void 0, _dec2, _obj2, _dec3])); +} = babelHelpers.applyDecs2303(A, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js index d78ae30ecd7e..817058e694d6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js @@ -27,11 +27,11 @@ class Foo { constructor() { babelHelpers.defineProperty(this, "bar", _init_bar(this)); } - }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[[0, _dec9], 0, "bar"]], []).e, _class); + }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[[_dec9], 0, "bar"]], []).e, _class); } } ({ e: [_initProto], c: [_Foo, _initClass] -} = babelHelpers.applyDecs2303(Foo, [[[1, void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 2, "method"]], [1, void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4])); +} = babelHelpers.applyDecs2303(Foo, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js index 91b5c479fb54..65bbd8b0c5db 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_n, _init_a, _init_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2303(this, [[[0, dec], 7, "j"], [[0, dec], 8, "k"], [[0, dec], 9, "l"], [[0, dec], 6, "m"], [[0, dec], 7, "o", function () {}], [[0, dec], 8, "p", function () {}], [[0, dec], 9, "q", function (v) {}], [[0, dec], 6, "r", o => o.#D, (o, v) => o.#D = v], [[0, dec], 2, "b"], [[0, dec], 3, "c"], [[0, dec], 4, "c"], [[0, dec], 1, "d"], [[0, dec], 2, "f", function () {}], [[0, dec], 3, "g", function () {}], [[0, dec], 4, "g", function (v) {}], [[0, dec], 1, "h", o => o.#B, (o, v) => o.#B = v], [[0, dec], 5, "i"], [[0, dec], 5, "n", o => o.#n, (o, v) => o.#n = v], [[0, dec], 0, "a"], [[0, dec], 0, "e", o => o.#e, (o, v) => o.#e = v]], [0, dec], _ => #e in _)); + } = babelHelpers.applyDecs2303(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 _)); _initStatic(this); } #f = _call_f; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js index 0ca7056b4b0d..3bd016f68978 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _dec = deco; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, _dec], 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[_dec], 2, "method"]], []).e; } constructor() { if (Math.random() > 0.5) { @@ -17,7 +17,7 @@ class A extends B { _dec2 = deco; class C extends B { static { - [_initProto2] = babelHelpers.applyDecs2303(this, [[[0, _dec2], 2, "method"]], []).e; + [_initProto2] = babelHelpers.applyDecs2303(this, [[[_dec2], 2, "method"]], []).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js index ef3121a5b656..beeaa5b297ab 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "method"]], []).e; } constructor() { let a = 2; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js index 9e0efc55f199..544fc2f8c916 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js @@ -11,7 +11,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[1, _obj2, _dec2], 2, "m2"]], [1, _obj, _dec])); + } = babelHelpers.applyDecs2303(this, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js index 1015d11e6670..da70eb6e4869 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [0, dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js index 45eafd4fa0a9..60f6971ff65b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js @@ -2,9 +2,9 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); - }]], [], _ => #x in _).e; + }]], [], 0, _ => #x in _).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js index c94ae53322f5..e05ac9469780 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js @@ -2,9 +2,9 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); - }]], [], _ => #x in _).e; + }]], [], 0, _ => #x in _).e; } constructor(...args) { super(...args); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js index de46480a91ab..6e35346d25da 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js @@ -17,7 +17,7 @@ class A { ({ e: [_init_x, _init_y], c: [_A, _initClass] - } = babelHelpers.applyDecs2303(this, [[[1, _obj3, _dec4, _obj4, _dec5], 0, "x"], [[1, _obj5, _dec6, void 0, _dec7], 0, "y"]], [1, _obj, _dec, void 0, _dec2, _obj2, _dec3])); + } = babelHelpers.applyDecs2303(this, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); } x = _init_x(this); y = _init_y(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js index 3ed7702e9847..8a1c97c12e02 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js @@ -16,7 +16,7 @@ class Foo { ({ e: [_initProto], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2303(this, [[[1, void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 2, "method"]], [1, void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4])); + } = babelHelpers.applyDecs2303(this, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); } constructor(...args) { _initProto(this); @@ -27,7 +27,7 @@ class Foo { var _obj3, _dec9, _init_bar; return _obj3 = this, _dec9 = this.#a, class Nested { static { - [_init_bar] = babelHelpers.applyDecs2303(this, [[[1, _obj3, _dec9], 0, "bar"]], []).e; + [_init_bar] = babelHelpers.applyDecs2303(this, [[[_obj3, _dec9], 16, "bar"]], []).e; } bar = _init_bar(this); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js index 424dcee16130..c7349298973f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _set_a(v) { _call_a(this, v); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 4, "a", function (v) { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 4, "a", function (v) { return this.value = v; -}]], [], _ => _a.has(babelHelpers.checkInRHS(_))).e; +}]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js index bd594ebc5bd4..48210e3b25c7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 4, "a"], [[0, dec], 4, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 4, "a"], [[dec], 4, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js index 8155c28781dd..17b30966f3a0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: _set_a }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 9, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js index 986ba5639b7b..75978bf8b1d0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[0, dec], 9, "a"], [[0, dec], 9, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 12, "a"], [[dec], 12, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js index 681556c1be0d..65c074d9d197 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js @@ -2,9 +2,9 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 4, "a", function (v) { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 4, "a", function (v) { return this.value = v; - }]], [], _ => #a in _).e; + }]], [], 0, _ => #a in _).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js index e97ff8a407fe..82c8d3bc95e5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[0, dec], 4, "a"], [[0, dec], 4, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 4, "a"], [[dec], 4, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js index 6b90b55d4540..e6c0ab1a8898 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 9, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js index 9f9eb50508b3..cfb4832222d3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[0, dec], 9, "a"], [[0, dec], 9, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 12, "a"], [[dec], 12, _computedKey]], []).e; _initStatic(this); } static value = 1; From 7b642717fdcfcf656f9336498d1ed9dafc4121a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 17 Apr 2023 18:32:49 +0200 Subject: [PATCH 10/15] Skip array with single decorator --- .../babel-helpers/src/helpers-generated.ts | 2 +- .../src/helpers/applyDecs2303.js | 28 +++++++++++-------- .../src/transformer-2023-03.ts | 4 +-- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-accessors/private/output.js | 2 +- .../2023-03-accessors/public/output.js | 2 +- .../static-private/output.js | 2 +- .../2023-03-accessors/static-public/output.js | 2 +- .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../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 +- .../member-decorator/output.mjs | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../fixtures/2023-03-fields/private/output.js | 2 +- .../fixtures/2023-03-fields/public/output.js | 2 +- .../2023-03-fields/static-private/output.js | 2 +- .../2023-03-fields/static-public/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../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-03-getters/private/output.js | 2 +- .../fixtures/2023-03-getters/public/output.js | 2 +- .../2023-03-getters/static-private/output.js | 2 +- .../2023-03-getters/static-public/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-methods/private/output.js | 2 +- .../fixtures/2023-03-methods/public/output.js | 2 +- .../2023-03-methods/static-private/output.js | 2 +- .../2023-03-methods/static-public/output.js | 2 +- .../output.js | 2 +- .../valid-expression-formats/output.js | 2 +- .../2023-03-misc/all-decorators/output.js | 2 +- .../output.js | 4 +-- .../output.js | 2 +- .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/output.js | 2 +- .../private/output.js | 2 +- .../public/output.js | 2 +- .../static-private/output.js | 2 +- .../static-public/output.js | 2 +- .../2023-03-setters/private/output.js | 2 +- .../fixtures/2023-03-setters/public/output.js | 2 +- .../2023-03-setters/static-private/output.js | 2 +- .../2023-03-setters/static-public/output.js | 2 +- 73 files changed, 93 insertions(+), 91 deletions(-) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 453546618ac2..22cf76f632ed 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -39,7 +39,7 @@ export default Object.freeze({ ), applyDecs2303: helper( "7.21.0", - 'import checkInRHS from"checkInRHS";function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){assertNotFinished(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,thisArg,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec.call(thisArg,value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertNotFinished(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":5===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis1(fn){return function(){return fn(this)}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,newValue,get,set,decs=decInfo[0];isPrivate?desc=0===kind||1===kind?{get:curryThis1(decInfo[3]),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set);for(var inc=decoratorsHaveThis?2:1,i=decs.length-1;i>=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,inc=decoratorsHaveThis?2:1,i=classDecs.length-1;i>=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,inc=decoratorsHaveThis?2:1,i=classDecs.length-1;i>=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i i.#a, (i, v) => i.#a = v], - [[0, dec, dec2], 1, 'b'], - [[0, dec], 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], - [[0, dec], 2, 'c'], - [[0, dec], 2, 'c', () => console.log('privC')], - [[0, dec], 3, 'd'], - [[0, dec], 3, 'd', () => console.log('privD')], - [[0, dec], 4, 'e'], - [[0, dec], 4, 'e', () => console.log('privE')], + [dec, 0, 'a'], + [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[dec, dec2], 1, 'b'], + [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [dec, 2, 'c'], + [dec, 2, 'c', () => console.log('privC')], + [dec, 3, 'd'], + [dec, 3, 'd', () => console.log('privD')], + [dec, 4, 'e'], + [dec, 4, 'e', () => console.log('privE')], ], [ - 0, dec + dec ] ); diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts index 0a26c99610c1..1460b824cf0f 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts @@ -385,9 +385,7 @@ function generateDecorationExprs( if (hasThis) flag += DECORATORS_HAVE_THIS; return t.arrayExpression([ - version !== "2023-03" && decs.length === 1 - ? decs[0] - : t.arrayExpression(decs), + decs.length === 1 ? decs[0] : t.arrayExpression(decs), t.numericLiteral(flag), el.name, ...(el.privateMethods || []), diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js index fe52e85046bb..f5afadf80683 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js @@ -36,4 +36,4 @@ function _set_b2(v) { function _get_b2() { return _get_b(this); } -[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [[dec], 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js index 5bce0150b22c..22dc762cb4e8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js @@ -38,4 +38,4 @@ class Foo { babelHelpers.classPrivateFieldSet(this, _C, v); } } -[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 1, "a"], [[dec], 1, "b"], [[dec], 1, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js index 90ffa5e35289..85e5b6909c33 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js @@ -27,7 +27,7 @@ function _get_b2() { return _get_b(this); } (() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 9, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [[dec], 9, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [dec, 9, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js index 1d5d0992f421..9289a1a1890b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js @@ -22,7 +22,7 @@ class Foo { } } (() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 9, "a"], [[dec], 9, "b"], [[dec], 9, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js index 0b6dc60e7e89..7e6aca54de41 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(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_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(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; } #A = (_initProto(this), _init_a(this)); set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js index 6eaddbf76fe3..c8dd2991237c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 1, "a"], [[dec], 1, "b"], [[dec], 1, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; } #A = (_initProto(this), _init_a(this)); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js index b212655fcbb5..2521ca9eceaa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(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_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a", o => o.#A, (o, v) => o.#A = v], [dec, 9, "b", o => o.#B, (o, v) => o.#B = v]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js index a033c974ca33..aa2dca77ccc4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 9, "a"], [[dec], 9, "b"], [[dec], 9, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js index a530b18a7f6d..df619e2fc0bb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { return Bar.prototype.foo.call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js index b59dd576492a..147825dd468b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { return Bar.prototype.foo.call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js index 6f408d3c2f2a..7e214c498427 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js @@ -14,5 +14,5 @@ class C { ({ e: [_init_m], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[[memberDec], 0, "m"]], [classDec])); +} = babelHelpers.applyDecs2303(C, [[memberDec, 0, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js index 7756495b8b17..b20c78d9814b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js @@ -15,5 +15,5 @@ class C { ({ e: [_initProto], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[[memberDec], 2, "m"]], [classDec])); +} = babelHelpers.applyDecs2303(C, [[memberDec, 2, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js index 276068382a89..439521f4f065 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_init_m], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[memberDec], 0, "m"]], [classDec])); + } = babelHelpers.applyDecs2303(this, [[memberDec, 0, "m"]], [classDec])); } m = _init_m(this); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js index 94d54e626ec2..e9b3ade00991 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[memberDec], 2, "m"]], [classDec])); + } = babelHelpers.applyDecs2303(this, [[memberDec, 2, "m"]], [classDec])); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 89be29add86e..7ddef3be40d9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 9d82d81c9958..9c9448835538 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js index 43479f097249..adc3006a8190 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js @@ -8,4 +8,4 @@ class Foo { return 1; } } -[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 0, "a"]], []).e; +[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js index 2ce72028d6b8..3fe80ca58e17 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -11,4 +11,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 2, "a"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js index 4871c6b6a614..b409741c95c1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js @@ -4,7 +4,7 @@ _computedKey = getKey(); _computedKey2 = getKey(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js index f077d14382d9..00bd162f0999 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js @@ -4,7 +4,7 @@ _computedKey = getKeyI(); _computedKey2 = getKeyJ(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, _computedKey], [[dec], 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js index cb8dea3db5ce..53f2911d5016 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js @@ -2,7 +2,7 @@ var _init_a, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 0, "a"]], []).e; + [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; } a = (_initProto(this), _init_a(this, 123)); a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js index 198742f6dab1..427a72d2aaf6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 2, "a"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs index f1281d2a0a4f..6a95338049fa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs @@ -2,7 +2,7 @@ var _dec, _init_x; _dec = dec; export class A { static { - [_init_x] = babelHelpers.applyDecs2303(this, [[[_dec], 0, "x"]], []).e; + [_init_x] = babelHelpers.applyDecs2303(this, [[_dec, 0, "x"]], []).e; } x = _init_x(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js index 58fca80b5a6a..09e5e8b4588e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js @@ -14,4 +14,4 @@ class Foo { }); } } -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[dec], 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [[dec], 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js index f7978fe9c7e3..a022b9921fcb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js @@ -8,4 +8,4 @@ class Foo { babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); } } -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[dec], 0, "a"], [[dec], 0, "b"], [[dec], 0, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js index 42ec565d4e43..600bc4ed58c7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js @@ -1,7 +1,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo {} -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[[dec], 8, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [[dec], 8, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; +[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [dec, 8, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; var _a = { writable: true, value: _init_a(Foo) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js index 73178097f283..4d58d500c721 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b, _computedKey, _init_computedKey; const dec = () => {}; _computedKey = 'c'; class Foo {} -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[[dec], 8, "a"], [[dec], 8, "b"], [[dec], 8, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js index 991832724286..b157c17a1579 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(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_b] = babelHelpers.applyDecs2303(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; } #a = _init_a(this); #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js index c77534e65d22..d654f2719616 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[dec], 0, "a"], [[dec], 0, "b"], [[dec], 0, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; } a = _init_a(this); b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js index 392c34628ca5..44fd38e41add 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(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_b] = babelHelpers.applyDecs2303(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(this); static #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js index cbbabaf09139..8a17282aba1a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[[dec], 8, "a"], [[dec], 8, "b"], [[dec], 8, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; } static a = _init_a(this); static b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js index d165dcc09f40..8a330f603114 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _get_a() { return _call_a(this); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { return this.value; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js index 5f8479bbab81..763867651958 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a"], [[dec], 3, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js index 1d3221479853..3c4ec052328d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: void 0 }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js index d595e411f380..d85f72267c4f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a"], [[dec], 11, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js index 6a548fd5a3d0..385df14cddac 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js @@ -23,8 +23,8 @@ function _get_a() { function _set_a(v) { _call_a2(this, v); } -[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a", function () { +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { return this.value; -}], [[dec], 4, "a", function (v) { +}], [dec, 4, "a", function (v) { this.value = v; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js index 3bb0d87b5b8d..8d381858681b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js @@ -20,4 +20,4 @@ class Foo { this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 3, "a"], [[dec], 4, "a"], [[dec], 3, _computedKey], [[dec], 4, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js index 502fa0427181..d74e35f45d5d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js @@ -19,9 +19,9 @@ var _a = { set: _set_a }; (() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a", function () { return this.value; - }], [[dec], 12, "a", function (v) { + }], [dec, 12, "a", function (v) { this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js index 5a897b8c631d..f0dad4e9d5d1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js @@ -17,7 +17,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 11, "a"], [[dec], 12, "a"], [[dec], 11, _computedKey], [[dec], 12, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js index 7240af78bd2f..efd554e85844 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js @@ -2,9 +2,9 @@ var _call_a, _call_a2, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a", function () { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { return this.value; - }], [[dec], 4, "a", function (v) { + }], [dec, 4, "a", function (v) { this.value = v; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js index 0a6706b5c7b0..319f7189bd08 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a"], [[dec], 4, "a"], [[dec], 3, _computedKey], [[dec], 4, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js index e81e78dafe38..06fe9efca701 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js @@ -2,9 +2,9 @@ var _call_a, _call_a2, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a", function () { return this.value; - }], [[dec], 12, "a", function (v) { + }], [dec, 12, "a", function (v) { this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js index a96ee92311f0..edf6fda322a3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a"], [[dec], 12, "a"], [[dec], 11, _computedKey], [[dec], 12, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js index 6e2e7df441be..090e373bbd1c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { return this.value; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js index 70afa551ebc1..f9255dccc6ec 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "a"], [[dec], 3, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js index a19cd0c6e253..c151d554a936 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js index 029d0e26ce3c..382348b31248 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 11, "a"], [[dec], 11, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js index 33c11d2e34ce..26eed5e4f435 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js @@ -14,6 +14,6 @@ class Foo { return babelHelpers.classPrivateFieldGet(this, _a).call(this); } } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a", function () { return this.value; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js index 0676d0a55ddb..570adc92fb1a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 2, "a"], [[dec], 2, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js index db9a0178e544..ac0ca1b4c3b5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js @@ -6,7 +6,7 @@ class Foo { } } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 10, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js index 562c83085300..e9d13491fe3d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 10, "a"], [[dec], 10, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js index 8f688decfb5b..fa5f691bb4e4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a", function () { return this.value; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js index b39440bce869..ecb55e9ba21f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "a"], [[dec], 2, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js index 1b01c47138f2..be23a5c8f0bd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 10, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js index fb4de5281c0e..f606920bdc0b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 10, "a"], [[dec], 10, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js index 666975f3b029..41f3d5c3604b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -9,4 +9,4 @@ class A extends B { } method() {} } -[_initProto] = babelHelpers.applyDecs2303(A, [[[_dec], 2, "method"]], []).e; +[_initProto] = babelHelpers.applyDecs2303(A, [[_dec, 2, "method"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js index 817058e694d6..fa98039e6116 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js @@ -27,7 +27,7 @@ class Foo { constructor() { babelHelpers.defineProperty(this, "bar", _init_bar(this)); } - }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[[_dec9], 0, "bar"]], []).e, _class); + }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[_dec9, 0, "bar"]], []).e, _class); } } ({ diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js index 65bbd8b0c5db..77ccc56af3af 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_n, _init_a, _init_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2303(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.applyDecs2303(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 _)); _initStatic(this); } #f = _call_f; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js index 3bd016f68978..e90a08e474bd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _dec = deco; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[_dec], 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[_dec, 2, "method"]], []).e; } constructor() { if (Math.random() > 0.5) { @@ -17,7 +17,7 @@ class A extends B { _dec2 = deco; class C extends B { static { - [_initProto2] = babelHelpers.applyDecs2303(this, [[[_dec2], 2, "method"]], []).e; + [_initProto2] = babelHelpers.applyDecs2303(this, [[_dec2, 2, "method"]], []).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js index beeaa5b297ab..e20913dffe63 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "method"]], []).e; } constructor() { let a = 2; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js index 60f6971ff65b..c7de91d2c094 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js index e05ac9469780..7f76ac041fb8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js index c7349298973f..2cd3cf38d5e4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _set_a(v) { _call_a(this, v); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 4, "a", function (v) { +[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a", function (v) { return this.value = v; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js index 48210e3b25c7..48da3f7bfcfb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[[dec], 4, "a"], [[dec], 4, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js index 17b30966f3a0..ae469ad44203 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: _set_a }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js index 75978bf8b1d0..a49448d428ef 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[[dec], 12, "a"], [[dec], 12, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js index 65c074d9d197..267191900af3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[[dec], 4, "a", function (v) { + [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a", function (v) { return this.value = v; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js index 82c8d3bc95e5..5fea5ec2b8cb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[[dec], 4, "a"], [[dec], 4, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js index e6c0ab1a8898..8514769ec2a3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js index cfb4832222d3..1b2f3ed16969 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[[dec], 12, "a"], [[dec], 12, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; _initStatic(this); } static value = 1; From e82e43b231c7897027637c92adc03b606056c545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 3 May 2023 18:59:08 -0400 Subject: [PATCH 11/15] add accessor setters ordering test cases --- .../accessor-initializers-setters/exec.js | 61 +++++++++++++++++++ .../accessor-initializers-setters/exec.js | 61 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js new file mode 100644 index 000000000000..a0f59eb4c551 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js @@ -0,0 +1,61 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d, e, f) { + push(a); + return function ({ set }, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + set(v) { push(e); const result = set.call(this, v); push(f); return result; } + }; + }; +} + +function logFieldDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logClassDecoratorRun(0, 11, 13) +@logClassDecoratorRun(1, 10, 12) +class A { + @logAccessorDecoratorRun(2, 7, 15, 19, 22, 25) + @logAccessorDecoratorRun(3, 6, 14, 18, 23, 24) + accessor a; + + @logAccessorDecoratorRun(4, 9, 17, 21, 26, 29) + @logAccessorDecoratorRun(5, 8, 16, 20, 27, 28) + accessor #b; + + constructor() { + this.a = null; + this.#b = null; + } +} + +var nums = Array.from({ length: 14 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js new file mode 100644 index 000000000000..a0f59eb4c551 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js @@ -0,0 +1,61 @@ +var log = []; + +function push(x) { + log.push(x); + return x; +} + +function logClassDecoratorRun(a, b, c) { + push(a); + return function (el, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return el; + }; +} + +function logAccessorDecoratorRun(a, b, c, d, e, f) { + push(a); + return function ({ set }, { addInitializer }) { + push(b); + addInitializer(function () { + push(c); + }); + return { + init: () => push(d), + set(v) { push(e); const result = set.call(this, v); push(f); return result; } + }; + }; +} + +function logFieldDecoratorRun(a, b) { + push(a); + return function (el) { push(b); return el; }; +} + +@logClassDecoratorRun(0, 11, 13) +@logClassDecoratorRun(1, 10, 12) +class A { + @logAccessorDecoratorRun(2, 7, 15, 19, 22, 25) + @logAccessorDecoratorRun(3, 6, 14, 18, 23, 24) + accessor a; + + @logAccessorDecoratorRun(4, 9, 17, 21, 26, 29) + @logAccessorDecoratorRun(5, 8, 16, 20, 27, 28) + accessor #b; + + constructor() { + this.a = null; + this.#b = null; + } +} + +var nums = Array.from({ length: 14 }, (_, i) => i); +expect(log).toEqual(nums); + +new A(); + +var nums = Array.from({ length: 30 }, (_, i) => i); +expect(log).toEqual(nums); From 9f42791cdae3657aec49183abf0d4d190f23250b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 10 May 2023 16:12:16 +0200 Subject: [PATCH 12/15] Suggestions from code review --- packages/babel-helpers/src/helpers-generated.ts | 2 +- packages/babel-helpers/src/helpers/applyDecs2303.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 22cf76f632ed..2e7b65512ceb 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -39,7 +39,7 @@ export default Object.freeze({ ), applyDecs2303: helper( "7.21.0", - 'import checkInRHS from"checkInRHS";function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){assertNotFinished(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,thisArg,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec.call(thisArg,value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertNotFinished(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":5===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis1(fn){return function(){return fn(this)}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,newValue,get,set,decs=decInfo[0];decoratorsHaveThis||Array.isArray(decs)||(decs=[decs]),isPrivate?desc=0===kind||1===kind?{get:curryThis1(decInfo[3]),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set);for(var inc=decoratorsHaveThis?2:1,i=decs.length-1;i>=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,inc=decoratorsHaveThis?2:1,i=classDecs.length-1;i>=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);existingNonFields.set(name,!(!existingKind&&kind>2)||kind)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i 2 /* METHOD */) { - existingNonFields.set(name, kind); - } else { - existingNonFields.set(name, true); } + existingNonFields.set( + name, + !existingKind && kind > 2 /* METHOD */ ? kind : true + ); } applyMemberDec( @@ -472,7 +472,7 @@ function pushInitializers(ret, initializers) { } function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) { - if (classDecs.length > 0) { + if (classDecs.length) { var initializers = []; var newClass = targetClass; var name = targetClass.name; From 83ae4d2a2d25829efefbbe5f5e98d57e4aa5f44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 17 May 2023 11:40:44 +0300 Subject: [PATCH 13/15] Rename to `2023-05` --- .../babel-helpers/src/helpers-generated.ts | 4 ++-- .../{applyDecs2303.js => applyDecs2305.js} | 2 +- .../src/index.ts | 6 ++--- ...rmer-2023-03.ts => transformer-2023-05.ts} | 22 +++++++++---------- .../fixtures/2023-03-accessors/options.json | 3 --- .../options.json | 6 ----- .../fixtures/2023-03-classes/options.json | 3 --- .../2023-03-duplicated-keys/options.json | 3 --- .../fixtures/2023-03-exported/options.json | 3 --- .../test/fixtures/2023-03-fields/options.json | 3 --- .../2023-03-getters--to-es2015/options.json | 8 ------- .../options.json | 8 ------- .../2023-03-getters-and-setters/options.json | 3 --- .../fixtures/2023-03-getters/options.json | 3 --- .../2023-03-methods--to-es2015/options.json | 8 ------- .../fixtures/2023-03-methods/options.json | 3 --- .../2023-03-misc--to-es2015/options.json | 8 ------- .../test/fixtures/2023-03-misc/options.json | 3 --- .../2023-03-ordering--to-es2015/options.json | 8 ------- .../fixtures/2023-03-ordering/options.json | 4 ---- .../options.json | 8 ------- .../2023-03-setters--to-es2015/options.json | 8 ------- .../fixtures/2023-03-setters/options.json | 3 --- .../options.json | 2 +- .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public-this/exec.js | 0 .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../undecorated-private/exec.js | 0 .../undecorated-private/input.js | 0 .../undecorated-private/output.js | 0 .../undecorated-public/exec.js | 0 .../undecorated-public/input.js | 0 .../undecorated-public/output.js | 0 .../undecorated-static-private/exec.js | 0 .../undecorated-static-private/input.js | 0 .../undecorated-static-private/output.js | 0 .../undecorated-static-public/exec.js | 0 .../undecorated-static-public/input.js | 0 .../undecorated-static-public/output.js | 0 .../fixtures/2023-05-accessors/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public-inherited/exec.js | 0 .../static-public-inherited/options.json | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../undecorated-private/input.js | 0 .../undecorated-private/output.js | 0 .../undecorated-public/input.js | 0 .../undecorated-public/output.js | 0 .../undecorated-static-private/input.js | 0 .../undecorated-static-private/output.js | 0 .../undecorated-static-public/input.js | 0 .../undecorated-static-public/output.js | 0 .../options.json | 6 +++++ .../input.js | 0 .../output.js | 2 +- .../super-in-private-accessor/input.js | 0 .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/input.js | 0 .../super-in-private-method/output.js | 2 +- .../decorator-access-modified-fields/exec.js | 0 .../decorator-access-modified-fields/input.js | 0 .../output.js | 2 +- .../decorator-access-modified-methods/exec.js | 0 .../input.js | 0 .../output.js | 2 +- .../expressions-static-blocks/input.js | 0 .../expressions-static-blocks/output.js | 18 +++++++-------- .../expressions/input.js | 0 .../expressions/output.js | 16 +++++++------- .../inheritance/exec.js | 0 .../inheritance/input.js | 0 .../inheritance/output.js | 4 ++-- .../initializers/exec.js | 0 .../initializers/input.js | 0 .../initializers/output.js | 4 ++-- .../options.json | 2 +- .../exec.js | 0 .../input.js | 0 .../output.js | 2 +- .../replacement-static-this/exec.js | 0 .../replacement-static-this/input.js | 0 .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/exec.js | 0 .../replacement-with-expr/input.js | 0 .../replacement-with-expr/output.js | 2 +- .../replacement/exec.js | 0 .../replacement/input.js | 0 .../replacement/output.js | 2 +- .../decorator-access-modified-fields/exec.js | 0 .../decorator-access-modified-fields/input.js | 0 .../options.json | 0 .../output.js | 2 +- .../decorator-access-modified-methods/exec.js | 0 .../input.js | 0 .../options.json | 0 .../output.js | 2 +- .../expressions-static-blocks/input.js | 0 .../expressions-static-blocks/output.js | 18 +++++++-------- .../expressions/input.js | 0 .../expressions/output.js | 18 +++++++-------- .../inheritance/input.js | 0 .../inheritance/output.js | 4 ++-- .../initializers/input.js | 0 .../initializers/output.js | 4 ++-- .../fixtures/2023-05-classes/options.json | 3 +++ .../input.js | 0 .../output.js | 2 +- .../replacement-static-this/input.js | 0 .../replacement-static-this/output.js | 2 +- .../replacement-with-expr/input.js | 0 .../replacement-with-expr/output.js | 2 +- .../replacement/input.js | 0 .../replacement/output.js | 2 +- .../computed-keys-same-ast/exec.js | 0 .../computed-keys-same-ast/input.js | 0 .../computed-keys-same-ast/output.js | 2 +- .../computed-keys-same-value/exec.js | 0 .../computed-keys-same-value/input.js | 0 .../computed-keys-same-value/output.js | 2 +- .../method-and-field/exec.js | 0 .../method-and-field/input.js | 0 .../method-and-field/output.js | 2 +- .../methods-with-same-key/exec.js | 0 .../methods-with-same-key/input.js | 0 .../methods-with-same-key/output.js | 2 +- .../options.json | 2 +- .../computed-keys-same-ast/input.js | 0 .../computed-keys-same-ast/output.js | 2 +- .../computed-keys-same-value/input.js | 0 .../computed-keys-same-value/output.js | 2 +- .../method-and-field/input.js | 0 .../method-and-field/output.js | 2 +- .../methods-with-same-key/input.js | 0 .../methods-with-same-key/output.js | 2 +- .../2023-05-duplicated-keys/options.json | 3 +++ .../default-anonymous/input.mjs | 0 .../default-anonymous/output.mjs | 2 +- .../default-named/input.mjs | 0 .../default-named/output.mjs | 2 +- .../member-decorator/input.mjs | 0 .../member-decorator/output.mjs | 2 +- .../named/input.mjs | 0 .../named/output.mjs | 2 +- .../no-decorators/input.mjs | 0 .../no-decorators/output.mjs | 0 .../fixtures/2023-05-exported/options.json | 3 +++ .../options.json | 2 +- .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../test/fixtures/2023-05-fields/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../2023-05-getters--to-es2015/options.json | 8 +++++++ .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../options.json | 8 +++++++ .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../2023-05-getters-and-setters/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../fixtures/2023-05-getters/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../2023-05-methods--to-es2015/options.json | 8 +++++++ .../private-with-initializers/exec.js | 0 .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public-with-initializers/exec.js | 0 .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private-with-initializers/exec.js | 0 .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public-with-initializers/exec.js | 0 .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../fixtures/2023-05-methods/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../class-and-method-decorators/exec.js | 0 .../class-and-property-decorators/exec.js | 0 .../decorator-evaluation-scope/exec.js | 0 .../exec.js | 0 .../input.js | 0 .../output.js | 2 +- .../initializer-property-ignored/exec.js | 0 .../initializer-timing/exec.js | 0 .../exec.js | 0 .../leaked-context-addInitializer/exec.js | 0 .../2023-05-misc--to-es2015/options.json | 8 +++++++ .../super-in-decorator/input.js | 0 .../super-in-decorator/output.js | 2 +- .../this/exec.js | 0 .../this/input.js | 0 .../this/output.js | 2 +- .../valid-expression-formats/input.js | 0 .../valid-expression-formats/output.js | 4 ++-- .../all-decorators/input.js | 0 .../all-decorators/output.js | 2 +- .../decorator-evaluation-scope/exec.js | 0 .../decorator-evaluation-scope/options.json | 2 +- .../input.js | 0 .../output.js | 4 ++-- .../input.js | 0 .../output.js | 2 +- .../initializer-property-ignored/exec.js | 0 .../initializer-property-ignored/options.json | 2 +- .../test/fixtures/2023-05-misc/options.json | 3 +++ .../private-keys-in-enclosing-class/input.js | 0 .../private-keys-in-enclosing-class/output.js | 0 .../input.js | 0 .../options.json | 0 .../input.js | 0 .../options.json | 0 .../input.js | 0 .../options.json | 0 .../setting-private-method-via-rest/input.js | 0 .../options.json | 0 .../input.js | 0 .../options.json | 0 .../setting-private-method/input.js | 0 .../setting-private-method/options.json | 0 .../super-in-decorator/input.js | 0 .../super-in-decorator/output.js | 2 +- .../input.js | 0 .../output.js | 2 +- .../super-in-private-accessor/input.js | 0 .../super-in-private-accessor/output.js | 2 +- .../super-in-private-method/input.js | 0 .../super-in-private-method/output.js | 2 +- .../this/exec.js | 0 .../this/input.js | 0 .../this/options.json | 0 .../this/output.js | 2 +- .../valid-expression-formats/input.js | 0 .../valid-expression-formats/output.js | 4 ++-- .../accessor-initializers-fields/exec.js | 0 .../accessor-initializers-setters/exec.js | 0 .../accessor-method-initializers/exec.js | 0 .../exec.js | 0 .../exec.js | 0 .../field-initializers-after-methods/exec.js | 0 .../field/exec.js | 0 .../initializers/exec.js | 0 .../2023-05-ordering--to-es2015/options.json | 8 +++++++ .../exec.js | 0 .../exec.js | 0 .../accessor-initializers-fields/exec.js | 0 .../accessor-initializers-setters/exec.js | 0 .../accessor-method-initializers/exec.js | 0 .../exec.js | 0 .../exec.js | 0 .../field-initializers-after-methods/exec.js | 0 .../field/exec.js | 0 .../initializers/exec.js | 0 .../fixtures/2023-05-ordering/options.json | 4 ++++ .../exec.js | 0 .../exec.js | 0 .../invalid-accessor-decorator-return/exec.js | 0 .../invalid-add-initializer/exec.js | 0 .../invalid-class-decorator-return/exec.js | 0 .../invalid-field-decorator-return/exec.js | 0 .../invalid-getter-decorator-return/exec.js | 0 .../invalid-method-decorator-return/exec.js | 0 .../invalid-setter-decorator-return/exec.js | 0 .../options.json | 8 +++++++ .../2023-05-setters--to-es2015/options.json | 8 +++++++ .../private/exec.js | 0 .../private/input.js | 0 .../private/output.js | 2 +- .../public/exec.js | 0 .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/exec.js | 0 .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/exec.js | 0 .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../fixtures/2023-05-setters/options.json | 3 +++ .../private/input.js | 0 .../private/output.js | 2 +- .../public/input.js | 0 .../public/output.js | 2 +- .../static-private/input.js | 0 .../static-private/output.js | 2 +- .../static-public/input.js | 0 .../static-public/output.js | 2 +- .../src/index.ts | 10 ++++----- packages/babel-runtime-corejs2/package.json | 12 +++++----- packages/babel-runtime-corejs3/package.json | 12 +++++----- packages/babel-runtime/package.json | 12 +++++----- 367 files changed, 276 insertions(+), 276 deletions(-) rename packages/babel-helpers/src/helpers/{applyDecs2303.js => applyDecs2305.js} (99%) rename packages/babel-plugin-proposal-decorators/src/{transformer-2023-03.ts => transformer-2023-05.ts} (98%) delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json delete mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-accessors--to-es2015}/options.json (68%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/private/output.js (95%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/public/output.js (94%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-private/output.js (94%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-public-this/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/static-public/output.js (93%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-private/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-public/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-private/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-accessors--to-es2015}/undecorated-static-public/output.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/private/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/public/output.js (89%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-private/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-public-inherited/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-public-inherited/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/static-public/output.js (90%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-private/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-public/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-static-private/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors => 2023-05-accessors}/undecorated-static-public/output.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-nested-constructor-expression/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-nested-constructor-expression/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-private-accessor/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-private-accessor/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-private-method/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-assumption-constantSuper => 2023-05-assumption-constantSuper}/super-in-private-method/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-fields/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-fields/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-fields/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-methods/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/decorator-access-modified-methods/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/expressions-static-blocks/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/expressions-static-blocks/output.js (78%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/expressions/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/expressions/output.js (63%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/inheritance/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/inheritance/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/inheritance/output.js (57%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/initializers/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/initializers/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-classes--to-es2015}/options.json (68%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-installed-on-correct-class/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-installed-on-correct-class/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-installed-on-correct-class/output.js (91%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-this/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-this/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-static-this/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-with-expr/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-with-expr/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement-with-expr/output.js (77%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes--to-es2015 => 2023-05-classes--to-es2015}/replacement/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-fields/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-fields/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-fields/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-fields/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-methods/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-methods/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/decorator-access-modified-methods/output.js (84%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/expressions-static-blocks/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/expressions-static-blocks/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/expressions/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/expressions/output.js (71%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/inheritance/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/inheritance/output.js (67%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/initializers/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/initializers/output.js (79%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-static-installed-on-correct-class/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-static-installed-on-correct-class/output.js (84%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-static-this/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-static-this/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-with-expr/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement-with-expr/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-classes => 2023-05-classes}/replacement/output.js (80%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-ast/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-ast/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-ast/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-value/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-value/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/computed-keys-same-value/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/method-and-field/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/method-and-field/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/method-and-field/output.js (77%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/methods-with-same-key/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/methods-with-same-key/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-duplicated-keys--to-es2015}/methods-with-same-key/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-accessors--to-es2015 => 2023-05-duplicated-keys--to-es2015}/options.json (68%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/computed-keys-same-ast/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/computed-keys-same-ast/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/computed-keys-same-value/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/computed-keys-same-value/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/method-and-field/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/method-and-field/output.js (74%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/methods-with-same-key/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys => 2023-05-duplicated-keys}/methods-with-same-key/output.js (75%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/default-anonymous/input.mjs (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/default-anonymous/output.mjs (67%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/default-named/input.mjs (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/default-named/output.mjs (71%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/member-decorator/input.mjs (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/member-decorator/output.mjs (60%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/named/input.mjs (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/named/output.mjs (66%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/no-decorators/input.mjs (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-exported => 2023-05-exported}/no-decorators/output.mjs (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-duplicated-keys--to-es2015 => 2023-05-fields--to-es2015}/options.json (68%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/private/output.js (91%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/public/output.js (86%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-private/output.js (87%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields--to-es2015 => 2023-05-fields--to-es2015}/static-public/output.js (85%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/private/output.js (78%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/public/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/static-private/output.js (78%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-fields => 2023-05-fields}/static-public/output.js (83%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/private/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/public/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-private/output.js (85%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters--to-es2015 => 2023-05-getters--to-es2015}/static-public/output.js (82%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/private/output.js (91%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/public/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-private/output.js (90%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters--to-es2015 => 2023-05-getters-and-setters--to-es2015}/static-public/output.js (88%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/private/output.js (87%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/public/output.js (87%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/static-private/output.js (92%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters-and-setters => 2023-05-getters-and-setters}/static-public/output.js (87%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/private/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/public/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/static-private/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-getters => 2023-05-getters}/static-public/output.js (81%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/private-with-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/private/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/public-with-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/public/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-private-with-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-private/output.js (84%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-public-with-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods--to-es2015 => 2023-05-methods--to-es2015}/static-public/output.js (82%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/private/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/public/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/static-private/output.js (80%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-methods => 2023-05-methods}/static-public/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/class-and-method-decorators/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/class-and-property-decorators/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/decorator-evaluation-scope/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/initProto-existing-derived-constructor/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/initProto-existing-derived-constructor/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/initProto-existing-derived-constructor/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/initializer-property-ignored/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/initializer-timing/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/leaked-context-addInitializer-throw/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/leaked-context-addInitializer/exec.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/super-in-decorator/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/super-in-decorator/output.js (85%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/this/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/this/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/this/output.js (90%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/valid-expression-formats/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc--to-es2015 => 2023-05-misc--to-es2015}/valid-expression-formats/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/all-decorators/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/all-decorators/output.js (97%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/decorator-evaluation-scope/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/decorator-evaluation-scope/options.json (61%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initProto-existing-derived-constructor-multiple-super/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initProto-existing-derived-constructor-multiple-super/output.js (78%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initProto-existing-derived-constructor/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initProto-existing-derived-constructor/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initializer-property-ignored/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/initializer-property-ignored/options.json (61%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/private-keys-in-enclosing-class/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/private-keys-in-enclosing-class/output.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-array-pattern/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-array-pattern/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-for-of/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-for-of/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-object-pattern/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-object-pattern/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-rest/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-rest/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-update/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method-via-update/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/setting-private-method/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-decorator/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-decorator/output.js (87%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-nested-constructor-expression/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-nested-constructor-expression/output.js (73%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-private-accessor/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-private-accessor/output.js (84%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-private-method/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/super-in-private-method/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/this/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/this/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/this/options.json (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/this/output.js (90%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/valid-expression-formats/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-misc => 2023-05-misc}/valid-expression-formats/output.js (87%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/accessor-initializers-fields/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/accessor-initializers-setters/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/accessor-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/accessor-static-accessor-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/accessor-static-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/field-initializers-after-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/field/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/initializers/exec.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/static-accessor-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering--to-es2015 => 2023-05-ordering--to-es2015}/static-field-initializers-after-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/accessor-initializers-fields/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/accessor-initializers-setters/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/accessor-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/accessor-static-accessor-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/accessor-static-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/field-initializers-after-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/field/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/initializers/exec.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/static-accessor-method-initializers/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-ordering => 2023-05-ordering}/static-field-initializers-after-methods/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-accessor-decorator-return/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-add-initializer/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-class-decorator-return/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-field-decorator-return/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-getter-decorator-return/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-method-decorator-return/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-runtime-errors--to-es2015 => 2023-05-runtime-errors--to-es2015}/invalid-setter-decorator-return/exec.js (100%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/options.json create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/private/output.js (88%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/public/output.js (83%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-private/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-private/output.js (85%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-public/exec.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters--to-es2015 => 2023-05-setters--to-es2015}/static-public/output.js (83%) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/options.json rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/private/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/public/output.js (82%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/static-private/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/static-private/output.js (81%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/static-public/input.js (100%) rename packages/babel-plugin-proposal-decorators/test/fixtures/{2023-03-setters => 2023-05-setters}/static-public/output.js (82%) diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 2e7b65512ceb..315f79c0a61b 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -37,9 +37,9 @@ export default Object.freeze({ "7.21.0", 'import checkInRHS from"checkInRHS";function applyDecs2301Factory(){function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){!function(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec(value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":10===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,fn,newValue,get,set,decs=decInfo[0];if(isPrivate?desc=0===kind||1===kind?{get:(fn=decInfo[3],function(){return fn(this)}),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set),"function"==typeof decs)void 0!==(newValue=memberDec(decs,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand))&&(assertValidReturnValue(kind,newValue),0===kind?init=newValue:1===kind?(init=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue);else for(var i=decs.length-1;i>=0;i--){var newInit;if(void 0!==(newValue=memberDec(decs[i],name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5,hasPrivateBrand=instanceBrand;if(isStatic?(base=Class,0!==(kind-=5)&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);!existingKind&&kind>2?existingNonFields.set(name,kind):existingNonFields.set(name,!0)}applyMemberDec(ret,base,decInfo,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i0){for(var initializers=[],newClass=targetClass,name=targetClass.name,i=classDecs.length-1;i>=0;i--){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i](newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(10,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);existingNonFields.set(name,!(!existingKind&&kind>2)||kind)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);existingNonFields.set(name,!(!existingKind&&kind>2)||kind)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i { version === "2021-12" || version === "2022-03" || version === "2023-01" || - version === "2023-03" + version === "2023-05" ) { - return transformer2022_03(api, options, version); + return transformer2023_05(api, options, version); } else if (!process.env.BABEL_8_BREAKING) { api.assertVersion("^7.0.2"); return createClassFeaturePlugin({ diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts similarity index 98% rename from packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts rename to packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts index 1460b824cf0f..df457dd239a0 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2023-03.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts @@ -20,7 +20,7 @@ type ClassElement = | t.TSIndexSignature | t.StaticBlock; -type DecoratorVersionKind = "2023-03" | "2023-01" | "2022-03" | "2021-12"; +type DecoratorVersionKind = "2023-05" | "2023-01" | "2022-03" | "2021-12"; function incrementId(id: number[], idx = id.length - 1): void { // If index is -1, id needs an additional character, unshift A @@ -175,7 +175,7 @@ function addProxyAccessorsFor( const { static: isStatic } = element.node; const thisArg = - version === "2023-03" && isStatic ? className : t.thisExpression(); + version === "2023-05" && isStatic ? className : t.thisExpression(); const getterBody = t.blockStatement([ t.returnStatement( @@ -238,7 +238,7 @@ function extractProxyAccessorsFor( targetKey: t.PrivateName, version: DecoratorVersionKind, ): (t.FunctionExpression | t.ArrowFunctionExpression)[] { - if (version !== "2023-03" && version !== "2023-01") { + if (version !== "2023-05" && version !== "2023-01") { return [ template.expression.ast` function () { @@ -269,7 +269,7 @@ const METHOD = 2; const GETTER = 3; const SETTER = 4; -const STATIC_OLD_VERSION = 5; // Before 2023-03 +const STATIC_OLD_VERSION = 5; // Before 2023-05 const STATIC = 8; // 1 << 3 const DECORATORS_HAVE_THIS = 16; // 1 << 3 @@ -355,7 +355,7 @@ function generateDecorationList( const hasOneThis = decoratorsThis.some(Boolean); const decs: t.Expression[] = []; for (let i = 0; i < decsCount; i++) { - if (version === "2023-03" && hasOneThis) { + if (version === "2023-05" && hasOneThis) { decs.push( decoratorsThis[i] || t.unaryExpression("void", t.numericLiteral(0)), ); @@ -380,7 +380,7 @@ function generateDecorationExprs( let flag = el.kind; if (el.isStatic) { - flag += version === "2023-03" ? STATIC : STATIC_OLD_VERSION; + flag += version === "2023-05" ? STATIC : STATIC_OLD_VERSION; } if (hasThis) flag += DECORATORS_HAVE_THIS; @@ -589,7 +589,7 @@ function transformClass( const decoratorsThis = new Map(); const maybeExtractDecorator = (decorator: t.Decorator) => { const { expression } = decorator; - if (version === "2023-03" && t.isMemberExpression(expression)) { + if (version === "2023-05" && t.isMemberExpression(expression)) { let object; if ( t.isSuper(expression.object) || @@ -1132,7 +1132,7 @@ function createLocalsAssignment( ); } else { // TODO(Babel 8): Only keep the if branch - if (version === "2023-03") { + if (version === "2023-05") { if (maybePrivateBranName || classDecorationsFlag.value !== 0) { args.push(classDecorationsFlag); } @@ -1143,7 +1143,7 @@ function createLocalsAssignment( ` as t.ArrowFunctionExpression, ); } - rhs = t.callExpression(state.addHelper("applyDecs2303"), args); + rhs = t.callExpression(state.addHelper("applyDecs2305"), args); } else if (version === "2023-01") { if (maybePrivateBranName) { args.push( @@ -1180,9 +1180,9 @@ function createLocalsAssignment( export default function ( { assertVersion, assumption }: PluginAPI, { loose }: Options, - version: "2023-03" | "2023-01" | "2022-03" | "2021-12", + version: "2023-05" | "2023-01" | "2022-03" | "2021-12", ): PluginObject { - if (version === "2023-03" || version === "2023-01") { + if (version === "2023-05" || version === "2023-01") { assertVersion("^7.21.0"); } else if (version === "2021-12") { assertVersion("^7.16.0"); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json deleted file mode 100644 index 0127175ed0d1..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]], - "assumptions": { - "constantSuper": true - } -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json deleted file mode 100644 index b48aa6db604e..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]], - "minNodeVersion": "16.11.0" -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json deleted file mode 100644 index 78dfc85292c5..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], - "proposal-class-properties", - "proposal-private-methods", - "proposal-class-static-block" - ] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json deleted file mode 100644 index 3878fe79a69c..000000000000 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": [["proposal-decorators", { "version": "2023-03" }]] -} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/options.json similarity index 68% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/options.json index 78dfc85292c5..90031fe8187a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-properties", "proposal-private-methods", "proposal-class-static-block" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/output.js similarity index 95% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/output.js index f5afadf80683..e2db1b0bc267 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/private/output.js @@ -36,4 +36,4 @@ function _set_b2(v) { function _get_b2() { return _get_b(this); } -[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 1, "a", o => babelHelpers.classPrivateFieldGet(o, _A), (o, v) => babelHelpers.classPrivateFieldSet(o, _A, v)], [dec, 1, "b", o => babelHelpers.classPrivateFieldGet(o, _B), (o, v) => babelHelpers.classPrivateFieldSet(o, _B, v)]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/output.js similarity index 94% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/output.js index 22dc762cb4e8..2ed94c89dfff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/public/output.js @@ -38,4 +38,4 @@ class Foo { babelHelpers.classPrivateFieldSet(this, _C, v); } } -[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/output.js similarity index 94% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/output.js index 85e5b6909c33..8d398c811a40 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-private/output.js @@ -27,7 +27,7 @@ function _get_b2() { return _get_b(this); } (() => { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [dec, 9, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; + [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 9, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _A), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _A, v)], [dec, 9, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _B), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _B, v)]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public-this/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public-this/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public-this/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/output.js similarity index 93% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/output.js index 9289a1a1890b..f124a7035620 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/static-public/output.js @@ -22,7 +22,7 @@ class Foo { } } (() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; _initStatic(Foo); })(); var _A = { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-private/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-public/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-private/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/undecorated-static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors--to-es2015/undecorated-static-public/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/private/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/private/output.js index 7e6aca54de41..158762fa3071 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2303(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_b, _get_b, _set_b, _initProto] = babelHelpers.applyDecs2305(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; } #A = (_initProto(this), _init_a(this)); set #a(v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/public/output.js similarity index 89% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/public/output.js index c8dd2991237c..d1cc1e1f991e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []).e; } #A = (_initProto(this), _init_a(this)); get a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-private/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-private/output.js index 2521ca9eceaa..8857eade379f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic; const dec = () => {}; class Foo { static { - [_init_a, _get_a, _set_a, _init_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2303(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_b, _get_b, _set_b, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 9, "a", o => o.#A, (o, v) => o.#A = v], [dec, 9, "b", o => o.#B, (o, v) => o.#B = v]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public-inherited/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public-inherited/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public-inherited/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public-inherited/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public-inherited/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public/output.js similarity index 90% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public/output.js index aa2dca77ccc4..f05e361a640b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, _computedKey]], []).e; _initStatic(this); } static #A = _init_a(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-private/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-private/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-public/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-public/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-private/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-private/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-public/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors/undecorated-static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-accessors/undecorated-static-public/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/options.json new file mode 100644 index 000000000000..369462b1233d --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]], + "assumptions": { + "constantSuper": true + } +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-nested-constructor-expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-nested-constructor-expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-nested-constructor-expression/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-nested-constructor-expression/output.js index da70eb6e4869..267564aaae78 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-accessor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-accessor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-accessor/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-accessor/output.js index df619e2fc0bb..b69e2ce5e1bb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "x", function () { return Bar.prototype.foo.call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-method/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-method/output.js index 147825dd468b..e41db00e1d7b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-assumption-constantSuper/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "x", function () { return Bar.prototype.foo.call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/output.js index 7e214c498427..fa8ae7a79338 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-fields/output.js @@ -14,5 +14,5 @@ class C { ({ e: [_init_m], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[memberDec, 0, "m"]], [classDec])); +} = babelHelpers.applyDecs2305(C, [[memberDec, 0, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/output.js index b20c78d9814b..87662878affd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/decorator-access-modified-methods/output.js @@ -15,5 +15,5 @@ class C { ({ e: [_initProto], c: [_C, _initClass] -} = babelHelpers.applyDecs2303(C, [[memberDec, 2, "m"]], [classDec])); +} = babelHelpers.applyDecs2305(C, [[memberDec, 2, "m"]], [classDec])); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions-static-blocks/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions-static-blocks/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions-static-blocks/output.js similarity index 78% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions-static-blocks/output.js index 99799da63d68..f4b047570ac4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions-static-blocks/output.js @@ -6,7 +6,7 @@ const A = (new (_temp = class extends babelHelpers.identity { } }, (() => { class A {} - [_A, _initClass] = babelHelpers.applyDecs2303(A, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2305(A, [], [dec]).c; })(), _temp)(), _A); const B = (new (_temp2 = class extends babelHelpers.identity { constructor() { @@ -14,7 +14,7 @@ const B = (new (_temp2 = class extends babelHelpers.identity { } }, (() => { class C {} - [_C, _initClass2] = babelHelpers.applyDecs2303(C, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2305(C, [], [dec]).c; })(), _temp2)(), _C); const D = (new (_temp3 = class extends babelHelpers.identity { constructor() { @@ -22,32 +22,32 @@ const D = (new (_temp3 = class extends babelHelpers.identity { } }, (() => { class D {} - [_D, _initClass3] = babelHelpers.applyDecs2303(D, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2305(D, [], [dec]).c; })(), _temp3)(), _D); const E = ((new (_temp4 = class extends babelHelpers.identity { constructor() { super(_decorated_class), (() => {})(), _initClass4(); } -}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class2, [], [dec]).c), _temp4)(), _decorated_class), 123); +}, (_class2 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2305(_class2, [], [dec]).c), _temp4)(), _decorated_class), 123); const F = [(new (_temp5 = class extends babelHelpers.identity { constructor() { super(_G), (() => {})(), _initClass5(); } }, (() => { class G {} - [_G, _initClass5] = babelHelpers.applyDecs2303(G, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2305(G, [], [dec]).c; })(), _temp5)(), _G), (new (_temp6 = class extends babelHelpers.identity { constructor() { super(_decorated_class2), (() => {})(), _initClass6(); } -}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class3, [], [dec]).c), _temp6)(), _decorated_class2)]; +}, (_class3 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2305(_class3, [], [dec]).c), _temp6)(), _decorated_class2)]; const H = (new (_temp7 = class extends babelHelpers.identity { constructor() { super(_H), (() => {})(), _initClass7(); } }, (() => { class H extends I {} - [_H, _initClass7] = babelHelpers.applyDecs2303(H, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2305(H, [], [dec]).c; })(), _temp7)(), _H); const J = (new (_temp8 = class extends babelHelpers.identity { constructor() { @@ -55,7 +55,7 @@ const J = (new (_temp8 = class extends babelHelpers.identity { } }, (() => { class K extends L {} - [_K, _initClass8] = babelHelpers.applyDecs2303(K, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2305(K, [], [dec]).c; })(), _temp8)(), _K); function classFactory() { var _initClass9, _decorated_class3, _temp9, _class5; @@ -63,5 +63,5 @@ function classFactory() { constructor() { super(_decorated_class3), (() => {})(), _initClass9(); } - }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class5, [], [dec]).c), _temp9)(), _decorated_class3; + }, (_class5 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2305(_class5, [], [dec]).c), _temp9)(), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions/output.js similarity index 63% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions/output.js index 0fba5b7a4a85..39492606f0e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/expressions/output.js @@ -1,13 +1,13 @@ var _initClass, _A, _class, _initClass2, _C, _class2, _initClass3, _D, _class3, _initClass4, _decorated_class, _class4, _initClass5, _G, _class5, _initClass6, _decorated_class2, _class6, _initClass7, _H, _class7, _initClass8, _K, _class8; const dec = () => {}; -const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _A); -const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2303(_class2, [], [dec]).c, _initClass2()), _C); -const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2303(_class3, [], [dec]).c, _initClass3()), _D); -const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(_class4, [], [dec]).c, _initClass4()), _decorated_class), 123); -const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2303(_class5, [], [dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(_class6, [], [dec]).c, _initClass6()), _decorated_class2)]; -const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2303(_class7, [], [dec]).c, _initClass7()), _H); -const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2303(_class8, [], [dec]).c, _initClass8()), _K); +const A = ((_class = class A {}, [_A, _initClass] = babelHelpers.applyDecs2305(_class, [], [dec]).c, _initClass()), _A); +const B = ((_class2 = class C {}, [_C, _initClass2] = babelHelpers.applyDecs2305(_class2, [], [dec]).c, _initClass2()), _C); +const D = ((_class3 = class D {}, [_D, _initClass3] = babelHelpers.applyDecs2305(_class3, [], [dec]).c, _initClass3()), _D); +const E = (((_class4 = class {}, [_decorated_class, _initClass4] = babelHelpers.applyDecs2305(_class4, [], [dec]).c, _initClass4()), _decorated_class), 123); +const F = [((_class5 = class G {}, [_G, _initClass5] = babelHelpers.applyDecs2305(_class5, [], [dec]).c, _initClass5()), _G), ((_class6 = class {}, [_decorated_class2, _initClass6] = babelHelpers.applyDecs2305(_class6, [], [dec]).c, _initClass6()), _decorated_class2)]; +const H = ((_class7 = class H extends I {}, [_H, _initClass7] = babelHelpers.applyDecs2305(_class7, [], [dec]).c, _initClass7()), _H); +const J = ((_class8 = class K extends L {}, [_K, _initClass8] = babelHelpers.applyDecs2305(_class8, [], [dec]).c, _initClass8()), _K); function classFactory() { var _initClass9, _decorated_class3, _class9; - return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(_class9, [], [dec]).c, _initClass9()), _decorated_class3; + return (_class9 = class {}, [_decorated_class3, _initClass9] = babelHelpers.applyDecs2305(_class9, [], [dec]).c, _initClass9()), _decorated_class3; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/output.js similarity index 57% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/output.js index d975b8c90b39..209979bb08ca 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/inheritance/output.js @@ -3,9 +3,9 @@ const dec1 = () => {}; const dec2 = () => {}; let _Bar; class Bar {} -[_Bar, _initClass] = babelHelpers.applyDecs2303(Bar, [], [dec1]).c; +[_Bar, _initClass] = babelHelpers.applyDecs2305(Bar, [], [dec1]).c; _initClass(); let _Foo; class Foo extends _Bar {} -[_Foo, _initClass2] = babelHelpers.applyDecs2303(Foo, [], [dec2]).c; +[_Foo, _initClass2] = babelHelpers.applyDecs2305(Foo, [], [dec2]).c; _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/output.js index 0da569b21815..1e98b9b425e5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/initializers/output.js @@ -7,7 +7,7 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(Foo, [], [dec]).c; })(), _temp)(); let _Bar; new (_temp2 = class extends babelHelpers.identity { @@ -18,5 +18,5 @@ new (_temp2 = class extends babelHelpers.identity { } }, (() => { class Bar extends _Foo {} - [_Bar, _initClass2] = babelHelpers.applyDecs2303(Bar, [], [dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2305(Bar, [], [dec]).c; })(), _temp2)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/options.json similarity index 68% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/options.json index 78dfc85292c5..90031fe8187a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-properties", "proposal-private-methods", "proposal-class-static-block" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/output.js similarity index 91% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/output.js index b640a010c1a9..e6413e032983 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -16,6 +16,6 @@ new (_x = /*#__PURE__*/new WeakMap(), _m = /*#__PURE__*/new WeakSet(), (_temp = class Foo { static m() {} } - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(Foo, [], [dec]).c; })(), _temp))(); function _m2() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/output.js index 3e9c496a2f5b..4c7f4fae492d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-static-this/output.js @@ -11,5 +11,5 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(Foo, [], [dec]).c; })(), _temp)(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/output.js similarity index 77% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/output.js index ba5b7da737a3..6f91424929d4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement-with-expr/output.js @@ -4,5 +4,5 @@ const Foo = ((_class = class Bar { constructor() { babelHelpers.defineProperty(this, "bar", new _Bar()); } -}, [_Bar, _initClass] = babelHelpers.applyDecs2303(_class, [], [dec]).c, _initClass()), _Bar); +}, [_Bar, _initClass] = babelHelpers.applyDecs2305(_class, [], [dec]).c, _initClass()), _Bar); const foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/output.js index ea526413bad4..636e8ad68440 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes--to-es2015/replacement/output.js @@ -7,6 +7,6 @@ new (_temp = class extends babelHelpers.identity { } }, (() => { class Foo {} - [_Foo, _initClass] = babelHelpers.applyDecs2303(Foo, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(Foo, [], [dec]).c; })(), _temp)(); const foo = new _Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/output.js index 439521f4f065..f280a7062001 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-fields/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-fields/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_init_m], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[memberDec, 0, "m"]], [classDec])); + } = babelHelpers.applyDecs2305(this, [[memberDec, 0, "m"]], [classDec])); } m = _init_m(this); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/output.js similarity index 84% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/output.js index e9b3ade00991..79e6ff7facb3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/decorator-access-modified-methods/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/decorator-access-modified-methods/output.js @@ -11,7 +11,7 @@ class C { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[memberDec, 2, "m"]], [classDec])); + } = babelHelpers.applyDecs2305(this, [[memberDec, 2, "m"]], [classDec])); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions-static-blocks/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions-static-blocks/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions-static-blocks/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions-static-blocks/output.js index 3c1e27d025f1..ec19f58026e5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions-static-blocks/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions-static-blocks/output.js @@ -4,7 +4,7 @@ const A = (new class extends babelHelpers.identity { static { class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -16,7 +16,7 @@ const B = (new class extends babelHelpers.identity { static { class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -28,7 +28,7 @@ const D = (new class extends babelHelpers.identity { static { class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -40,7 +40,7 @@ const E = ((new class extends babelHelpers.identity { static { (class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2305(this, [], [dec]).c; } }); } @@ -52,7 +52,7 @@ const F = [(new class extends babelHelpers.identity { static { class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -63,7 +63,7 @@ const F = [(new class extends babelHelpers.identity { static { (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2305(this, [], [dec]).c; } }); } @@ -75,7 +75,7 @@ const H = (new class extends babelHelpers.identity { static { class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -87,7 +87,7 @@ const J = (new class extends babelHelpers.identity { static { class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -101,7 +101,7 @@ function classFactory() { static { (class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2305(this, [], [dec]).c; } }); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions/output.js similarity index 71% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/expressions/output.js index 29db6d8050d3..9391b1e2597f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-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.applyDecs2303(this, [], [dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass(); @@ -10,7 +10,7 @@ const A = (class A { }, _A); const B = (class C { static { - [_C, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_C, _initClass2] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass2(); @@ -18,7 +18,7 @@ const B = (class C { }, _C); const D = (class D { static { - [_D, _initClass3] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_D, _initClass3] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass3(); @@ -26,7 +26,7 @@ const D = (class D { }, _D); const E = ((class { static { - [_decorated_class, _initClass4] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class, _initClass4] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass4(); @@ -34,14 +34,14 @@ const E = ((class { }, _decorated_class), 123); const F = [(class G { static { - [_G, _initClass5] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_G, _initClass5] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass5(); } }, _G), (class { static { - [_decorated_class2, _initClass6] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class2, _initClass6] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass6(); @@ -49,7 +49,7 @@ const F = [(class G { }, _decorated_class2)]; const H = (class H extends I { static { - [_H, _initClass7] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_H, _initClass7] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass7(); @@ -57,7 +57,7 @@ const H = (class H extends I { }, _H); const J = (class K extends L { static { - [_K, _initClass8] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_K, _initClass8] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass8(); @@ -67,7 +67,7 @@ function classFactory() { var _initClass9, _decorated_class3; return class { static { - [_decorated_class3, _initClass9] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_decorated_class3, _initClass9] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static { _initClass9(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/inheritance/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/inheritance/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/inheritance/output.js similarity index 67% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/inheritance/output.js index aa47aff8ef04..5ee04e699f16 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/inheritance/output.js @@ -4,7 +4,7 @@ let _Bar; _dec = dec1; class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2305(this, [], [_dec]).c; } static { _initClass(); @@ -14,7 +14,7 @@ let _Foo; _dec2 = dec2; class Foo extends _Bar { static { - [_Foo, _initClass2] = babelHelpers.applyDecs2303(this, [], [_dec2]).c; + [_Foo, _initClass2] = babelHelpers.applyDecs2305(this, [], [_dec2]).c; } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/initializers/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/initializers/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/initializers/output.js similarity index 79% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/initializers/output.js index eecf942bf26e..23906884f271 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/initializers/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } @@ -19,7 +19,7 @@ new class extends babelHelpers.identity { static { class Bar extends _Foo { static { - [_Bar, _initClass2] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Bar, _initClass2] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-installed-on-correct-class/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-installed-on-correct-class/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-installed-on-correct-class/output.js similarity index 84% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-installed-on-correct-class/output.js index 32335a927df2..7216dda60846 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-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.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } static m() {} } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-this/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-this/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-this/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-this/output.js index e187fdb62453..66c8ef5979ee 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-static-this/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-with-expr/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-with-expr/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-with-expr/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-with-expr/output.js index 771c60816010..73da860bd0ed 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement-with-expr/output.js @@ -2,7 +2,7 @@ var _initClass, _Bar; const dec = () => {}; const Foo = (class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Bar, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } bar = new _Bar(); static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement/output.js similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement/output.js index 7b4c9179c1c6..fdced4d4f3b7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-classes/replacement/output.js @@ -5,7 +5,7 @@ new class extends babelHelpers.identity { static { class Foo { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index 7ddef3be40d9..44378e06bd5f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 9c9448835538..e3a195f2a774 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -13,4 +13,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/output.js similarity index 77% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/output.js index adc3006a8190..70726746ac71 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/method-and-field/output.js @@ -8,4 +8,4 @@ class Foo { return 1; } } -[_init_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; +[_init_a, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/output.js index 3fe80ca58e17..269d5980d4bf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -11,4 +11,4 @@ class Foo { return 2; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, "a"], [dec, 2, "a"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/options.json similarity index 68% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/options.json index 78dfc85292c5..90031fe8187a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-accessors--to-es2015/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys--to-es2015/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-properties", "proposal-private-methods", "proposal-class-static-block" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-ast/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-ast/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-ast/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-ast/output.js index b409741c95c1..cfbba5d6cf27 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-ast/output.js @@ -4,7 +4,7 @@ _computedKey = getKey(); _computedKey2 = getKey(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-value/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-value/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-value/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-value/output.js index 00bd162f0999..1a58d243573e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/computed-keys-same-value/output.js @@ -4,7 +4,7 @@ _computedKey = getKeyI(); _computedKey2 = getKeyJ(); class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/method-and-field/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/method-and-field/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/method-and-field/output.js similarity index 74% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/method-and-field/output.js index 53f2911d5016..4bf204f4686a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/method-and-field/output.js @@ -2,7 +2,7 @@ var _init_a, _initProto; const dec = () => {}; class Foo { static { - [_init_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; + [_init_a, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "a"], [dec, 0, "a"]], []).e; } a = (_initProto(this), _init_a(this, 123)); a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/methods-with-same-key/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/methods-with-same-key/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/methods-with-same-key/output.js similarity index 75% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/methods-with-same-key/output.js index 427a72d2aaf6..b05c1ca3ee94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/methods-with-same-key/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "a"], [dec, 2, "a"]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-duplicated-keys/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-anonymous/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-anonymous/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-anonymous/output.mjs similarity index 67% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-anonymous/output.mjs index 27714fc7f865..0269b8ef738d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-anonymous/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-anonymous/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2305(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-named/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-named/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-named/output.mjs similarity index 71% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-named/output.mjs index 4e00a527e4ec..dc9a83f0b5a9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/default-named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/default-named/output.mjs @@ -3,7 +3,7 @@ let _default2; _dec = dec; class _default { static { - [_default2, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_default2, _initClass] = babelHelpers.applyDecs2305(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/member-decorator/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/member-decorator/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/member-decorator/output.mjs similarity index 60% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/member-decorator/output.mjs index 6a95338049fa..fc487029f496 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/member-decorator/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/member-decorator/output.mjs @@ -2,7 +2,7 @@ var _dec, _init_x; _dec = dec; export class A { static { - [_init_x] = babelHelpers.applyDecs2303(this, [[_dec, 0, "x"]], []).e; + [_init_x] = babelHelpers.applyDecs2305(this, [[_dec, 0, "x"]], []).e; } x = _init_x(this); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/named/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/named/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/named/output.mjs similarity index 66% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/named/output.mjs index ccec1e265258..3eae3eec47d2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/named/output.mjs +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/named/output.mjs @@ -3,7 +3,7 @@ let _A; _dec = dec; class A { static { - [_A, _initClass] = babelHelpers.applyDecs2303(this, [], [_dec]).c; + [_A, _initClass] = babelHelpers.applyDecs2305(this, [], [_dec]).c; } static { _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/no-decorators/input.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/input.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/no-decorators/input.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/no-decorators/output.mjs similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-exported/no-decorators/output.mjs rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/no-decorators/output.mjs diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-exported/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/options.json similarity index 68% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/options.json index 78dfc85292c5..90031fe8187a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-duplicated-keys--to-es2015/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-properties", "proposal-private-methods", "proposal-class-static-block" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/output.js similarity index 91% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/output.js index 09e5e8b4588e..5e014f1e0022 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/private/output.js @@ -14,4 +14,4 @@ class Foo { }); } } -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; +[_init_a, _init_b] = babelHelpers.applyDecs2305(Foo, [[dec, 0, "a", o => babelHelpers.classPrivateFieldGet(o, _a), (o, v) => babelHelpers.classPrivateFieldSet(o, _a, v)], [dec, 0, "b", o => babelHelpers.classPrivateFieldGet(o, _b), (o, v) => babelHelpers.classPrivateFieldSet(o, _b, v)]], [], 0, _ => _b.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/output.js similarity index 86% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/output.js index a022b9921fcb..4b6f87585eb3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/public/output.js @@ -8,4 +8,4 @@ class Foo { babelHelpers.defineProperty(this, _computedKey, _init_computedKey(this, 456)); } } -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2305(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/output.js index 600bc4ed58c7..888a72a454f2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-private/output.js @@ -1,7 +1,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo {} -[_init_a, _init_b] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [dec, 8, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; +[_init_a, _init_b] = babelHelpers.applyDecs2305(Foo, [[dec, 8, "a", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _a), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _a, v)], [dec, 8, "b", o => babelHelpers.classStaticPrivateFieldSpecGet(o, Foo, _b), (o, v) => babelHelpers.classStaticPrivateFieldSpecSet(o, Foo, _b, v)]], []).e; var _a = { writable: true, value: _init_a(Foo) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/output.js similarity index 85% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/output.js index 4d58d500c721..a708464cb337 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields--to-es2015/static-public/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b, _computedKey, _init_computedKey; const dec = () => {}; _computedKey = 'c'; class Foo {} -[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(Foo, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; +[_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2305(Foo, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); babelHelpers.defineProperty(Foo, "b", _init_b(Foo, 123)); babelHelpers.defineProperty(Foo, _computedKey, _init_computedKey(Foo, 456)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/private/output.js similarity index 78% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/private/output.js index b157c17a1579..e118ca78ccec 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(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_b] = babelHelpers.applyDecs2305(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; } #a = _init_a(this); #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/public/output.js index d654f2719616..922c8f793e57 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2305(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []).e; } a = _init_a(this); b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-private/output.js similarity index 78% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-private/output.js index 44fd38e41add..4150e9947f1f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-private/output.js @@ -2,7 +2,7 @@ var _init_a, _init_b; const dec = () => {}; class Foo { static { - [_init_a, _init_b] = babelHelpers.applyDecs2303(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_b] = babelHelpers.applyDecs2305(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(this); static #b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-public/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-public/output.js index 8a17282aba1a..ced0276ccf0a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-fields/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'c'; class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2303(this, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs2305(this, [[dec, 8, "a"], [dec, 8, "b"], [dec, 8, _computedKey]], []).e; } static a = _init_a(this); static b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js index 8a330f603114..3d04c19d1698 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _get_a() { return _call_a(this); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 3, "a", function () { return this.value; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js index 763867651958..81bc3aa71767 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/output.js similarity index 85% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/output.js index 3c4ec052328d..b12d94be3fb2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: void 0 }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 11, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/output.js index d85f72267c4f..f3a99040dff7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js similarity index 91% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js index 385df14cddac..a8669c2bc544 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/private/output.js @@ -23,7 +23,7 @@ function _get_a() { function _set_a(v) { _call_a2(this, v); } -[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a", function () { +[_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 3, "a", function () { return this.value; }], [dec, 4, "a", function (v) { this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js index 8d381858681b..0a94d7d3a1af 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/public/output.js @@ -20,4 +20,4 @@ class Foo { this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/output.js similarity index 90% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/output.js index d74e35f45d5d..05a30c307f11 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-private/output.js @@ -19,7 +19,7 @@ var _a = { set: _set_a }; (() => { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 11, "a", function () { return this.value; }], [dec, 12, "a", function (v) { this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/output.js index f0dad4e9d5d1..2ad222223db6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters--to-es2015/static-public/output.js @@ -17,7 +17,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js index efd554e85844..b1df32728c7f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _call_a2, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a", function () { return this.value; }], [dec, 4, "a", function (v) { this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js index 319f7189bd08..5e11ed318222 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-private/output.js similarity index 92% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-private/output.js index 06fe9efca701..168ed643a964 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _call_a2, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a", function () { + [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 11, "a", function () { return this.value; }], [dec, 12, "a", function (v) { this.value = v; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-public/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-public/output.js index edf6fda322a3..ca36aed1af62 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters-and-setters/static-public/output.js @@ -4,7 +4,7 @@ _computedKey = 'b'; _computedKey2 = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(this, [[dec, 11, "a"], [dec, 12, "a"], [dec, 11, _computedKey], [dec, 12, _computedKey2]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js index 090e373bbd1c..5f696817f78d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a", function () { return this.value; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js index f9255dccc6ec..95bd7ee3235e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-private/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-private/output.js index c151d554a936..e409b9a19438 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 11, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-public/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-public/output.js index 382348b31248..d924f9a613f3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-getters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(this, [[dec, 11, "a"], [dec, 11, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private-with-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private-with-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private-with-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js index 26eed5e4f435..730d8deeefe1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/private/output.js @@ -14,6 +14,6 @@ class Foo { return babelHelpers.classPrivateFieldGet(this, _a).call(this); } } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a", function () { +[_call_a, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, "a", function () { return this.value; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public-with-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public-with-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public-with-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js index 570adc92fb1a..8a4e58184d16 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private-with-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private-with-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private-with-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/output.js similarity index 84% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/output.js index ac0ca1b4c3b5..9d80d32f442f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-private/output.js @@ -6,7 +6,7 @@ class Foo { } } (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 10, "a", function () { return this.value; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public-with-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public-with-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public-with-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/output.js index e9d13491fe3d..0aadaa343295 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js index fa5f691bb4e4..1f2a2abb25d1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a", function () { + [_call_a, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "a", function () { return this.value; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js index ecb55e9ba21f..08e57bbaf923 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-private/output.js similarity index 80% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-private/output.js index be23a5c8f0bd..c1db8be452fc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 10, "a", function () { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 10, "a", function () { return this.value; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-public/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-public/output.js index f606920bdc0b..843617af4d3e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-methods/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(this, [[dec, 10, "a"], [dec, 10, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/class-and-method-decorators/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-method-decorators/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/class-and-method-decorators/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/class-and-property-decorators/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/class-and-property-decorators/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/class-and-property-decorators/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/decorator-evaluation-scope/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/decorator-evaluation-scope/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/decorator-evaluation-scope/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js index 41f3d5c3604b..96026932df55 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -9,4 +9,4 @@ class A extends B { } method() {} } -[_initProto] = babelHelpers.applyDecs2303(A, [[_dec, 2, "method"]], []).e; +[_initProto] = babelHelpers.applyDecs2305(A, [[_dec, 2, "method"]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initializer-property-ignored/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-property-ignored/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initializer-property-ignored/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initializer-timing/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/initializer-timing/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/initializer-timing/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/leaked-context-addInitializer-throw/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/leaked-context-addInitializer-throw/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/leaked-context-addInitializer/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/leaked-context-addInitializer/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/leaked-context-addInitializer/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/super-in-decorator/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/super-in-decorator/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/super-in-decorator/output.js similarity index 85% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/super-in-decorator/output.js index df26042793a7..b977fb657630 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/super-in-decorator/output.js @@ -15,7 +15,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(C, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); + } = babelHelpers.applyDecs2305(C, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); _initClass(); } } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/output.js similarity index 90% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/output.js index 4bc5ec015b5f..cbd9f3b7e277 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/this/output.js @@ -21,5 +21,5 @@ class A { ({ e: [_init_x, _init_y], c: [_A, _initClass] -} = babelHelpers.applyDecs2303(A, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); +} = babelHelpers.applyDecs2305(A, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js index fa98039e6116..7d5829ccd30b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc--to-es2015/valid-expression-formats/output.js @@ -27,11 +27,11 @@ class Foo { constructor() { babelHelpers.defineProperty(this, "bar", _init_bar(this)); } - }, [_init_bar] = babelHelpers.applyDecs2303(_class, [[_dec9, 0, "bar"]], []).e, _class); + }, [_init_bar] = babelHelpers.applyDecs2305(_class, [[_dec9, 0, "bar"]], []).e, _class); } } ({ e: [_initProto], c: [_Foo, _initClass] -} = babelHelpers.applyDecs2303(Foo, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); +} = babelHelpers.applyDecs2305(Foo, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); _initClass(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/all-decorators/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/all-decorators/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/all-decorators/output.js similarity index 97% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/all-decorators/output.js index 77ccc56af3af..f72010c74a38 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/all-decorators/output.js @@ -8,7 +8,7 @@ new class extends babelHelpers.identity { ({ e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get_r, _set_r, _init_d, _call_f, _call_g, _call_g2, _init_h, _get_h, _set_h, _init_i, _init_n, _init_a, _init_e, _initProto, _initStatic], c: [_Class, _initClass] - } = babelHelpers.applyDecs2303(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.applyDecs2305(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 _)); _initStatic(this); } #f = _call_f; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/decorator-evaluation-scope/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/decorator-evaluation-scope/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/decorator-evaluation-scope/options.json similarity index 61% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/decorator-evaluation-scope/options.json index fa55e7652b1a..c70512252968 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/decorator-evaluation-scope/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/decorator-evaluation-scope/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-static-block" ], "minNodeVersion": "12.0.0" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor-multiple-super/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor-multiple-super/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor-multiple-super/output.js similarity index 78% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor-multiple-super/output.js index e90a08e474bd..6ad6fa2fe920 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _dec = deco; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[_dec, 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[_dec, 2, "method"]], []).e; } constructor() { if (Math.random() > 0.5) { @@ -17,7 +17,7 @@ class A extends B { _dec2 = deco; class C extends B { static { - [_initProto2] = babelHelpers.applyDecs2303(this, [[_dec2, 2, "method"]], []).e; + [_initProto2] = babelHelpers.applyDecs2305(this, [[_dec2, 2, "method"]], []).e; } constructor() { try { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js index e20913dffe63..b28d62844d7c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initProto-existing-derived-constructor/output.js @@ -2,7 +2,7 @@ var _initProto; const dec = () => {}; class A extends B { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "method"]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "method"]], []).e; } constructor() { let a = 2; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initializer-property-ignored/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initializer-property-ignored/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initializer-property-ignored/options.json similarity index 61% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initializer-property-ignored/options.json index fa55e7652b1a..c70512252968 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/initializer-property-ignored/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/initializer-property-ignored/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["proposal-decorators", { "version": "2023-03" }], + ["proposal-decorators", { "version": "2023-05" }], "proposal-class-static-block" ], "minNodeVersion": "12.0.0" diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/private-keys-in-enclosing-class/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/private-keys-in-enclosing-class/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/private-keys-in-enclosing-class/output.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/private-keys-in-enclosing-class/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/private-keys-in-enclosing-class/output.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-array-pattern/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-array-pattern/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-array-pattern/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-array-pattern/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-array-pattern/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-for-of/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-for-of/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-for-of/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-for-of/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-for-of/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-object-pattern/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-object-pattern/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-object-pattern/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-object-pattern/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-object-pattern/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-rest/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-rest/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-rest/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-rest/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-rest/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-update/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-update/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-update/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method-via-update/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method-via-update/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/setting-private-method/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/setting-private-method/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-decorator/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-decorator/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-decorator/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-decorator/output.js index 544fc2f8c916..04a2be72ff77 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-decorator/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-decorator/output.js @@ -11,7 +11,7 @@ class A extends B { ({ e: [_initProto], c: [_C, _initClass] - } = babelHelpers.applyDecs2303(this, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); + } = babelHelpers.applyDecs2305(this, [[[_obj2, _dec2], 18, "m2"]], [_obj, _dec], 1)); } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-nested-constructor-expression/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-nested-constructor-expression/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-nested-constructor-expression/output.js similarity index 73% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-nested-constructor-expression/output.js index da70eb6e4869..267564aaae78 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-nested-constructor-expression/output.js @@ -3,7 +3,7 @@ const dec = () => {}; let _Foo; class Foo extends Bar { static { - [_Foo, _initClass] = babelHelpers.applyDecs2303(this, [], [dec]).c; + [_Foo, _initClass] = babelHelpers.applyDecs2305(this, [], [dec]).c; } constructor() { let foo = super(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-accessor/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-accessor/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-accessor/output.js similarity index 84% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-accessor/output.js index c7de91d2c094..cc2ef8ee435f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-accessor/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 3, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 3, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-method/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-method/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-method/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-method/output.js index 7f76ac041fb8..1a370c02ff33 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/super-in-private-method/output.js @@ -2,7 +2,7 @@ var _call_x, _initProto; const dec = () => {}; class Foo extends Bar { static { - [_call_x, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 2, "x", function () { + [_call_x, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 2, "x", function () { return babelHelpers.get(babelHelpers.getPrototypeOf(Foo), "foo", this).call(this); }]], [], 0, _ => #x in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/options.json similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/options.json rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/options.json diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/output.js similarity index 90% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/output.js index 6e35346d25da..cc5c62df7399 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/this/output.js @@ -17,7 +17,7 @@ class A { ({ e: [_init_x, _init_y], c: [_A, _initClass] - } = babelHelpers.applyDecs2303(this, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); + } = babelHelpers.applyDecs2305(this, [[[_obj3, _dec4, _obj4, _dec5], 16, "x"], [[_obj5, _dec6, void 0, _dec7], 16, "y"]], [_obj, _dec, void 0, _dec2, _obj2, _dec3], 1)); } x = _init_x(this); y = _init_y(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js similarity index 87% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js index 8a1c97c12e02..3bb5e2ef71f6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-misc/valid-expression-formats/output.js @@ -16,7 +16,7 @@ class Foo { ({ e: [_initProto], c: [_Foo, _initClass] - } = babelHelpers.applyDecs2303(this, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); + } = babelHelpers.applyDecs2305(this, [[[void 0, dec, void 0, _dec5, void 0, _dec6, void 0, _dec7, _obj2, _dec8], 18, "method"]], [void 0, dec, void 0, _dec, void 0, _dec2, void 0, _dec3, _obj, _dec4], 1)); } constructor(...args) { _initProto(this); @@ -27,7 +27,7 @@ class Foo { var _obj3, _dec9, _init_bar; return _obj3 = this, _dec9 = this.#a, class Nested { static { - [_init_bar] = babelHelpers.applyDecs2303(this, [[[_obj3, _dec9], 16, "bar"]], []).e; + [_init_bar] = babelHelpers.applyDecs2305(this, [[[_obj3, _dec9], 16, "bar"]], []).e; } bar = _init_bar(this); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-fields/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-initializers-setters/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-accessor-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/accessor-static-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-accessor-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering--to-es2015/static-field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-fields/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-initializers-setters/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-accessor-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/accessor-static-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/field/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/field/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/field/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/options.json new file mode 100644 index 000000000000..480fe17629b4 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]], + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-accessor-method-initializers/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-field-initializers-after-methods/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-ordering/static-field-initializers-after-methods/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-field-initializers-after-methods/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-accessor-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-add-initializer/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-add-initializer/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-class-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-field-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-getter-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-method-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/invalid-setter-decorator-return/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-runtime-errors--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/options.json new file mode 100644 index 000000000000..90031fe8187a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2023-05" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js similarity index 88% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js index 2cd3cf38d5e4..bbe10fb4677a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/private/output.js @@ -17,6 +17,6 @@ class Foo { function _set_a(v) { _call_a(this, v); } -[_call_a, _initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a", function (v) { +[_call_a, _initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 4, "a", function (v) { return this.value = v; }]], [], 0, _ => _a.has(babelHelpers.checkInRHS(_))).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js index 48da3f7bfcfb..41cd48423ff5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/public/output.js @@ -13,4 +13,4 @@ class Foo { return this.value = v; } } -[_initProto] = babelHelpers.applyDecs2303(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; +[_initProto] = babelHelpers.applyDecs2305(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/output.js similarity index 85% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/output.js index ae469ad44203..cc884c193f4d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-private/output.js @@ -13,7 +13,7 @@ var _a = { set: _set_a }; (() => { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(Foo); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/exec.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/exec.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/exec.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/output.js similarity index 83% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/output.js index a49448d428ef..b035cd37ae2c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters--to-es2015/static-public/output.js @@ -10,7 +10,7 @@ class Foo { } } (() => { - [_initStatic] = babelHelpers.applyDecs2303(Foo, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(Foo, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; _initStatic(Foo); })(); babelHelpers.defineProperty(Foo, "value", 1); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/options.json new file mode 100644 index 000000000000..15054fd05183 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2023-05" }]] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js index 267191900af3..73a6d735335e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/private/output.js @@ -2,7 +2,7 @@ var _call_a, _initProto; const dec = () => {}; class Foo { static { - [_call_a, _initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a", function (v) { + [_call_a, _initProto] = babelHelpers.applyDecs2305(this, [[dec, 4, "a", function (v) { return this.value = v; }]], [], 0, _ => #a in _).e; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js index 5fea5ec2b8cb..1af777204389 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initProto] = babelHelpers.applyDecs2303(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; + [_initProto] = babelHelpers.applyDecs2305(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []).e; } constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-private/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-private/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-private/output.js similarity index 81% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-private/output.js index 8514769ec2a3..201e9f0463bf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-private/output.js @@ -2,7 +2,7 @@ var _call_a, _initStatic; const dec = () => {}; class Foo { static { - [_call_a, _initStatic] = babelHelpers.applyDecs2303(this, [[dec, 12, "a", function (v) { + [_call_a, _initStatic] = babelHelpers.applyDecs2305(this, [[dec, 12, "a", function (v) { return this.value = v; }]], []).e; _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-public/input.js similarity index 100% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/input.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-public/input.js diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-public/output.js similarity index 82% rename from packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js rename to packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-public/output.js index 1b2f3ed16969..fdb2ec3a0d61 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-03-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-setters/static-public/output.js @@ -3,7 +3,7 @@ const dec = () => {}; _computedKey = 'b'; class Foo { static { - [_initStatic] = babelHelpers.applyDecs2303(this, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; + [_initStatic] = babelHelpers.applyDecs2305(this, [[dec, 12, "a"], [dec, 12, _computedKey]], []).e; _initStatic(this); } static value = 1; diff --git a/packages/babel-plugin-syntax-decorators/src/index.ts b/packages/babel-plugin-syntax-decorators/src/index.ts index 1fe36fb7658e..992ff5b8a33e 100644 --- a/packages/babel-plugin-syntax-decorators/src/index.ts +++ b/packages/babel-plugin-syntax-decorators/src/index.ts @@ -10,7 +10,7 @@ export interface Options { | "2021-12" | "2022-03" | "2023-01" - | "2023-03"; + | "2023-05"; // TODO(Babel 8): Remove decoratorsBeforeExport?: boolean; } @@ -24,11 +24,11 @@ export default declare((api, options: Options) => { if (version === undefined) { throw new Error( "The decorators plugin requires a 'version' option, whose value must be one of: " + - "'2023-03', '2023-01', '2022-03', '2021-12', '2018-09', or 'legacy'.", + "'2023-05', '2023-01', '2022-03', '2021-12', '2018-09', or 'legacy'.", ); } if ( - version !== "2023-03" && + version !== "2023-05" && version !== "2023-01" && version !== "2022-03" && version !== "2021-12" && @@ -63,7 +63,7 @@ export default declare((api, options: Options) => { if (version === undefined) { version = legacy ? "legacy" : "2018-09"; } else if ( - version !== "2023-03" && + version !== "2023-05" && version !== "2023-01" && version !== "2022-03" && version !== "2021-12" && @@ -112,7 +112,7 @@ export default declare((api, options: Options) => { "decoratorAutoAccessors", ); } else { - if (version === "2023-01" || version === "2023-03") { + if (version === "2023-01" || version === "2023-05") { parserOpts.plugins.push( ["decorators", { allowCallParenthesized: false }], "decoratorAutoAccessors", diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 2262a1c7eb89..724ff204671a 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -72,15 +72,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", - "./helpers/applyDecs2303": [ + "./helpers/applyDecs2305": [ { - "node": "./helpers/applyDecs2303.js", - "import": "./helpers/esm/applyDecs2303.js", - "default": "./helpers/applyDecs2303.js" + "node": "./helpers/applyDecs2305.js", + "import": "./helpers/esm/applyDecs2305.js", + "default": "./helpers/applyDecs2305.js" }, - "./helpers/applyDecs2303.js" + "./helpers/applyDecs2305.js" ], - "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", + "./helpers/esm/applyDecs2305": "./helpers/esm/applyDecs2305.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index ef1ce7966ae9..265d9ac5f488 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -71,15 +71,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", - "./helpers/applyDecs2303": [ + "./helpers/applyDecs2305": [ { - "node": "./helpers/applyDecs2303.js", - "import": "./helpers/esm/applyDecs2303.js", - "default": "./helpers/applyDecs2303.js" + "node": "./helpers/applyDecs2305.js", + "import": "./helpers/esm/applyDecs2305.js", + "default": "./helpers/applyDecs2305.js" }, - "./helpers/applyDecs2303.js" + "./helpers/applyDecs2305.js" ], - "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", + "./helpers/esm/applyDecs2305": "./helpers/esm/applyDecs2305.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index ced5ec6d9693..5d5cad35bee3 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -71,15 +71,15 @@ "./helpers/applyDecs2301.js" ], "./helpers/esm/applyDecs2301": "./helpers/esm/applyDecs2301.js", - "./helpers/applyDecs2303": [ + "./helpers/applyDecs2305": [ { - "node": "./helpers/applyDecs2303.js", - "import": "./helpers/esm/applyDecs2303.js", - "default": "./helpers/applyDecs2303.js" + "node": "./helpers/applyDecs2305.js", + "import": "./helpers/esm/applyDecs2305.js", + "default": "./helpers/applyDecs2305.js" }, - "./helpers/applyDecs2303.js" + "./helpers/applyDecs2305.js" ], - "./helpers/esm/applyDecs2303": "./helpers/esm/applyDecs2303.js", + "./helpers/esm/applyDecs2305": "./helpers/esm/applyDecs2305.js", "./helpers/asyncGeneratorDelegate": [ { "node": "./helpers/asyncGeneratorDelegate.js", From 1bbecfaf31963982bee07494e0fbce840bd5912e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 17 May 2023 12:18:50 +0300 Subject: [PATCH 14/15] Run field/accessors initializers in reverse order --- .../babel-helpers/src/helpers-generated.ts | 2 +- .../src/helpers/applyDecs2305.js | 2 +- .../accessor-initializers-fields/exec.js | 8 ++--- .../accessor-initializers-setters/exec.js | 8 ++--- .../accessor-method-initializers/exec.js | 8 ++--- .../exec.js | 16 +++++----- .../exec.js | 8 ++--- .../exec.js | 8 ++--- .../accessor-init-and-set-consistent/exec.js | 31 +++++++++++++++++++ .../accessor-initializers-fields/exec.js | 8 ++--- .../accessor-initializers-setters/exec.js | 8 ++--- .../accessor-method-initializers/exec.js | 8 ++--- .../exec.js | 16 +++++----- .../exec.js | 8 ++--- .../exec.js | 8 ++--- 15 files changed, 89 insertions(+), 58 deletions(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 315f79c0a61b..85b5c056487d 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -39,7 +39,7 @@ export default Object.freeze({ ), applyDecs2305: helper( "7.21.0", - 'import checkInRHS from"checkInRHS";function createAddInitializerMethod(initializers,decoratorFinishedRef){return function(initializer){assertNotFinished(decoratorFinishedRef,"addInitializer"),assertCallable(initializer,"An initializer"),initializers.push(initializer)}}function assertInstanceIfPrivate(has,target){if(!has(target))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(dec,thisArg,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand){var kindStr;switch(kind){case 1:kindStr="accessor";break;case 2:kindStr="method";break;case 3:kindStr="getter";break;case 4:kindStr="setter";break;default:kindStr="field"}var get,set,ctx={kind:kindStr,name:isPrivate?"#"+name:name,static:isStatic,private:isPrivate},decoratorFinishedRef={v:!1};if(0!==kind&&(ctx.addInitializer=createAddInitializerMethod(initializers,decoratorFinishedRef)),isPrivate||0!==kind&&2!==kind)if(2===kind)get=function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.value};else{var t=0===kind||1===kind;(t||3===kind)&&(get=isPrivate?function(target){return assertInstanceIfPrivate(hasPrivateBrand,target),desc.get.call(target)}:function(target){return desc.get.call(target)}),(t||4===kind)&&(set=isPrivate?function(target,value){assertInstanceIfPrivate(hasPrivateBrand,target),desc.set.call(target,value)}:function(target,value){desc.set.call(target,value)})}else get=function(target){return target[name]},0===kind&&(set=function(target,v){target[name]=v});var has=isPrivate?hasPrivateBrand.bind():function(target){return name in target};ctx.access=get&&set?{get:get,set:set,has:has}:get?{get:get,has:has}:{set:set,has:has};try{return dec.call(thisArg,value,ctx)}finally{decoratorFinishedRef.v=!0}}function assertNotFinished(decoratorFinishedRef,fnName){if(decoratorFinishedRef.v)throw new Error("attempted to call "+fnName+" after decoration was finished")}function assertCallable(fn,hint){if("function"!=typeof fn)throw new TypeError(hint+" must be a function")}function assertValidReturnValue(kind,value){var type=typeof value;if(1===kind){if("object"!==type||null===value)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==value.get&&assertCallable(value.get,"accessor.get"),void 0!==value.set&&assertCallable(value.set,"accessor.set"),void 0!==value.init&&assertCallable(value.init,"accessor.init")}else if("function"!==type){var hint;throw hint=0===kind?"field":5===kind?"class":"method",new TypeError(hint+" decorators must return a function or void 0")}}function curryThis1(fn){return function(){return fn(this)}}function curryThis2(fn){return function(value){fn(this,value)}}function applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand){var desc,init,value,newValue,get,set,decs=decInfo[0];decoratorsHaveThis||Array.isArray(decs)||(decs=[decs]),isPrivate?desc=0===kind||1===kind?{get:curryThis1(decInfo[3]),set:curryThis2(decInfo[4])}:3===kind?{get:decInfo[3]}:4===kind?{set:decInfo[3]}:{value:decInfo[3]}:0!==kind&&(desc=Object.getOwnPropertyDescriptor(base,name)),1===kind?value={get:desc.get,set:desc.set}:2===kind?value=desc.value:3===kind?value=desc.get:4===kind&&(value=desc.set);for(var inc=decoratorsHaveThis?2:1,i=decs.length-1;i>=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);existingNonFields.set(name,!(!existingKind&&kind>2)||kind)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i=0;i-=inc){var newInit;if(void 0!==(newValue=memberDec(decs[i],decoratorsHaveThis?decs[i-1]:void 0,name,desc,initializers,kind,isStatic,isPrivate,value,hasPrivateBrand)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.init,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===init?init=newInit:"function"==typeof init?init=[init,newInit]:init.push(newInit))}if(0===kind||1===kind){if(void 0===init)init=function(instance,init){return init};else if("function"!=typeof init){var ownInitializers=init;init=function(instance,init){for(var value=init,i=ownInitializers.length-1;i>=0;i--)value=ownInitializers[i].call(instance,value);return value}}else{var originalInitializer=init;init=function(instance,init){return originalInitializer.call(instance,init)}}ret.push(init)}0!==kind&&(1===kind?(desc.get=value.get,desc.set=value.set):2===kind?desc.value=value:3===kind?desc.get=value:4===kind&&(desc.set=value),isPrivate?1===kind?(ret.push((function(instance,args){return value.get.call(instance,args)})),ret.push((function(instance,args){return value.set.call(instance,args)}))):2===kind?ret.push(value):ret.push((function(instance,args){return value.call(instance,args)})):Object.defineProperty(base,name,desc))}function applyMemberDecs(Class,decInfos,instanceBrand){for(var protoInitializers,staticInitializers,staticBrand,ret=[],existingProtoNonFields=new Map,existingStaticNonFields=new Map,i=0;i3,decoratorsHaveThis=16&kind,isStatic=!!(8&kind),hasPrivateBrand=instanceBrand;if(kind&=7,isStatic?(base=Class,0!==kind&&(initializers=staticInitializers=staticInitializers||[]),isPrivate&&!staticBrand&&(staticBrand=function(_){return checkInRHS(_)===Class}),hasPrivateBrand=staticBrand):(base=Class.prototype,0!==kind&&(initializers=protoInitializers=protoInitializers||[])),0!==kind&&!isPrivate){var existingNonFields=isStatic?existingStaticNonFields:existingProtoNonFields,existingKind=existingNonFields.get(name)||0;if(!0===existingKind||3===existingKind&&4!==kind||4===existingKind&&3!==kind)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: "+name);existingNonFields.set(name,!(!existingKind&&kind>2)||kind)}applyMemberDec(ret,base,decInfo,decoratorsHaveThis,name,kind,isStatic,isPrivate,initializers,hasPrivateBrand)}}return pushInitializers(ret,protoInitializers),pushInitializers(ret,staticInitializers),ret}function pushInitializers(ret,initializers){initializers&&ret.push((function(instance){for(var i=0;i=0;i-=inc){var decoratorFinishedRef={v:!1};try{var nextNewClass=classDecs[i].call(decoratorsHaveThis?classDecs[i-1]:void 0,newClass,{kind:"class",name:name,addInitializer:createAddInitializerMethod(initializers,decoratorFinishedRef)})}finally{decoratorFinishedRef.v=!0}void 0!==nextNewClass&&(assertValidReturnValue(5,nextNewClass),newClass=nextNewClass)}return[newClass,function(){for(var i=0;i= 0; i--) { value = ownInitializers[i].call(instance, value); } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js index a59b51cc2314..ad49bc03d1e7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-fields/exec.js @@ -37,8 +37,8 @@ function logFieldDecoratorRun(a, b) { @logClassDecoratorRun(0, 19, 21) @logClassDecoratorRun(1, 18, 20) class A { - @logAccessorDecoratorRun(2, 11, 23, 27) - @logAccessorDecoratorRun(3, 10, 22, 26) + @logAccessorDecoratorRun(2, 11, 23, 26) + @logAccessorDecoratorRun(3, 10, 22, 27) accessor a; @logFieldDecoratorRun(4, 15) @@ -49,8 +49,8 @@ class A { @logFieldDecoratorRun(7, 16) #c; - @logAccessorDecoratorRun(8, 13, 25, 29) - @logAccessorDecoratorRun(9, 12, 24, 28) + @logAccessorDecoratorRun(8, 13, 25, 28) + @logAccessorDecoratorRun(9, 12, 24, 29) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js index a0f59eb4c551..2d4e63303055 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-initializers-setters/exec.js @@ -38,12 +38,12 @@ function logFieldDecoratorRun(a, b) { @logClassDecoratorRun(0, 11, 13) @logClassDecoratorRun(1, 10, 12) class A { - @logAccessorDecoratorRun(2, 7, 15, 19, 22, 25) - @logAccessorDecoratorRun(3, 6, 14, 18, 23, 24) + @logAccessorDecoratorRun(2, 7, 15, 18, 22, 25) + @logAccessorDecoratorRun(3, 6, 14, 19, 23, 24) accessor a; - @logAccessorDecoratorRun(4, 9, 17, 21, 26, 29) - @logAccessorDecoratorRun(5, 8, 16, 20, 27, 28) + @logAccessorDecoratorRun(4, 9, 17, 20, 26, 29) + @logAccessorDecoratorRun(5, 8, 16, 21, 27, 28) accessor #b; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js index a3efd8e40a6d..405ad66b271b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-method-initializers/exec.js @@ -43,8 +43,8 @@ function logMethodDecoratorRun(a, b, c, d) { @logClassDecoratorRun(0, 19, 21) @logClassDecoratorRun(1, 18, 20) class A { - @logAccessorDecoratorRun(2, 11, 23, 31) - @logAccessorDecoratorRun(3, 10, 22, 30) + @logAccessorDecoratorRun(2, 11, 23, 30) + @logAccessorDecoratorRun(3, 10, 22, 31) accessor a; @logMethodDecoratorRun(4, 13, 25, 35) @@ -55,8 +55,8 @@ class A { @logMethodDecoratorRun(7, 14, 26, 36) #c() {}; - @logAccessorDecoratorRun(8, 17, 29, 33) - @logAccessorDecoratorRun(9, 16, 28, 32) + @logAccessorDecoratorRun(8, 17, 29, 32) + @logAccessorDecoratorRun(9, 16, 28, 33) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js index 448854862950..232218430bdf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-accessor-initializers/exec.js @@ -25,20 +25,20 @@ function logAccessorDecoratorRun(a, b, c, d) { @logClassDecoratorRun(0, 19, 29) @logClassDecoratorRun(1, 18, 28) class A { - @logAccessorDecoratorRun(2, 15, 31, 35) - @logAccessorDecoratorRun(3, 14, 30, 34) + @logAccessorDecoratorRun(2, 15, 31, 34) + @logAccessorDecoratorRun(3, 14, 30, 35) accessor a; - @logAccessorDecoratorRun(4, 11, 21, 25) - @logAccessorDecoratorRun(5, 10, 20, 24) + @logAccessorDecoratorRun(4, 11, 21, 24) + @logAccessorDecoratorRun(5, 10, 20, 25) static accessor b; - @logAccessorDecoratorRun(6, 13, 23, 27) - @logAccessorDecoratorRun(7, 12, 22, 26) + @logAccessorDecoratorRun(6, 13, 23, 26) + @logAccessorDecoratorRun(7, 12, 22, 27) static accessor #c; - @logAccessorDecoratorRun(8, 17, 33, 37) - @logAccessorDecoratorRun(9, 16, 32, 36) + @logAccessorDecoratorRun(8, 17, 33, 36) + @logAccessorDecoratorRun(9, 16, 32, 37) accessor #d; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js index d940e8c8f379..2e6c4f3191f6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/accessor-static-method-initializers/exec.js @@ -47,8 +47,8 @@ class A { A.b(), A.#c(); } - @logAccessorDecoratorRun(2, 15, 31, 35) - @logAccessorDecoratorRun(3, 14, 30, 34) + @logAccessorDecoratorRun(2, 15, 31, 34) + @logAccessorDecoratorRun(3, 14, 30, 35) accessor a; @logMethodDecoratorRun(4, 11, 21, 25) @@ -59,8 +59,8 @@ class A { @logMethodDecoratorRun(7, 12, 22, 26) static #c() {}; - @logAccessorDecoratorRun(8, 17, 33, 37) - @logAccessorDecoratorRun(9, 16, 32, 36) + @logAccessorDecoratorRun(8, 17, 33, 36) + @logAccessorDecoratorRun(9, 16, 32, 37) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js index e1ec45be3190..c3e18ec7f687 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering--to-es2015/static-accessor-method-initializers/exec.js @@ -47,12 +47,12 @@ class A { @logMethodDecoratorRun(3, 14, 30, 34) a() {} - @logAccessorDecoratorRun(4, 11, 21, 25) - @logAccessorDecoratorRun(5, 10, 20, 24) + @logAccessorDecoratorRun(4, 11, 21, 24) + @logAccessorDecoratorRun(5, 10, 20, 25) static accessor b; - @logAccessorDecoratorRun(6, 13, 23, 27) - @logAccessorDecoratorRun(7, 12, 22, 26) + @logAccessorDecoratorRun(6, 13, 23, 26) + @logAccessorDecoratorRun(7, 12, 22, 27) static accessor #c; @logMethodDecoratorRun(8, 17, 33, 37) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js new file mode 100644 index 000000000000..28fddd6262f6 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js @@ -0,0 +1,31 @@ +function minusTwo({ set }) { + return { + set(v) { + set.call(this, v - 2); + }, + init(v) { + return v - 2; + }, + }; +} + +function timesFour({ set }) { + return { + set(v) { + set.call(this, v * 4); + }, + init(v) { + return v * 4; + }, + }; +} + +class Foo { + @minusTwo @timesFour accessor bar = 5; +} +debugger; +const foo = new Foo(); +expect(foo.bar).toBe(12); // (5 - 2) * 4 + +foo.bar = 5; +expect(foo.bar).toBe(12); // (5 - 2) * 4 diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js index a59b51cc2314..ad49bc03d1e7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-fields/exec.js @@ -37,8 +37,8 @@ function logFieldDecoratorRun(a, b) { @logClassDecoratorRun(0, 19, 21) @logClassDecoratorRun(1, 18, 20) class A { - @logAccessorDecoratorRun(2, 11, 23, 27) - @logAccessorDecoratorRun(3, 10, 22, 26) + @logAccessorDecoratorRun(2, 11, 23, 26) + @logAccessorDecoratorRun(3, 10, 22, 27) accessor a; @logFieldDecoratorRun(4, 15) @@ -49,8 +49,8 @@ class A { @logFieldDecoratorRun(7, 16) #c; - @logAccessorDecoratorRun(8, 13, 25, 29) - @logAccessorDecoratorRun(9, 12, 24, 28) + @logAccessorDecoratorRun(8, 13, 25, 28) + @logAccessorDecoratorRun(9, 12, 24, 29) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js index a0f59eb4c551..2d4e63303055 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-initializers-setters/exec.js @@ -38,12 +38,12 @@ function logFieldDecoratorRun(a, b) { @logClassDecoratorRun(0, 11, 13) @logClassDecoratorRun(1, 10, 12) class A { - @logAccessorDecoratorRun(2, 7, 15, 19, 22, 25) - @logAccessorDecoratorRun(3, 6, 14, 18, 23, 24) + @logAccessorDecoratorRun(2, 7, 15, 18, 22, 25) + @logAccessorDecoratorRun(3, 6, 14, 19, 23, 24) accessor a; - @logAccessorDecoratorRun(4, 9, 17, 21, 26, 29) - @logAccessorDecoratorRun(5, 8, 16, 20, 27, 28) + @logAccessorDecoratorRun(4, 9, 17, 20, 26, 29) + @logAccessorDecoratorRun(5, 8, 16, 21, 27, 28) accessor #b; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js index a3efd8e40a6d..405ad66b271b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-method-initializers/exec.js @@ -43,8 +43,8 @@ function logMethodDecoratorRun(a, b, c, d) { @logClassDecoratorRun(0, 19, 21) @logClassDecoratorRun(1, 18, 20) class A { - @logAccessorDecoratorRun(2, 11, 23, 31) - @logAccessorDecoratorRun(3, 10, 22, 30) + @logAccessorDecoratorRun(2, 11, 23, 30) + @logAccessorDecoratorRun(3, 10, 22, 31) accessor a; @logMethodDecoratorRun(4, 13, 25, 35) @@ -55,8 +55,8 @@ class A { @logMethodDecoratorRun(7, 14, 26, 36) #c() {}; - @logAccessorDecoratorRun(8, 17, 29, 33) - @logAccessorDecoratorRun(9, 16, 28, 32) + @logAccessorDecoratorRun(8, 17, 29, 32) + @logAccessorDecoratorRun(9, 16, 28, 33) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js index 448854862950..232218430bdf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-accessor-initializers/exec.js @@ -25,20 +25,20 @@ function logAccessorDecoratorRun(a, b, c, d) { @logClassDecoratorRun(0, 19, 29) @logClassDecoratorRun(1, 18, 28) class A { - @logAccessorDecoratorRun(2, 15, 31, 35) - @logAccessorDecoratorRun(3, 14, 30, 34) + @logAccessorDecoratorRun(2, 15, 31, 34) + @logAccessorDecoratorRun(3, 14, 30, 35) accessor a; - @logAccessorDecoratorRun(4, 11, 21, 25) - @logAccessorDecoratorRun(5, 10, 20, 24) + @logAccessorDecoratorRun(4, 11, 21, 24) + @logAccessorDecoratorRun(5, 10, 20, 25) static accessor b; - @logAccessorDecoratorRun(6, 13, 23, 27) - @logAccessorDecoratorRun(7, 12, 22, 26) + @logAccessorDecoratorRun(6, 13, 23, 26) + @logAccessorDecoratorRun(7, 12, 22, 27) static accessor #c; - @logAccessorDecoratorRun(8, 17, 33, 37) - @logAccessorDecoratorRun(9, 16, 32, 36) + @logAccessorDecoratorRun(8, 17, 33, 36) + @logAccessorDecoratorRun(9, 16, 32, 37) accessor #d; } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js index d940e8c8f379..2e6c4f3191f6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-static-method-initializers/exec.js @@ -47,8 +47,8 @@ class A { A.b(), A.#c(); } - @logAccessorDecoratorRun(2, 15, 31, 35) - @logAccessorDecoratorRun(3, 14, 30, 34) + @logAccessorDecoratorRun(2, 15, 31, 34) + @logAccessorDecoratorRun(3, 14, 30, 35) accessor a; @logMethodDecoratorRun(4, 11, 21, 25) @@ -59,8 +59,8 @@ class A { @logMethodDecoratorRun(7, 12, 22, 26) static #c() {}; - @logAccessorDecoratorRun(8, 17, 33, 37) - @logAccessorDecoratorRun(9, 16, 32, 36) + @logAccessorDecoratorRun(8, 17, 33, 36) + @logAccessorDecoratorRun(9, 16, 32, 37) accessor #d; constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js index e1ec45be3190..c3e18ec7f687 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/static-accessor-method-initializers/exec.js @@ -47,12 +47,12 @@ class A { @logMethodDecoratorRun(3, 14, 30, 34) a() {} - @logAccessorDecoratorRun(4, 11, 21, 25) - @logAccessorDecoratorRun(5, 10, 20, 24) + @logAccessorDecoratorRun(4, 11, 21, 24) + @logAccessorDecoratorRun(5, 10, 20, 25) static accessor b; - @logAccessorDecoratorRun(6, 13, 23, 27) - @logAccessorDecoratorRun(7, 12, 22, 26) + @logAccessorDecoratorRun(6, 13, 23, 26) + @logAccessorDecoratorRun(7, 12, 22, 27) static accessor #c; @logMethodDecoratorRun(8, 17, 33, 37) From f36d67d90b3eccdbb6f6477a7f4bef4d74b30e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 17 May 2023 18:48:50 +0300 Subject: [PATCH 15/15] Update packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js --- .../2023-05-ordering/accessor-init-and-set-consistent/exec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js index 28fddd6262f6..468ab5d32fb1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-05-ordering/accessor-init-and-set-consistent/exec.js @@ -23,7 +23,6 @@ function timesFour({ set }) { class Foo { @minusTwo @timesFour accessor bar = 5; } -debugger; const foo = new Foo(); expect(foo.bar).toBe(12); // (5 - 2) * 4