Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit 702f2d7

Browse files
Reduce decorator static property size (#16287)
* improve * fix new test * fix test * add test * Apply suggestions from code review Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * lint --------- Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
1 parent 4bd1d41 commit 702f2d7

21 files changed

Lines changed: 209 additions & 147 deletions

File tree

‎packages/babel-helper-create-class-features-plugin/src/decorators.ts‎

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ function extractElementLocalAssignments(decorationInfo: DecoratorInfo[]) {
603603
}
604604

605605
function addCallAccessorsFor(
606+
version: DecoratorVersionKind,
606607
element: NodePath,
607608
key: t.PrivateName,
608609
getId: t.Identifier,
@@ -616,7 +617,12 @@ function addCallAccessorsFor(
616617
[],
617618
t.blockStatement([
618619
t.returnStatement(
619-
t.callExpression(t.cloneNode(getId), [t.thisExpression()]),
620+
t.callExpression(
621+
t.cloneNode(getId),
622+
(process.env.BABEL_8_BREAKING || version === "2023-11") && isStatic
623+
? []
624+
: [t.thisExpression()],
625+
),
620626
),
621627
]),
622628
isStatic,
@@ -630,10 +636,12 @@ function addCallAccessorsFor(
630636
[t.identifier("v")],
631637
t.blockStatement([
632638
t.expressionStatement(
633-
t.callExpression(t.cloneNode(setId), [
634-
t.thisExpression(),
635-
t.identifier("v"),
636-
]),
639+
t.callExpression(
640+
t.cloneNode(setId),
641+
(process.env.BABEL_8_BREAKING || version === "2023-11") && isStatic
642+
? [t.identifier("v")]
643+
: [t.thisExpression(), t.identifier("v")],
644+
),
637645
),
638646
]),
639647
isStatic,
@@ -1085,7 +1093,10 @@ function transformClass(
10851093
if (kind === ACCESSOR) {
10861094
const { value } = element.node as t.ClassAccessorProperty;
10871095

1088-
const params: t.Expression[] = [t.thisExpression()];
1096+
const params: t.Expression[] =
1097+
(process.env.BABEL_8_BREAKING || version === "2023-11") && isStatic
1098+
? []
1099+
: [t.thisExpression()];
10891100

10901101
if (value) {
10911102
params.push(t.cloneNode(value));
@@ -1112,7 +1123,7 @@ function transformClass(
11121123
`set_${name}`,
11131124
);
11141125

1115-
addCallAccessorsFor(newPath, key, getId, setId, isStatic);
1126+
addCallAccessorsFor(version, newPath, key, getId, setId, isStatic);
11161127

11171128
locals = [newFieldInitId, getId, setId];
11181129
} else {
@@ -1135,12 +1146,13 @@ function transformClass(
11351146
element as NodePath<t.ClassProperty | t.ClassPrivateProperty>
11361147
).get("value");
11371148

1138-
valuePath.replaceWith(
1139-
t.callExpression(
1140-
t.cloneNode(initId),
1141-
[t.thisExpression(), valuePath.node].filter(v => v),
1142-
),
1143-
);
1149+
const args: t.Expression[] =
1150+
(process.env.BABEL_8_BREAKING || version === "2023-11") && isStatic
1151+
? []
1152+
: [t.thisExpression()];
1153+
if (valuePath.node) args.push(valuePath.node);
1154+
1155+
valuePath.replaceWith(t.callExpression(t.cloneNode(initId), args));
11441156

11451157
locals = [initId];
11461158

@@ -1248,9 +1260,10 @@ function transformClass(
12481260
`init_extra_${name}`,
12491261
);
12501262
locals.push(initExtraId);
1251-
const initExtraCall = t.callExpression(t.cloneNode(initExtraId), [
1252-
t.thisExpression(),
1253-
]);
1263+
const initExtraCall = t.callExpression(
1264+
t.cloneNode(initExtraId),
1265+
isStatic ? [] : [t.thisExpression()],
1266+
);
12541267
if (!isStatic) {
12551268
fieldInitializerExpressions.push(initExtraCall);
12561269
} else {

‎packages/babel-helpers/src/helpers-generated.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export default Object.freeze({
4848
"7.21.0",
4949
'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2305(e,t,r,n,o,a){function i(e,t,r){return function(n,o){return r&&r(n),e[t].call(n,o)}}function c(e,t){for(var r=0;r<e.length;r++)e[r].call(t);return t}function s(e,t,r,n){if("function"!=typeof e&&(n||void 0!==e))throw new TypeError(t+" must "+(r||"be")+" a function"+(n?"":" or undefined"));return e}function applyDec(e,t,r,n,o,a,c,u,l,f,p,d,h){function m(e){if(!h(e))throw new TypeError("Attempted to access private element on non-instance")}var y,v=t[0],g=t[3],b=!u;if(!b){r||Array.isArray(v)||(v=[v]);var w={},S=[],A=3===o?"get":4===o||d?"set":"value";f?(p||d?w={get:setFunctionName((function(){return g(this)}),n,"get"),set:function(e){t[4](this,e)}}:w[A]=g,p||setFunctionName(w[A],n,2===o?"":A)):p||(w=Object.getOwnPropertyDescriptor(e,n))}for(var P=e,j=v.length-1;j>=0;j-=r?2:1){var D=v[j],E=r?v[j-1]:void 0,I={},O={kind:["field","accessor","method","getter","setter","class"][o],name:n,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");s(t,"An initializer","be",!0),c.push(t)}.bind(null,I)};try{if(b)(y=s(D.call(E,P,O),"class decorators","return"))&&(P=y);else{var k,F;O.static=l,O.private=f,f?2===o?k=function(e){return m(e),w.value}:(o<4&&(k=i(w,"get",m)),3!==o&&(F=i(w,"set",m))):(k=function(e){return e[n]},(o<2||4===o)&&(F=function(e,t){e[n]=t}));var N=O.access={has:f?h.bind():function(e){return n in e}};if(k&&(N.get=k),F&&(N.set=F),P=D.call(E,d?{get:w.get,set:w.set}:w[A],O),d){if("object"==typeof P&&P)(y=s(P.get,"accessor.get"))&&(w.get=y),(y=s(P.set,"accessor.set"))&&(w.set=y),(y=s(P.init,"accessor.init"))&&S.push(y);else if(void 0!==P)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else s(P,(p?"field":"method")+" decorators","return")&&(p?S.push(P):w[A]=P)}}finally{I.v=!0}}return(p||d)&&u.push((function(e,t){for(var r=S.length-1;r>=0;r--)t=S[r].call(e,t);return t})),p||b||(f?d?u.push(i(w,"get"),i(w,"set")):u.push(2===o?w[A]:i.call.bind(w[A])):Object.defineProperty(e,n,w)),P}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var l=a[Symbol.metadata||Symbol.for("Symbol.metadata")];var f=Object.create(null==l?null:l),p=function(e,t,r,n){var o,a,i=[],s=function(t){return checkInRHS(t)===e},u=new Map;function l(e){e&&i.push(c.bind(null,e))}for(var f=0;f<t.length;f++){var p=t[f];if(Array.isArray(p)){var d=p[1],h=p[2],m=p.length>3,y=16&d,v=!!(8&d),g=0==(d&=7),b=h+"/"+v;if(!g&&!m){var w=u.get(b);if(!0===w||3===w&&4!==d||4===w&&3!==d)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);u.set(b,!(d>2)||d)}applyDec(v?e:e.prototype,p,y,m?"#"+h:toPropertyKey(h),d,n,v?a=a||[]:o=o||[],i,v,m,g,1===d,v&&m?s:r)}}return l(o),l(a),i}(e,t,o,f);return r.length||u(e,f),{e:p,get c(){var t=[];return r.length&&[u(applyDec(e,[r],n,e.name,5,f,t),f),c.bind(null,t,e)]}}}',
5050
),
51-
// size: 2899, gzip size: 1475
51+
// size: 2917, gzip size: 1487
5252
applyDecs2311: helper(
5353
"7.23.0",
54-
'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2311(e,t,n,r,o,i){var a,c,u=Symbol.metadata||Symbol.for("Symbol.metadata"),s=Object.defineProperty,l=Object.create,f=[l(null),l(null)],p=n.length;function d(e,t,n,r){for(var o=0;o<e.length;o++)r=e[o].apply(n,t?[r]:[]);return t?r:n}function m(e,t,n,r){if("function"!=typeof e&&(r||void 0!==e))throw new TypeError(t+" must "+(n||"be")+" a function"+(r?"":" or undefined"));return e}function applyDec(e,t,n,r,o,i,u,l,p,h,y,v){function g(e){if(!v(e))throw new TypeError("Attempted to access private element on non-instance")}var b=[].concat(t[0]),w=t[3],D=!u,S=3===o,j=4===o,E=2===o;function I(e,t){return function(n,r){return t&&t(n),P[e].call(n,r)}}if(!D){var P={},k=[],F=S?"get":j||y?"set":"value";if(p?(h||y?P={get:setFunctionName((function(){return w(this)}),r,"get"),set:function(e){t[4](this,e)}}:P[F]=w,h||setFunctionName(P[F],r,E?"":F)):h||(P=Object.getOwnPropertyDescriptor(e,r)),!h&&!p){if((c=f[+l][r])&&7!=(c^o))throw new Error("Decorating two elements with the same name ("+P[F].name+") is not supported yet");f[+l][r]=o<3?1:o}}for(var N=e,O=b.length-1;O>=0;O-=n?2:1){var z=b[O],H=n?b[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");m(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(D)c=z.call(H,N,R),K.v=1,m(c,"class decorators","return")&&(N=c);else if(R.static=l,R.private=p,c=R.access={has:p?v.bind():function(e){return r in e}},j||(c.get=p?E?function(e){return g(e),P.value}:I("get",g):function(e){return e[r]}),E||S||(c.set=p?I("set",g):function(e,t){e[r]=t}),N=z.call(H,y?{get:P.get,set:P.set}:P[F],R),K.v=1,y){if("object"==typeof N&&N)(c=m(N.get,"accessor.get"))&&(P.get=c),(c=m(N.set,"accessor.set"))&&(P.set=c),(c=m(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else m(N,(h?"field":"method")+" decorators","return")&&(h?k.unshift(N):P[F]=N)}return o<2&&u.push(d.bind(null,k,1),d.bind(null,i,0)),h||D||(p?y?u.splice(-1,0,I("get"),I("set")):u.push(E?P[F]:d.call.bind(P[F])):s(e,r,P)),N}function h(e){return s(e,u,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[u]),a=l(null==a?null:a),c=function(){var n,r,i=[];function a(e){e&&i.push(d.bind(null,e,0))}for(var c=0;c<t.length;c++){var u=t[c],s=u[1],l=u[2],f=!!u[3],p=16&s,m=!!(8&s),h=0==(s&=7),y=1===s;applyDec(m?e:e.prototype,u,p,f?"#"+l:toPropertyKey(l),s,h||y?[]:m?r=r||[]:n=n||[],i,m,f,h,y,m&&f?function(t){return checkInRHS(t)===e}:o)}return a(n),a(r),i}(),p||h(e),{e:c,get c(){var t=[];return p&&[h(applyDec(e,[n],r,e.name,5,t)),d.bind(null,t,0,e)]}}}',
54+
'import checkInRHS from"checkInRHS";import setFunctionName from"setFunctionName";import toPropertyKey from"toPropertyKey";export default function applyDecs2311(e,t,n,r,o,i){var a,c,u=Symbol.metadata||Symbol.for("Symbol.metadata"),s=Object.defineProperty,f=Object.create,l=[f(null),f(null)],p=n.length;function d(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a<t.length;a++)i=t[a].apply(o,r?[i]:[]);return r?i:o}}function m(e,t,n,r){if("function"!=typeof e&&(r||void 0!==e))throw new TypeError(t+" must "+(n||"be")+" a function"+(r?"":" or undefined"));return e}function applyDec(e,t,n,r,o,i,u,f,p,h,y,v){function g(e){if(!v(e))throw new TypeError("Attempted to access private element on non-instance")}var b=[].concat(t[0]),w=t[3],D=!u,S=3===o,j=4===o,E=2===o;function I(t,n,r){return function(o,i){return n&&(i=o,o=e),r&&r(o),P[t].call(o,i)}}if(!D){var P={},k=[],F=S?"get":j||y?"set":"value";if(p?(h||y?P={get:setFunctionName((function(){return w(this)}),r,"get"),set:function(e){t[4](this,e)}}:P[F]=w,h||setFunctionName(P[F],r,E?"":F)):h||(P=Object.getOwnPropertyDescriptor(e,r)),!h&&!p){if((c=l[+f][r])&&7!=(c^o))throw new Error("Decorating two elements with the same name ("+P[F].name+") is not supported yet");l[+f][r]=o<3?1:o}}for(var N=e,O=b.length-1;O>=0;O-=n?2:1){var z=b[O],H=n?b[O-1]:void 0,K={},R={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");m(t,"An initializer","be",!0),i.push(t)}.bind(null,K)};if(D)c=z.call(H,N,R),K.v=1,m(c,"class decorators","return")&&(N=c);else if(R.static=f,R.private=p,c=R.access={has:p?v.bind():function(e){return r in e}},j||(c.get=p?E?function(e){return g(e),P.value}:I("get",0,g):function(e){return e[r]}),E||S||(c.set=p?I("set",0,g):function(e,t){e[r]=t}),N=z.call(H,y?{get:P.get,set:P.set}:P[F],R),K.v=1,y){if("object"==typeof N&&N)(c=m(N.get,"accessor.get"))&&(P.get=c),(c=m(N.set,"accessor.set"))&&(P.set=c),(c=m(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else m(N,(h?"field":"method")+" decorators","return")&&(h?k.unshift(N):P[F]=N)}return o<2&&u.push(d(k,f,1),d(i,f,0)),h||D||(p?y?u.splice(-1,0,I("get",f),I("set",f)):u.push(E?P[F]:m.call.bind(P[F])):s(e,r,P)),N}function h(e){return s(e,u,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[u]),a=f(null==a?null:a),c=function(){var n,r,i=[];function a(e){e&&i.push(d(e))}for(var c=0;c<t.length;c++){var u=t[c],s=u[1],f=u[2],l=!!u[3],p=16&s,m=!!(8&s),h=0==(s&=7),y=1===s;applyDec(m?e:e.prototype,u,p,l?"#"+f:toPropertyKey(f),s,h||y?[]:m?r=r||[]:n=n||[],i,m,l,h,y,m&&l?function(t){return checkInRHS(t)===e}:o)}return a(n),a(r),i}(),p||h(e),{e:c,get c(){var t=[];return p&&[h(e=applyDec(e,[n],r,e.name,5,t)),d(t,1)]}}}',
5555
),
5656
// size: 187, gzip size: 167
5757
assertClassBrand: helper(

‎packages/babel-helpers/src/helpers/applyDecs2311.ts‎

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,21 @@ export default /* @no-mangle */ function applyDecs2311(
213213
// This is a temporary variable for smaller helper size
214214
var _: any;
215215

216-
function runInitializers(
216+
function createRunInitializers(
217217
initializers: Function[],
218-
hasValue: 0 | 1,
219-
thisArg: any,
220-
value?: any,
218+
useStaticThis?: 0 | 1 | boolean,
219+
hasValue?: 0 | 1,
221220
) {
222-
for (var i = 0; i < initializers.length; i++) {
223-
value = initializers[i].apply(thisArg, hasValue ? [value] : []);
224-
}
225-
return hasValue ? value : thisArg;
221+
return function (thisArg: any, value?: any) {
222+
if (useStaticThis) {
223+
value = thisArg;
224+
thisArg = targetClass;
225+
}
226+
for (var i = 0; i < initializers.length; i++) {
227+
value = initializers[i].apply(thisArg, hasValue ? [value] : []);
228+
}
229+
return hasValue ? value : thisArg;
230+
};
226231
}
227232

228233
function assertCallable(
@@ -276,8 +281,16 @@ export default /* @no-mangle */ function applyDecs2311(
276281
var isSetter = kind === PROP_KIND.SETTER;
277282
var isMethod = kind === PROP_KIND.METHOD;
278283

279-
function _bindPropCall(name: keyof PropertyDescriptor, before?: Function) {
284+
function _bindPropCall(
285+
name: keyof PropertyDescriptor,
286+
useStaticThis: 0 | 1 | boolean,
287+
before?: Function,
288+
) {
280289
return function (_this: any, value?: any) {
290+
if (useStaticThis) {
291+
value = _this;
292+
_this = Class;
293+
}
281294
if (before) {
282295
before(_this);
283296
}
@@ -395,14 +408,14 @@ export default /* @no-mangle */ function applyDecs2311(
395408
assertInstanceIfPrivate(_this);
396409
return desc.value;
397410
}
398-
: _bindPropCall("get", assertInstanceIfPrivate)
411+
: _bindPropCall("get", 0, assertInstanceIfPrivate)
399412
: function (target: any) {
400413
return target[name];
401414
};
402415
}
403416
if (!isMethod && !isGetter) {
404417
_.set = isPrivate
405-
? _bindPropCall("set", assertInstanceIfPrivate)
418+
? _bindPropCall("set", 0, assertInstanceIfPrivate)
406419
: function (target: any, v: any) {
407420
target[name] = v;
408421
};
@@ -456,23 +469,28 @@ export default /* @no-mangle */ function applyDecs2311(
456469
if (kind < PROP_KIND.METHOD) {
457470
ret.push(
458471
// init
459-
runInitializers.bind(null, init, 1),
472+
createRunInitializers(init, isStatic, 1),
460473
// init_extra
461-
runInitializers.bind(null, initializers, 0),
474+
createRunInitializers(initializers, isStatic, 0),
462475
);
463476
}
464477

465478
if (!isField && !isClass) {
466479
if (isPrivate) {
467480
if (isAccessor) {
468481
// get and set should be returned before init_extra
469-
ret.splice(-1, 0, _bindPropCall("get"), _bindPropCall("set"));
482+
ret.splice(
483+
-1,
484+
0,
485+
_bindPropCall("get", isStatic),
486+
_bindPropCall("set", isStatic),
487+
);
470488
} else {
471489
ret.push(
472490
isMethod
473491
? desc[key]
474492
: // Equivalent to `Function.call`, just to reduce code size
475-
runInitializers.call.bind(desc[key]),
493+
assertCallable.call.bind(desc[key]),
476494
);
477495
}
478496
} else {
@@ -490,7 +508,7 @@ export default /* @no-mangle */ function applyDecs2311(
490508

491509
function pushInitializers(initializers: Function[]) {
492510
if (initializers) {
493-
ret.push(runInitializers.bind(null, initializers, 0));
511+
ret.push(createRunInitializers(initializers));
494512
}
495513
}
496514

@@ -562,16 +580,16 @@ export default /* @no-mangle */ function applyDecs2311(
562580
return (
563581
hasClassDecs && [
564582
defineMetadata(
565-
applyDec(
583+
(targetClass = applyDec(
566584
targetClass,
567585
[classDecs],
568586
classDecsHaveThis,
569587
targetClass.name,
570588
PROP_KIND.CLASS,
571589
initializers,
572-
),
590+
)),
573591
),
574-
runInitializers.bind(null, initializers, 0, targetClass),
592+
createRunInitializers(initializers, 1),
575593
]
576594
);
577595
},

‎packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/context-name/output.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,38 +62,38 @@ class Foo {
6262
}
6363
_Foo = Foo;
6464
function _set_a2(v) {
65-
_set_a(this, v);
65+
_set_a(v);
6666
}
6767
function _get_a2() {
68-
return _get_a(this);
68+
return _get_a();
6969
}
7070
[_init_a, _init_extra_a, _init_a2, _get_a, _set_a, _init_extra_a2, _init_computedKey, _init_extra_computedKey, _init_computedKey2, _init_extra_computedKey2, _init_computedKey3, _init_extra_computedKey3, _init_computedKey4, _init_extra_computedKey4, _init_computedKey5, _init_extra_computedKey5, _init_computedKey6, _init_extra_computedKey6, _init_computedKey7, _init_extra_computedKey7] = babelHelpers.applyDecs2311(_Foo, [[dec, 9, "a"], [dec, 9, "a", o => babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b"], [dec, 9, "c"], [dec, 9, 0], [dec, 9, 1], [dec, 9, 2n], [dec, 9, 3n], [dec, 9, _computedKey]], []).e;
7171
var _A = {
72-
_: _init_a(_Foo)
72+
_: _init_a()
7373
};
7474
var _B = {
75-
_: (_init_extra_a(_Foo), _init_a2(_Foo))
75+
_: (_init_extra_a(), _init_a2())
7676
};
7777
var _C = {
78-
_: (_init_extra_a2(_Foo), _init_computedKey(_Foo))
78+
_: (_init_extra_a2(), _init_computedKey())
7979
};
8080
var _D = {
81-
_: (_init_extra_computedKey(_Foo), _init_computedKey2(_Foo))
81+
_: (_init_extra_computedKey(), _init_computedKey2())
8282
};
8383
var _E = {
84-
_: (_init_extra_computedKey2(_Foo), _init_computedKey3(_Foo))
84+
_: (_init_extra_computedKey2(), _init_computedKey3())
8585
};
8686
var _F = {
87-
_: (_init_extra_computedKey3(_Foo), _init_computedKey4(_Foo))
87+
_: (_init_extra_computedKey3(), _init_computedKey4())
8888
};
8989
var _G = {
90-
_: (_init_extra_computedKey4(_Foo), _init_computedKey5(_Foo))
90+
_: (_init_extra_computedKey4(), _init_computedKey5())
9191
};
9292
var _H = {
93-
_: (_init_extra_computedKey5(_Foo), _init_computedKey6(_Foo))
93+
_: (_init_extra_computedKey5(), _init_computedKey6())
9494
};
9595
var _I = {
96-
_: (_init_extra_computedKey6(_Foo), _init_computedKey7(_Foo))
96+
_: (_init_extra_computedKey6(), _init_computedKey7())
9797
};
98-
_init_extra_computedKey7(_Foo);
98+
_init_extra_computedKey7();
9999
expect(logs).toStrictEqual(["computing f", "calling toPrimitive", "a", "#a", "b", "c", "0", "1", "2", "3", "f()"]);

‎packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-private/output.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ const dec = () => {};
33
class Foo {}
44
_Foo = Foo;
55
function _set_a2(v) {
6-
_set_a(this, v);
6+
_set_a(v);
77
}
88
function _get_a2() {
9-
return _get_a(this);
9+
return _get_a();
1010
}
1111
function _set_b2(v) {
12-
_set_b(this, v);
12+
_set_b(v);
1313
}
1414
function _get_b2() {
15-
return _get_b(this);
15+
return _get_b();
1616
}
1717
[_init_a, _get_a, _set_a, _init_extra_a, _init_b, _get_b, _set_b, _init_extra_b] = babelHelpers.applyDecs2311(_Foo, [[dec, 9, "a", o => babelHelpers.assertClassBrand(o, _Foo, _A)._, (o, v) => _A._ = babelHelpers.assertClassBrand(o, _Foo, v)], [dec, 9, "b", o => babelHelpers.assertClassBrand(o, _Foo, _B)._, (o, v) => _B._ = babelHelpers.assertClassBrand(o, _Foo, v)]], []).e;
1818
var _A = {
19-
_: _init_a(_Foo)
19+
_: _init_a()
2020
};
2121
var _B = {
22-
_: (_init_extra_a(_Foo), _init_b(_Foo, 123))
22+
_: (_init_extra_a(), _init_b(123))
2323
};
24-
_init_extra_b(_Foo);
24+
_init_extra_b();

‎packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors--to-es2015/static-public/output.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class Foo {
2323
_Foo = Foo;
2424
[_init_a, _init_extra_a, _init_b, _init_extra_b, _init_computedKey, _init_extra_computedKey] = babelHelpers.applyDecs2311(_Foo, [[dec, 9, "a"], [dec, 9, "b"], [dec, 9, 'c']], []).e;
2525
var _A = {
26-
_: _init_a(_Foo)
26+
_: _init_a()
2727
};
2828
var _B = {
29-
_: (_init_extra_a(_Foo), _init_b(_Foo, 123))
29+
_: (_init_extra_a(), _init_b(123))
3030
};
3131
var _C = {
32-
_: (_init_extra_b(_Foo), _init_computedKey(_Foo, 456))
32+
_: (_init_extra_b(), _init_computedKey(456))
3333
};
34-
_init_extra_computedKey(_Foo);
34+
_init_extra_computedKey();

0 commit comments

Comments
 (0)