diff --git a/packages/babel-helpers/src/helpers-generated.ts b/packages/babel-helpers/src/helpers-generated.ts index 5e96bc36f34f..e27f2044bd06 100644 --- a/packages/babel-helpers/src/helpers-generated.ts +++ b/packages/babel-helpers/src/helpers-generated.ts @@ -15,7 +15,7 @@ function helper(minVersion, source) { export default Object.freeze({ applyDecs: helper( "7.17.0", - 'function createMetadataMethodsForProperty(metadataMap,kind,property){return{getMetadata(key){if("symbol"!=typeof key)throw new TypeError("Metadata keys must be symbols, received: "+key);var metadataForKey=metadataMap[key];if(void 0!==metadataForKey)if(1===kind){var pub=metadataForKey.public;if(void 0!==pub)return pub[property]}else if(2===kind){var priv=metadataForKey.private;if(void 0!==priv)return priv.get(property)}else if(Object.hasOwnProperty.call(metadataForKey,"constructor"))return metadataForKey.constructor},setMetadata(key,value){if("symbol"!=typeof key)throw new TypeError("Metadata keys must be symbols, received: "+key);var metadataForKey=metadataMap[key];if(void 0===metadataForKey&&(metadataForKey=metadataMap[key]={}),1===kind){var pub=metadataForKey.public;void 0===pub&&(pub=metadataForKey.public={}),pub[property]=value}else if(2===kind){var priv=metadataForKey.priv;void 0===priv&&(priv=metadataForKey.private=new Map),priv.set(property,value)}else metadataForKey.constructor=value}}}function convertMetadataMapToFinal(obj,metadataMap){var parentMetadataMap=obj[Symbol.metadata||Symbol.for("Symbol.metadata")],metadataKeys=Object.getOwnPropertySymbols(metadataMap);if(0!==metadataKeys.length){for(var i=0;i3,isStatic=kind>=5;if(isStatic?(base=Class,metadataMap=staticMetadataMap,kind-=5,staticInitializers||(staticInitializers=[]),initializers=staticInitializers):(base=Class.prototype,metadataMap=protoMetadataMap,protoInitializers||(protoInitializers=[]),initializers=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,metadataMap,initializers)}}protoInitializers&&pushInitializers(ret,protoInitializers),staticInitializers&&pushInitializers(ret,staticInitializers)}function pushInitializers(ret,initializers){initializers.length>0?(initializers=initializers.slice(),ret.push((function(instance){for(var i=0;i0?ret.push((function(){for(var i=0;i=0;i--){var newInit;if(void 0!==(newValue=(0,decs[i])(value,ctx)))assertValidReturnValue(kind,newValue),0===kind?newInit=newValue:1===kind?(newInit=newValue.initializer,get=newValue.get||value.get,set=newValue.set||value.set,value={get:get,set:set}):value=newValue,void 0!==newInit&&(void 0===initializer?initializer=newInit:"function"==typeof initializer?initializer=[initializer,newInit]:initializer.push(newInit))}if(0===kind||1===kind){if(void 0===initializer)initializer=function(instance,init){return init};else if("function"!=typeof initializer){var ownInitializers=initializer;initializer=function(instance,init){for(var value=init,i=0;i3,isStatic=kind>=5;if(isStatic?(base=Class,metadataMap=staticMetadataMap,kind-=5,initializers=staticInitializers):(base=Class.prototype,metadataMap=protoMetadataMap,initializers=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,metadataMap,initializers)}}protoInitializers.length>0&&pushInitializers(ret,protoInitializers),staticInitializers.length>0&&pushInitializers(ret,staticInitializers)}function pushInitializers(ret,initializers){initializers.length>0?(initializers=initializers.slice(),ret.push((function(instance){for(var i=0;i=0;i--)newClass=classDecs[i](newClass,ctx)||newClass;ret.push(newClass),initializers.length>0?ret.push((function(){for(var i=0;i= 0; i--) { var dec = decs[i]; newValue = dec(value, ctx); @@ -421,8 +421,8 @@ function applyMemberDecs( staticMetadataMap, decInfos ) { - var protoInitializers; - var staticInitializers; + var protoInitializers = []; + var staticInitializers = []; var existingProtoNonFields = new Map(); var existingStaticNonFields = new Map(); @@ -447,19 +447,11 @@ function applyMemberDecs( metadataMap = staticMetadataMap; kind = kind - 5 /* STATIC */; - if (!staticInitializers) { - staticInitializers = []; - } - initializers = staticInitializers; } else { base = Class.prototype; metadataMap = protoMetadataMap; - if (!protoInitializers) { - protoInitializers = []; - } - initializers = protoInitializers; } @@ -499,11 +491,11 @@ function applyMemberDecs( ); } - if (protoInitializers) { + if (protoInitializers.length > 0) { pushInitializers(ret, protoInitializers); } - if (staticInitializers) { + if (staticInitializers.length > 0) { pushInitializers(ret, staticInitializers); } } @@ -541,7 +533,7 @@ function applyClassDecs(ret, targetClass, metadataMap, classDecs) { createMetadataMethodsForProperty(metadataMap, 0 /* CONSTRUCTOR */, name) ); - for (var i = 0; i < classDecs.length; i++) { + for (var i = classDecs.length - 1; i >= 0; i--) { newClass = classDecs[i](newClass, ctx) || newClass; } diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts b/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts index 97be9c463e68..2f4676921163 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts +++ b/packages/babel-plugin-proposal-decorators/src/transformer-2021-12.ts @@ -1,4 +1,4 @@ -import type { NodePath } from "@babel/traverse"; +import type { NodePath, Scope } from "@babel/traverse"; import { types as t, template } from "@babel/core"; import syntaxDecorators from "@babel/plugin-syntax-decorators"; import ReplaceSupers from "@babel/helper-replace-supers"; @@ -506,23 +506,38 @@ function transformClass( let constructorPath: NodePath | undefined; let requiresProtoInit = false; let requiresStaticInit = false; - let hasComputedProps = false; const decoratedPrivateMethods = new Set(); let protoInitLocal: t.Identifier, staticInitLocal: t.Identifier, classInitLocal: t.Identifier, classLocal: t.Identifier; + const assignments: t.AssignmentExpression[] = []; + const scopeParent: Scope = path.scope.parent; + + const memoiseExpression = (expression: t.Expression, hint: string) => { + const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint); + assignments.push(t.assignmentExpression("=", localEvaluatedId, expression)); + return t.cloneNode(localEvaluatedId); + }; if (classDecorators) { - classInitLocal = - path.scope.parent.generateDeclaredUidIdentifier("initClass"); + classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass"); const [localId, classPath] = replaceClassWithVar(path); path = classPath; classLocal = localId; path.node.decorators = null; + + for (const classDecorator of classDecorators) { + if (!scopeParent.isStatic(classDecorator.expression)) { + classDecorator.expression = memoiseExpression( + classDecorator.expression, + "dec", + ); + } + } } else { if (!path.node.id) { path.node.id = path.scope.generateUidIdentifier("Class"); @@ -536,20 +551,42 @@ function transformClass( continue; } - let { key } = element.node; - const kind = getElementKind(element); + const { node } = element; const decorators = element.get("decorators"); - const isPrivate = key.type === "PrivateName"; + const hasDecorators = Array.isArray(decorators) && decorators.length > 0; + + if (hasDecorators) { + for (const decoratorPath of decorators) { + if (!scopeParent.isStatic(decoratorPath.node.expression)) { + decoratorPath.node.expression = memoiseExpression( + decoratorPath.node.expression, + "dec", + ); + } + } + } + const isComputed = "computed" in element.node && element.node.computed === true; + if (isComputed) { + if (!scopeParent.isStatic(node.key)) { + node.key = memoiseExpression(node.key as t.Expression, "computedKey"); + } + } + + const kind = getElementKind(element); + const { key } = node; + + const isPrivate = key.type === "PrivateName"; + const isStatic = !!element.node.static; let name = "computedKey"; if (isPrivate) { name = (key as t.PrivateName).id.name; - } else if (key.type === "Identifier") { + } else if (!isComputed && key.type === "Identifier") { name = key.name; } @@ -557,22 +594,7 @@ function transformClass( constructorPath = element; } - if (isComputed) { - const keyPath = element.get("key"); - const localComputedNameId = - keyPath.scope.parent.generateDeclaredUidIdentifier(name); - keyPath.replaceWith(localComputedNameId); - - elementDecoratorInfo.push({ - localComputedNameId: t.cloneNode(localComputedNameId), - keyNode: t.cloneNode(key as t.Expression), - }); - - key = localComputedNameId; - hasComputedProps = true; - } - - if (Array.isArray(decorators) && decorators.length > 0) { + if (hasDecorators) { let locals: t.Identifier | t.Identifier[]; let privateMethods: t.FunctionExpression | t.FunctionExpression[]; @@ -730,34 +752,6 @@ function transformClass( } } - if (hasComputedProps) { - const assignments: t.AssignmentExpression[] = []; - - for (const info of elementDecoratorInfo) { - if (isDecoratorInfo(info)) { - const { decorators } = info; - const newDecorators: t.Identifier[] = []; - - for (const decorator of decorators) { - const localComputedNameId = - path.scope.parent.generateDeclaredUidIdentifier("dec"); - assignments.push( - t.assignmentExpression("=", localComputedNameId, decorator), - ); - newDecorators.push(t.cloneNode(localComputedNameId)); - } - - info.decorators = newDecorators; - } else { - assignments.push( - t.assignmentExpression("=", info.localComputedNameId, info.keyNode), - ); - } - } - - path.insertBefore(assignments); - } - const elementDecorations = generateDecorationExprs(elementDecoratorInfo); const classDecorations = t.arrayExpression( (classDecorators || []).map(d => d.expression), @@ -766,13 +760,8 @@ function transformClass( const locals: t.Identifier[] = extractElementLocalAssignments(elementDecoratorInfo); - if (classDecorators) { - locals.push(classLocal, classInitLocal); - } - if (requiresProtoInit) { - protoInitLocal = - path.scope.parent.generateDeclaredUidIdentifier("initProto"); + protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto"); locals.push(protoInitLocal); const protoInitCall = t.callExpression(t.cloneNode(protoInitLocal), [ @@ -833,8 +822,7 @@ function transformClass( } if (requiresStaticInit) { - staticInitLocal = - path.scope.parent.generateDeclaredUidIdentifier("initStatic"); + staticInitLocal = scopeParent.generateDeclaredUidIdentifier("initStatic"); locals.push(staticInitLocal); } @@ -879,6 +867,7 @@ function transformClass( const originalClass = path.node; if (classDecorators) { + locals.push(classLocal, classInitLocal); const statics = []; let staticBlocks: t.StaticBlock[] = []; path.get("body.body").forEach(element => { @@ -982,6 +971,10 @@ function transformClass( ), ); + // When path is a ClassExpression, path.insertBefore will convert `path` + // into a SequenceExpression + path.insertBefore(assignments); + // Recrawl the scope to make sure new identifiers are properly synced path.scope.crawl(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js index be4f348923bc..aa152db91d94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js index 69673b7af6d2..2d753e957d94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/private/output.js @@ -1,5 +1,7 @@ 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(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js index 5945d3196f1d..bd8be5cbe225 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js index 2a6057e84caa..c4a2e3b65722 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/public/output.js @@ -1,9 +1,8 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initProto; +var _init_a, _init_b, _computedKey, _init_computedKey, _initProto; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec var _A = /*#__PURE__*/new WeakMap(); @@ -54,5 +53,5 @@ class Foo { } (() => { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(Foo, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(Foo, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js index ebb88a741572..c30e61d463bc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js index b0ec49e5726f..2cd651f5e68a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ 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(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js index edf06478601f..50f05c065848 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js index c5a6ac47eba2..333884b1c59c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/static-public/output.js @@ -1,9 +1,8 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initStatic; +var _init_a, _init_b, _computedKey, _init_computedKey, _initStatic; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { static get a() { @@ -33,7 +32,7 @@ class Foo { } (() => { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(Foo, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []); _initStatic(Foo); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js index 4afc45261337..07804cb8a125 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js index 29d3fbd66965..ff585899f911 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-private/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + var _A = /*#__PURE__*/new WeakMap(); var _a = /*#__PURE__*/new WeakMap(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js index ad27f18d5ed3..62dbd0c0381a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js index 6ec6f9255a06..f737b0e17936 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-public/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + var _A = /*#__PURE__*/new WeakMap(); var _B = /*#__PURE__*/new WeakMap(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js index 2e516a961de9..9e893b86b863 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js index 51de21b149b2..cd052d1aa957 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-private/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo {} function _get_a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js index 160e72cd531c..eb7463cb9fc1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js index 4fe37de40ebf..8ebb5ed6cba4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors--to-es2015/undecorated-static-public/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo { static get a() { return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _A); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/input.js index be4f348923bc..aa152db91d94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js index c054a288032a..90e773d6dee2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/private/output.js @@ -1,5 +1,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.applyDecs(this, [[dec, 1, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/input.js index 5945d3196f1d..bd8be5cbe225 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js index 0fb94194b1db..78dcb770052c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/public/output.js @@ -1,13 +1,12 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initProto; +var _init_a, _init_b, _computedKey, _init_computedKey, _initProto; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { static { - [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(this, [[_dec, 1, "a"], [_dec2, 1, "b"], [_dec3, 1, _computedKey]], []); + [_init_a, _init_b, _init_computedKey, _initProto] = babelHelpers.applyDecs(this, [[dec, 1, "a"], [dec, 1, "b"], [dec, 1, _computedKey]], []); } #A = (_initProto(this), _init_a(this)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/input.js index ebb88a741572..c30e61d463bc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js index ad30531a425e..a62cf5634aff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-private/output.js @@ -1,5 +1,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.applyDecs(this, [[dec, 6, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/input.js index edf06478601f..50f05c065848 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js index 471adf36f9c9..3eb7622b70e8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/static-public/output.js @@ -1,13 +1,12 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3, _initStatic; +var _init_a, _init_b, _computedKey, _init_computedKey, _initStatic; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { static { - [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(this, [[_dec, 6, "a"], [_dec2, 6, "b"], [_dec3, 6, _computedKey]], []); + [_init_a, _init_b, _init_computedKey, _initStatic] = babelHelpers.applyDecs(this, [[dec, 6, "a"], [dec, 6, "b"], [dec, 6, _computedKey]], []); _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/input.js index 4afc45261337..07804cb8a125 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js index 9eb7268e4131..48bd7037ef2c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-private/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo { #A; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/input.js index ad27f18d5ed3..62dbd0c0381a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js index f6269be736f1..478dff1b4ee9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-public/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo { #A; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/input.js index 2e516a961de9..9e893b86b863 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static accessor #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js index 04cc0ef030d0..985081906eb4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-private/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo { static #A; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/input.js index 160e72cd531c..eb7463cb9fc1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static accessor a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js index 187ad5214a67..e066c9045da5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-accessors/undecorated-static-public/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class Foo { static #A; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js index ebd79d22da06..6bc1a7dbbc4b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo extends Bar { constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js index dcf5a0fae917..eeae9e4d8ff1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-nested-constructor-expression/output.js @@ -1,5 +1,7 @@ var _initClass; +const dec = () => {}; + let _Foo; class Foo extends Bar { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js index 4be504d54e70..b32ea0bd378f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo extends Bar { @dec get #x() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js index 17cd5aa63e11..77b1b3c4f1c4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-accessor/output.js @@ -1,5 +1,7 @@ var _call_x, _initProto; +const dec = () => {}; + class Foo extends Bar { static { [_call_x, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "x", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js index 73200f5f673d..36f9bd37dfa7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo extends Bar { @dec #x() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js index 91246a1f387a..4ad35da7a786 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-assumption-constantSuper/super-in-private-method/output.js @@ -1,5 +1,7 @@ var _call_x, _initProto; +const dec = () => {}; + class Foo extends Bar { static { [_call_x, _initProto] = babelHelpers.applyDecs(this, [[dec, 2, "x", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js index 542bf870c079..77060bea50ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; const A = @dec class A {} const B = @dec class C {} const D = @dec class {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js index b0cce043afbe..e5285c7fe78c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/expressions/output.js @@ -1,5 +1,7 @@ var _initClass, _A, _class, _temp, _initClass2, _C, _class2, _temp2, _initClass3, _D, _class3, _temp3, _initClass4, _decorated_class, _class4, _temp4, _initClass5, _G, _class5, _temp5, _initClass6, _decorated_class2, _class6, _temp6, _initClass7, _H, _class7, _temp7, _initClass8, _K, _class8, _temp8; +const dec = () => {}; + const A = ((_temp = _class = class A {}, (() => { [_A, _initClass] = babelHelpers.applyDecs(_class, [], [dec]); })(), (() => { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js index 7a4a6684555a..96a13523506c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/input.js @@ -1,3 +1,5 @@ +const dec1 = () => {}; +const dec2 = () => {}; @dec1 class Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js index 605270eadeca..a6b0bbea747b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/inheritance/output.js @@ -1,5 +1,9 @@ var _initClass, _initClass2; +const dec1 = () => {}; + +const dec2 = () => {}; + let _Bar; class Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js index deeb483448f7..87c785d39a93 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static field = 123; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js index 3ed28458cab0..e2484dd973ae 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/initializers/output.js @@ -1,5 +1,7 @@ var _initClass, _temp2, _initClass2, _temp4; +const dec = () => {}; + let _Foo; new (_temp2 = class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js index daf74ddd2d36..e8c62db59046 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; let hasX, hasM; @dec diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js index f11cf07517d3..8403fb9bb9ba 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-installed-on-correct-class/output.js @@ -1,5 +1,7 @@ var _initClass, _x, _m, _temp2; +const dec = () => {}; + let hasX, hasM; let _Foo; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js index 51bc09c85652..1b8d46cf3ac0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js index fe77f96f5af9..5ff5ed1f935b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-static-this/output.js @@ -1,5 +1,7 @@ var _initClass, _temp2; +const dec = () => {}; + let _Foo; new (_temp2 = class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js index fde7feb1abd7..0cd5e45110b7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; const Foo = @dec class Bar { bar = new Bar(); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js index f1f8cd9df38d..911bb3449af4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement-with-expr/output.js @@ -1,5 +1,7 @@ var _initClass, _Bar, _class, _temp; +const dec = () => {}; + const Foo = ((_temp = _class = class Bar { constructor() { babelHelpers.defineProperty(this, "bar", new _Bar()); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js index e6da5000db62..8f0a4dfe092f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js index f302d19a6ecb..f2fb1fb216f7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes--to-es2015/replacement/output.js @@ -1,5 +1,7 @@ var _initClass, _temp2; +const dec = () => {}; + let _Foo; new (_temp2 = class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/input.js index 542bf870c079..77060bea50ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; const A = @dec class A {} const B = @dec class C {} const D = @dec class {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js index 146cdb17ca70..33d00cc709eb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/expressions/output.js @@ -1,5 +1,7 @@ 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.applyDecs(this, [], [dec]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/input.js index 7a4a6684555a..0657f6e2b364 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec1 class Bar {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js index d7ea9b35166e..6ffb0703782e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/inheritance/output.js @@ -1,10 +1,14 @@ -var _initClass, _initClass2; +var _initClass, _dec, _initClass2, _dec2; + +const dec = () => {}; let _Bar; +_dec = dec1 + class Bar { static { - [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec1]); + [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [_dec]); } static { _initClass(); @@ -14,9 +18,11 @@ class Bar { let _Foo; +_dec2 = dec2 + class Foo extends _Bar { static { - [_Foo, _initClass2] = babelHelpers.applyDecs(this, [], [dec2]); + [_Foo, _initClass2] = babelHelpers.applyDecs(this, [], [_dec2]); } static { _initClass2(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/input.js index deeb483448f7..87c785d39a93 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static field = 123; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js index 982a63a72f28..82878b9723c4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/initializers/output.js @@ -1,5 +1,7 @@ var _initClass, _initClass2; +const dec = () => {}; + let _Foo; new class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js index daf74ddd2d36..e8c62db59046 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; let hasX, hasM; @dec diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js index 8f36ec034422..e673706e8f64 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-installed-on-correct-class/output.js @@ -1,5 +1,7 @@ var _initClass; +const dec = () => {}; + let hasX, hasM; let _Foo; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js index 51bc09c85652..1b8d46cf3ac0 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js index 5ca20ff8d696..0d7e92d18761 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-static-this/output.js @@ -1,5 +1,7 @@ var _initClass; +const dec = () => {}; + let _Foo; new class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/input.js index fde7feb1abd7..0cd5e45110b7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; const Foo = @dec class Bar { bar = new Bar(); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js index 4c37edebb1dd..dff079e0eb9f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement-with-expr/output.js @@ -1,5 +1,7 @@ var _initClass, _Bar; +const dec = () => {}; + const Foo = (class Bar { static { [_Bar, _initClass] = babelHelpers.applyDecs(this, [], [dec]); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/input.js index e6da5000db62..8f0a4dfe092f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo { static foo = new Foo(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js index 42a115d10f2b..51724d5ac64f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-classes/replacement/output.js @@ -1,5 +1,7 @@ var _initClass; +const dec = () => {}; + let _Foo; new class extends babelHelpers.identity { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js index 2ca438188867..fd4743f81bc7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec [getKey()]() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js index a70d24de54c9..eaa7583421ee 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-ast/output.js @@ -1,9 +1,9 @@ -var _computedKey, _computedKey2, _dec, _dec2, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; _computedKey = getKey() -_dec = dec _computedKey2 = getKey() -_dec2 = dec class Foo { constructor(...args) { @@ -21,5 +21,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js index 8aeb57759b76..0f6e2ca31d39 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec [getKeyI()]() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js index 66e2ac318d83..bf6329e0b21f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/computed-keys-same-value/output.js @@ -1,9 +1,9 @@ -var _computedKey, _computedKey2, _dec, _dec2, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; _computedKey = getKeyI() -_dec = dec _computedKey2 = getKeyJ() -_dec2 = dec class Foo { constructor(...args) { @@ -21,5 +21,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js index 522da0061204..e2bfd2a7b415 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a = 123; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js index fe79aa632006..b70d02e25fc7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/method-and-field/output.js @@ -1,5 +1,7 @@ var _init_a, _initProto; +const dec = () => {}; + class Foo { constructor() { babelHelpers.defineProperty(this, "a", (_initProto(this), _init_a(this, 123))); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js index db90a40aa67b..ab961fbc9dfb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js index 6402e1341ff0..01e4e3298fce 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys--to-es2015/methods-with-same-key/output.js @@ -1,5 +1,7 @@ var _initProto; +const dec = () => {}; + class Foo { constructor(...args) { _initProto(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/input.js index 2ca438188867..fd4743f81bc7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec [getKey()]() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js index 9663aebaf7b3..294a15adaac3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-ast/output.js @@ -1,13 +1,13 @@ -var _computedKey, _computedKey2, _dec, _dec2, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; _computedKey = getKey() -_dec = dec _computedKey2 = getKey() -_dec2 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/input.js index 8aeb57759b76..0f6e2ca31d39 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec [getKeyI()]() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js index 76d9f05cad75..3a79df5344da 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/computed-keys-same-value/output.js @@ -1,13 +1,13 @@ -var _computedKey, _computedKey2, _dec, _dec2, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; _computedKey = getKeyI() -_dec = dec _computedKey2 = getKeyJ() -_dec2 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, _computedKey], [_dec2, 2, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, _computedKey], [dec, 2, _computedKey2]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/input.js index 522da0061204..e2bfd2a7b415 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a = 123; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js index cb04e3cc2e5d..6c1bdff1940b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/method-and-field/output.js @@ -1,5 +1,7 @@ var _init_a, _initProto; +const dec = () => {}; + class Foo { static { [_init_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 2, "a"]], []); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/input.js index db90a40aa67b..ab961fbc9dfb 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js index c4befb4def4d..4cee39fbc75b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-duplicated-keys/methods-with-same-key/output.js @@ -1,5 +1,7 @@ var _initProto; +const dec = () => {}; + class Foo { static { [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a"], [dec, 2, "a"]], []); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js index 222ec09fc95e..2cd77e99b7e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js index af27fce2d289..54c3d026df17 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/private/output.js @@ -1,5 +1,7 @@ var _init_a, _init_b; +const dec = () => {}; + var _a = /*#__PURE__*/new WeakMap(); var _b = /*#__PURE__*/new WeakMap(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js index 8dff95c99a3a..16a36d324047 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js index 481926ddfe5a..78f642ce628a 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/public/output.js @@ -1,9 +1,8 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; +var _init_a, _init_b, _computedKey, _init_computedKey; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { constructor() { @@ -15,5 +14,5 @@ class Foo { } (() => { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js index 830d82321863..bc6f56f17527 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js index ad619ac7d598..b149d703302f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ var _init_a, _init_b; +const dec = () => {}; + class Foo {} (() => { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js index 9b9dae98314a..e7e44bf1ec16 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js index c5df8314385b..5d900ae41652 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields--to-es2015/static-public/output.js @@ -1,14 +1,13 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; +var _init_a, _init_b, _computedKey, _init_computedKey; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo {} (() => { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(Foo, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []); })(); babelHelpers.defineProperty(Foo, "a", _init_a(Foo)); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/input.js index 222ec09fc95e..2cd77e99b7e3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js index b72a6d971df6..a1f8978d4a10 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/private/output.js @@ -1,5 +1,7 @@ var _init_a, _init_b; +const dec = () => {}; + class Foo { static { [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 0, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/input.js index 8dff95c99a3a..16a36d324047 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js index 06c0434d04a6..74138e9cf70b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/public/output.js @@ -1,13 +1,12 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; +var _init_a, _init_b, _computedKey, _init_computedKey; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 0, "a"], [_dec2, 0, "b"], [_dec3, 0, _computedKey]], []); + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 0, "b"], [dec, 0, _computedKey]], []); } a = _init_a(this); b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/input.js index 830d82321863..bc6f56f17527 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static #a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js index cb167ff192fd..ff09b3d44586 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-private/output.js @@ -1,5 +1,7 @@ var _init_a, _init_b; +const dec = () => {}; + class Foo { static { [_init_a, _init_b] = babelHelpers.applyDecs(this, [[dec, 5, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/input.js index 9b9dae98314a..e7e44bf1ec16 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec static a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js index 64af25745500..7f24c5944c7c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-fields/static-public/output.js @@ -1,13 +1,12 @@ -var _init_a, _init_b, _computedKey, _init_computedKey, _dec, _dec2, _dec3; +var _init_a, _init_b, _computedKey, _init_computedKey; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'c' -_dec3 = dec class Foo { static { - [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[_dec, 5, "a"], [_dec2, 5, "b"], [_dec3, 5, _computedKey]], []); + [_init_a, _init_b, _init_computedKey] = babelHelpers.applyDecs(this, [[dec, 5, "a"], [dec, 5, "b"], [dec, 5, _computedKey]], []); } static a = _init_a(this); static b = _init_b(this, 123); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js index 49c601a1dd5b..28519502bf46 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js index 32971ca073e9..f22674b1b8d9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + var _a = /*#__PURE__*/new WeakMap(); class Foo { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js index 9d1cbae52f1d..392f9e03412f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js index 0152dbf977de..3f3de7e5bbcc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { constructor(...args) { @@ -22,5 +22,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a"], [dec, 3, _computedKey]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js index 90edd26364d8..9d64c02982da 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js index e0262570f9e3..efe85df511ec 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static getA() { return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js index 1383fa58abf4..3bc53fb17cc5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js index 68787d432777..87f360a260d9 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters--to-es2015/static-public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static get a() { @@ -16,7 +16,7 @@ class Foo { } (() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a"], [dec, 8, _computedKey]], []); _initStatic(Foo); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js index 060ae225a21e..fdf137cc4a64 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js index 71e95a6ee2a2..a3ba90c2d423 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/private/output.js @@ -1,5 +1,7 @@ var _call_a, _call_a2, _initProto; +const dec = () => {}; + var _a = /*#__PURE__*/new WeakMap(); class Foo { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js index ef384166d689..1af1569ba988 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js index a05760c5cfe9..ca1620b75abe 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/public/output.js @@ -1,11 +1,9 @@ -var _computedKey, _computedKey2, _dec, _dec2, _dec3, _dec4, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'b' -_dec3 = dec _computedKey2 = 'b' -_dec4 = dec class Foo { constructor(...args) { @@ -33,5 +31,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js index f439a9152528..c832634c6b72 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js index e9ac78c2c966..8b8a774ad47f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _call_a2, _initStatic; +const dec = () => {}; + class Foo { static getA() { return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js index 193bf7b836a2..bbad4af972ed 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js index edcb11764a7a..2cfd5e545551 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters--to-es2015/static-public/output.js @@ -1,11 +1,9 @@ -var _computedKey, _computedKey2, _dec, _dec2, _dec3, _dec4, _initStatic; +var _computedKey, _computedKey2, _initStatic; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'b' -_dec3 = dec _computedKey2 = 'b' -_dec4 = dec class Foo { static get a() { @@ -27,7 +25,7 @@ class Foo { } (() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); + [_initStatic] = babelHelpers.applyDecs(Foo, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []); _initStatic(Foo); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/input.js index 060ae225a21e..fdf137cc4a64 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js index bcf3cae9176e..35030f7c00bf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/private/output.js @@ -1,5 +1,7 @@ var _call_a, _call_a2, _initProto; +const dec = () => {}; + class Foo { static { [_call_a, _call_a2, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/input.js index ef384166d689..1af1569ba988 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js index 1a7c8951454d..9d22fada3a67 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/public/output.js @@ -1,15 +1,13 @@ -var _computedKey, _computedKey2, _dec, _dec2, _dec3, _dec4, _initProto; +var _computedKey, _computedKey2, _initProto; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'b' -_dec3 = dec _computedKey2 = 'b' -_dec4 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 4, "a"], [_dec3, 3, _computedKey], [_dec4, 4, _computedKey2]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a"], [dec, 4, "a"], [dec, 3, _computedKey], [dec, 4, _computedKey2]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/input.js index f439a9152528..c832634c6b72 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js index e897ea3cd18e..169367e7ae6b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _call_a2, _initStatic; +const dec = () => {}; + class Foo { static { [_call_a, _call_a2, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/input.js index 193bf7b836a2..bbad4af972ed 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js index 367b9d127fd7..2777d0e553c1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters-and-setters/static-public/output.js @@ -1,15 +1,13 @@ -var _computedKey, _computedKey2, _dec, _dec2, _dec3, _dec4, _initStatic; +var _computedKey, _computedKey2, _initStatic; + +const dec = () => {}; -_dec = dec -_dec2 = dec _computedKey = 'b' -_dec3 = dec _computedKey2 = 'b' -_dec4 = dec class Foo { static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 9, "a"], [_dec3, 8, _computedKey], [_dec4, 9, _computedKey2]], []); + [_initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a"], [dec, 9, "a"], [dec, 8, _computedKey], [dec, 9, _computedKey2]], []); _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/input.js index 49c601a1dd5b..28519502bf46 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js index 06ba2926bfa4..bc2319dab14d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + class Foo { static { [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/input.js index 9d1cbae52f1d..392f9e03412f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js index 756adf797e3b..6ec290a3e353 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 3, "a"], [_dec2, 3, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 3, "a"], [dec, 3, _computedKey]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/input.js index 90edd26364d8..9d64c02982da 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js index dc93a5313712..0eca748ff170 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static { [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/input.js index 1383fa58abf4..3bc53fb17cc5 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js index 2ec6f560dc4b..de0bb4f017ff 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-getters/static-public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 8, "a"], [_dec2, 8, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(this, [[dec, 8, "a"], [dec, 8, _computedKey]], []); _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js index 91d04b4f0df5..31091ae37ee7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-metadata--to-es2015/getting-previously-set-metadata/exec.js @@ -13,7 +13,7 @@ function dec2(_, { setMetadata, getMetadata }) { } class Foo { - @dec1 @dec2 a; + @dec2 @dec1 a; } function dec3(_, { setMetadata, getMetadata }) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js index fc7ace8128ee..098bbbb687f2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js index 4e18191445f1..69a2adb83d4b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + var _a = /*#__PURE__*/new WeakMap(); class Foo { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js index f364442146ea..3a7f4cfaae9c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js index 1835a9fa3548..36b8fdb4aba6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { constructor(...args) { @@ -22,5 +22,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 2, "a"], [dec, 2, _computedKey]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js index e68191455f14..4a6ae5d4d7fd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js index 3c147c920d64..02427925f057 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static callA() { return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _a).call(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js index 77dae8711cd3..5f81da5c0405 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js index d1c334def59e..68326d08fdfa 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods--to-es2015/static-public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static a() { @@ -16,7 +16,7 @@ class Foo { } (() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(Foo, [[dec, 7, "a"], [dec, 7, _computedKey]], []); _initStatic(Foo); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/input.js index fc7ace8128ee..098bbbb687f2 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js index 6f76b6021b6c..ba38b17b2032 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + class Foo { static { [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/input.js index f364442146ea..3a7f4cfaae9c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js index efac40c1c35e..729fb28176f4 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, "a"], [_dec2, 2, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "a"], [dec, 2, _computedKey]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/input.js index e68191455f14..4a6ae5d4d7fd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js index 6b807803efa6..e68c51222a2f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static { [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 7, "a", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/input.js index 77dae8711cd3..5f81da5c0405 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js index 1ad76b111fb4..d15d1734e9bf 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-methods/static-public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 7, "a"], [_dec2, 7, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(this, [[dec, 7, "a"], [dec, 7, _computedKey]], []); _initStatic(this); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-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/2021-12-misc--to-es2015/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/input.js index d72d66fd2a29..68484c72749d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class A extends B { constructor() { let a = 2; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/output.js index 61a1fde840db..fc7ff8dff1d1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/initProto-existing-derived-constructor/output.js @@ -1,4 +1,8 @@ -var _initProto; +var _dec, _initProto; + +const dec = () => {}; + +_dec = deco class A extends B { constructor() { @@ -14,5 +18,5 @@ class A extends B { } (() => { - [_initProto] = babelHelpers.applyDecs(A, [[deco, 2, "method"]], []); + [_initProto] = babelHelpers.applyDecs(A, [[_dec, 2, "method"]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js index 844a924e3e80..586564c5e219 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec @call() @chain.expr() diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js index 79b845170bc7..c6a734ce3d65 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc--to-es2015/valid-expression-formats/output.js @@ -1,7 +1,18 @@ -var _initClass, _initProto; +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 { @@ -17,22 +28,22 @@ class Foo { method() {} makeClass() { - var _init_bar, _class, _temp; + var _dec9, _init_bar, _class, _temp; - return _temp = _class = class Nested { + return _dec9 = babelHelpers.classPrivateFieldGet(this, _a), (_temp = _class = class Nested { constructor() { babelHelpers.defineProperty(this, "bar", _init_bar(this)); } }, (() => { - [_init_bar] = babelHelpers.applyDecs(_class, [[babelHelpers.classPrivateFieldGet(_class, _a), 0, "bar"]], []); - })(), _temp; + [_init_bar] = babelHelpers.applyDecs(_class, [[_dec9, 0, "bar"]], []); + })(), _temp); } } (() => { - [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(Foo, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); + [_initProto, _Foo, _initClass] = babelHelpers.applyDecs(Foo, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4]); })(); (() => { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/input.js index e57aa75977ea..6986908e606d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Class { @dec a; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/output.js index d13052811623..ab809be8665c 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/all-decorators/output.js @@ -1,12 +1,14 @@ 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 { - [_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, _Class, _initClass, _initProto, _initStatic] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 0, "e", function () { + [_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, _Class, _initClass] = babelHelpers.applyDecs(this, [[dec, 0, "a"], [dec, 2, "b"], [dec, 3, "c"], [dec, 4, "c"], [dec, 1, "d"], [dec, 0, "e", function () { return this.#e; }, function (value) { this.#e = value; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/decorator-evaluation-scope/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/decorator-evaluation-scope/exec.js new file mode 100644 index 000000000000..ec8beb3b8cbf --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-misc/decorator-evaluation-scope/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/decorator-evaluation-scope/options.json new file mode 100644 index 000000000000..2d1b9e92b326 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/decorator-evaluation-scope/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2021-12" }], + "proposal-class-static-block" + ], + "minNodeVersion": "12.0.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/input.js index 6b0bc3b5a233..a8da039942d6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class A extends B { constructor() { if (Math.random() > 0.5) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/output.js index 8a52cbd4b25a..a2277d035d16 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor-multiple-super/output.js @@ -1,8 +1,12 @@ -var _initProto, _initProto2; +var _dec, _initProto, _dec2, _initProto2; + +const dec = () => {}; + +_dec = deco class A extends B { static { - [_initProto] = babelHelpers.applyDecs(this, [[deco, 2, "method"]], []); + [_initProto] = babelHelpers.applyDecs(this, [[_dec, 2, "method"]], []); } constructor() { @@ -17,9 +21,11 @@ class A extends B { } +_dec2 = deco + class C extends B { static { - [_initProto2] = babelHelpers.applyDecs(this, [[deco, 2, "method"]], []); + [_initProto2] = babelHelpers.applyDecs(this, [[_dec2, 2, "method"]], []); } constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/input.js index d72d66fd2a29..b3c7b6f85e9b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class A extends B { constructor() { let a = 2; @@ -5,6 +6,6 @@ class A extends B { foo(); } - @deco + @dec method() {} } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js index e2fb9d7eb331..792c39589878 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/initProto-existing-derived-constructor/output.js @@ -1,8 +1,10 @@ var _initProto; +const dec = () => {}; + class A extends B { static { - [_initProto] = babelHelpers.applyDecs(this, [[deco, 2, "method"]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 2, "method"]], []); } constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js index 586fb0adef1e..0e7ac6161824 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class A { #A = 1; static B = class B extends A { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js index 102e9e463973..501a4db46595 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/private-keys-in-enclosing-class/output.js @@ -1,3 +1,5 @@ +const dec = () => {}; + class A { #A = 1; static B = class B extends A { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js index ff2a3c43e415..53848c42cb07 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-array-pattern/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js index 34df0b29ed8b..2ffabb75d901 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-for-of/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js index 56e2501e42e1..a60de2bae344 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-object-pattern/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js index c24cac0560ad..6b513a380627 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-rest/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js index f3b235ffe0df..7d01837e1b51 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method-via-update/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js index 46f4ecf6453b..b6417214fec7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/setting-private-method/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { @dec #x() {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js index ebd79d22da06..6bc1a7dbbc4b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec class Foo extends Bar { constructor() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js index dcf5a0fae917..eeae9e4d8ff1 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-nested-constructor-expression/output.js @@ -1,5 +1,7 @@ var _initClass; +const dec = () => {}; + let _Foo; class Foo extends Bar { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js index 4be504d54e70..b32ea0bd378f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo extends Bar { @dec get #x() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js index dea033cc9d65..f36f017cce02 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-accessor/output.js @@ -1,5 +1,7 @@ var _call_x, _initProto; +const dec = () => {}; + class Foo extends Bar { static { [_call_x, _initProto] = babelHelpers.applyDecs(this, [[dec, 3, "x", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js index 73200f5f673d..36f9bd37dfa7 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo extends Bar { @dec #x() { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js index b77541b7c254..2ad8522c0bcc 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/super-in-private-method/output.js @@ -1,5 +1,7 @@ var _call_x, _initProto; +const dec = () => {}; + class Foo extends Bar { static { [_call_x, _initProto] = babelHelpers.applyDecs(this, [[dec, 2, "x", function () { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/input.js index 844a924e3e80..586564c5e219 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; @dec @call() @chain.expr() diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js index 5490137a9009..99243189adb3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js @@ -1,10 +1,21 @@ -var _initClass, _initProto; +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 { - [_Foo, _initClass, _initProto] = babelHelpers.applyDecs(this, [[[dec, call(), chain.expr(), arbitrary + expr, array[expr]], 2, "method"]], [dec, call(), chain.expr(), arbitrary + expr, array[expr]]); + [_initProto, _Foo, _initClass] = babelHelpers.applyDecs(this, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4]); } constructor(...args) { @@ -16,11 +27,11 @@ class Foo { method() {} makeClass() { - var _init_bar; + var _dec9, _init_bar; - return class Nested { + return _dec9 = this.#a, class Nested { static { - [_init_bar] = babelHelpers.applyDecs(this, [[this.#a, 0, "bar"]], []); + [_init_bar] = babelHelpers.applyDecs(this, [[_dec9, 0, "bar"]], []); } bar = _init_bar(this); }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/decorators/exec.js new file mode 100644 index 000000000000..795f3a9101dd --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/decorators/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, 19) +@logDecoratorRun(1, 18) +class A { + @logDecoratorRun(2, 11) + @logDecoratorRun(3, 10) + a; + + @logDecoratorRun(4, 13) + @logDecoratorRun(5, 12) + static b; + + @logDecoratorRun(6, 15) + @logDecoratorRun(7, 14) + static #c; + + @logDecoratorRun(8, 17) + @logDecoratorRun(9, 16) + #d; +} + +var nums = Array.from({ length: 20 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-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/2021-12-ordering--to-es2015/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/initializers/exec.js new file mode 100644 index 000000000000..0adac4dc6c94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/initializers/exec.js @@ -0,0 +1,51 @@ +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, 19) + @logDecoratorRun(3, 18) + a() {}; + + @logDecoratorRun(4, 21, 37) + @logDecoratorRun(5, 20, 36) + static b() {}; + + @logDecoratorRun(6, 23, 39) + @logDecoratorRun(7, 22, 38) + static #c() {}; + + @logDecoratorRun(8, 25) + @logDecoratorRun(9, 24) + #d() {}; + + @logDecoratorRun(10, 27) + @logDecoratorRun(11, 26) + accessor e; + + @logDecoratorRun(12, 29, 41) + @logDecoratorRun(13, 28, 40) + static accessor f; + + @logDecoratorRun(14, 31, 43) + @logDecoratorRun(15, 30, 42) + static accessor #g; + + @logDecoratorRun(16, 33) + @logDecoratorRun(17, 32) + accessor #h; +} + +var nums = Array.from({ length: 46 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/options.json new file mode 100644 index 000000000000..94ccc5a4b228 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + ["proposal-decorators", { "version": "2021-12" }], + "proposal-class-properties", + "proposal-private-methods", + "proposal-class-static-block" + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering--to-es2015/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-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/2021-12-ordering/decorators/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/decorators/exec.js new file mode 100644 index 000000000000..b241220635c7 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/decorators/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, 13) + @logDecoratorRun(3, 12) + [push(4)]; + + @logDecoratorRun(5, 15) + @logDecoratorRun(6, 14) + static [push(7)]; + + @logDecoratorRun(8, 17) + @logDecoratorRun(9, 16) + 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/2021-12-ordering/field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/field-initializers-after-methods/exec.js new file mode 100644 index 000000000000..46e71f7281db --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-ordering/initializers/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/initializers/exec.js new file mode 100644 index 000000000000..0adac4dc6c94 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/initializers/exec.js @@ -0,0 +1,51 @@ +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, 19) + @logDecoratorRun(3, 18) + a() {}; + + @logDecoratorRun(4, 21, 37) + @logDecoratorRun(5, 20, 36) + static b() {}; + + @logDecoratorRun(6, 23, 39) + @logDecoratorRun(7, 22, 38) + static #c() {}; + + @logDecoratorRun(8, 25) + @logDecoratorRun(9, 24) + #d() {}; + + @logDecoratorRun(10, 27) + @logDecoratorRun(11, 26) + accessor e; + + @logDecoratorRun(12, 29, 41) + @logDecoratorRun(13, 28, 40) + static accessor f; + + @logDecoratorRun(14, 31, 43) + @logDecoratorRun(15, 30, 42) + static accessor #g; + + @logDecoratorRun(16, 33) + @logDecoratorRun(17, 32) + accessor #h; +} + +var nums = Array.from({ length: 46 }, (_, i) => i); +expect(log).toEqual(nums); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/options.json new file mode 100644 index 000000000000..4fdbad965871 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["proposal-decorators", { "version": "2021-12" }]], + "minNodeVersion": "16.11.0" +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-ordering/static-field-initializers-after-methods/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-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/2021-12-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/2021-12-setters--to-es2015/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/input.js index 254f2f102f9a..66dd78268d19 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js index 5d0ad516b80b..157576c66e2b 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + var _a = /*#__PURE__*/new WeakMap(); class Foo { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js index b8b837257ff0..9a7faf175edd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js index 256297632372..b211810b2a0e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { constructor(...args) { @@ -22,5 +22,5 @@ class Foo { } (() => { - [_initProto] = babelHelpers.applyDecs(Foo, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(Foo, [[dec, 4, "a"], [dec, 4, _computedKey]], []); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js index 0038d6b6bd30..6bf29a2a2c94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js index 45e47a57177c..2ddd942ccbf6 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static setA(v) { babelHelpers.classStaticPrivateFieldSpecSet(this, Foo, _a, v); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js index 0cca65be7fa3..ed0a661dcb2d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js index e890b8fb8d4a..9a9c4427a87e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters--to-es2015/static-public/output.js @@ -1,8 +1,8 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static set a(v) { @@ -16,7 +16,7 @@ class Foo { } (() => { - [_initStatic] = babelHelpers.applyDecs(Foo, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(Foo, [[dec, 9, "a"], [dec, 9, _computedKey]], []); _initStatic(Foo); })(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/input.js index 254f2f102f9a..66dd78268d19 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js index a1b2e04ab8f1..6e9be3867fa8 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/private/output.js @@ -1,5 +1,7 @@ var _call_a, _initProto; +const dec = () => {}; + class Foo { static { [_call_a, _initProto] = babelHelpers.applyDecs(this, [[dec, 4, "a", function (v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/input.js index b8b837257ff0..9a7faf175edd 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js index ad6f2edce743..d13084ea6431 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initProto; +var _computedKey, _initProto; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initProto] = babelHelpers.applyDecs(this, [[_dec, 4, "a"], [_dec2, 4, _computedKey]], []); + [_initProto] = babelHelpers.applyDecs(this, [[dec, 4, "a"], [dec, 4, _computedKey]], []); } constructor(...args) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/input.js index 0038d6b6bd30..6bf29a2a2c94 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js index 6bcadc0cc528..e677f8402ac3 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-private/output.js @@ -1,5 +1,7 @@ var _call_a, _initStatic; +const dec = () => {}; + class Foo { static { [_call_a, _initStatic] = babelHelpers.applyDecs(this, [[dec, 9, "a", function (v) { diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/input.js index 0cca65be7fa3..ed0a661dcb2d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/input.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/input.js @@ -1,3 +1,4 @@ +const dec = () => {}; class Foo { static value = 1; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js index 230ee2bc8aff..a059f040662e 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-setters/static-public/output.js @@ -1,12 +1,12 @@ -var _computedKey, _dec, _dec2, _initStatic; +var _computedKey, _initStatic; + +const dec = () => {}; -_dec = dec _computedKey = 'b' -_dec2 = dec class Foo { static { - [_initStatic] = babelHelpers.applyDecs(this, [[_dec, 9, "a"], [_dec2, 9, _computedKey]], []); + [_initStatic] = babelHelpers.applyDecs(this, [[dec, 9, "a"], [dec, 9, _computedKey]], []); _initStatic(this);