Skip to content

Commit 0126eba

Browse files
author
Joseph Watts
committed
Changed baselines for esnext class property transformation refactor
1 parent a60534e commit 0126eba

22 files changed

+228
-183
lines changed

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8631,11 +8631,50 @@ declare namespace ts {
86318631
* - this is mostly subjective beyond the requirement that the expression not be sideeffecting
86328632
*/
86338633
function isSimpleCopiableExpression(expression: Expression): boolean;
8634+
/**
8635+
* A simple inlinable expression is an expression which can be copied into multiple locations
8636+
* without risk of repeating any sideeffects and whose value could not possibly change between
8637+
* any such locations
8638+
*/
8639+
function isSimpleInlineableExpression(expression: Expression): boolean;
8640+
/**
8641+
* Adds super call and preceding prologue directives into the list of statements.
8642+
*
8643+
* @param ctor The constructor node.
8644+
* @returns index of the statement that follows super call
8645+
*/
8646+
function addPrologueDirectivesAndInitialSuperCall(ctor: ConstructorDeclaration, result: Statement[], visitor: Visitor): number;
86348647
/**
86358648
* @param input Template string input strings
86368649
* @param args Names which need to be made file-level unique
86378650
*/
86388651
function helperString(input: TemplateStringsArray, ...args: string[]): (uniqueName: EmitHelperUniqueNameCallback) => string;
8652+
/**
8653+
* Gets all property declarations with initializers on either the static or instance side of a class.
8654+
*
8655+
* @param node The class node.
8656+
* @param isStatic A value indicating whether to get properties from the static or instance side of the class.
8657+
*/
8658+
function getInitializedProperties(node: ClassExpression | ClassDeclaration, isStatic: boolean): ReadonlyArray<PropertyDeclaration>;
8659+
/**
8660+
* Gets a value indicating whether a class element is a static property declaration with an initializer.
8661+
*
8662+
* @param member The class element node.
8663+
*/
8664+
function isStaticInitializedProperty(member: ClassElement): member is PropertyDeclaration;
8665+
/**
8666+
* Gets a value indicating whether a class element is an instance property declaration with an initializer.
8667+
*
8668+
* @param member The class element node.
8669+
*/
8670+
function isInstanceInitializedProperty(member: ClassElement): member is PropertyDeclaration;
8671+
/**
8672+
* Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer.
8673+
*
8674+
* @param member The class element node.
8675+
* @param isStatic A value indicating whether the member should be a static or instance member.
8676+
*/
8677+
function isInitializedProperty(member: ClassElement, isStatic: boolean): boolean;
86398678
}
86408679
declare namespace ts {
86418680
enum FlattenLevel {

tests/baselines/reference/classBlockScoping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function f(b: boolean) {
3434
}
3535

3636
//// [classBlockScoping.js]
37+
var _a;
3738
function f(b) {
38-
var _a;
3939
var Foo;
4040
if (b) {
4141
Foo = (_a = /** @class */ (function () {

tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var C = /** @class */ (function () {
3434
}
3535
return C;
3636
}());
37-
_a = a_1.x;
3837
exports.C = C;
38+
_a = a_1.x;
3939
//// [c.js]
4040
"use strict";
4141
var __extends = (this && this.__extends) || (function () {
@@ -64,8 +64,8 @@ var D = /** @class */ (function (_super) {
6464
}
6565
return D;
6666
}(b_1.C));
67-
_a = a_1.x;
6867
exports.D = D;
68+
_a = a_1.x;
6969

7070

7171
//// [a.d.ts]

tests/baselines/reference/decoratorsOnComputedProperties.js

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
196196
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
197197
return c > 3 && r && Object.defineProperty(target, key, r), r;
198198
};
199-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
199+
var _a, _b, _c, _d;
200+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
200201
function x(o, k) { }
201202
let i = 0;
202203
function foo() { return ++i + ""; }
@@ -209,11 +210,11 @@ class A {
209210
this[Symbol.iterator] = null;
210211
this["property4"] = 2;
211212
this[Symbol.match] = null;
212-
this[_b] = null;
213-
this[_d] = null;
213+
this[_f] = null;
214+
this[_h] = null;
214215
}
215216
}
216-
foo(), _a = foo(), _b = foo(), _c = fieldNameB, _d = fieldNameC;
217+
foo(), _e = foo(), _f = foo(), _g = fieldNameB, _h = fieldNameC;
217218
__decorate([
218219
x
219220
], A.prototype, "property", void 0);
@@ -228,42 +229,42 @@ __decorate([
228229
], A.prototype, Symbol.iterator, void 0);
229230
__decorate([
230231
x
231-
], A.prototype, _a, void 0);
232+
], A.prototype, _e, void 0);
232233
__decorate([
233234
x
234-
], A.prototype, _b, void 0);
235+
], A.prototype, _f, void 0);
235236
__decorate([
236237
x
237-
], A.prototype, _c, void 0);
238+
], A.prototype, _g, void 0);
238239
__decorate([
239240
x
240-
], A.prototype, _d, void 0);
241-
void (_j = class B {
241+
], A.prototype, _h, void 0);
242+
void (_a = class B {
242243
constructor() {
243244
this["property2"] = 2;
244245
this[Symbol.iterator] = null;
245246
this["property4"] = 2;
246247
this[Symbol.match] = null;
247-
this[_f] = null;
248-
this[_h] = null;
248+
this[_k] = null;
249+
this[_m] = null;
249250
}
250251
},
251252
foo(),
252-
_e = foo(),
253-
_f = foo(),
254-
_g = fieldNameB,
255-
_h = fieldNameC,
256-
_j);
253+
_j = foo(),
254+
_k = foo(),
255+
_l = fieldNameB,
256+
_m = fieldNameC,
257+
_a);
257258
class C {
258259
constructor() {
259260
this["property2"] = 2;
260261
this[Symbol.iterator] = null;
261262
this["property4"] = 2;
262263
this[Symbol.match] = null;
263-
this[_l] = null;
264-
this[_o] = null;
264+
this[_p] = null;
265+
this[_r] = null;
265266
}
266-
[(foo(), _k = foo(), _l = foo(), _m = fieldNameB, _o = fieldNameC, "some" + "method")]() { }
267+
[(foo(), _o = foo(), _p = foo(), _q = fieldNameB, _r = fieldNameC, "some" + "method")]() { }
267268
}
268269
__decorate([
269270
x
@@ -279,39 +280,39 @@ __decorate([
279280
], C.prototype, Symbol.iterator, void 0);
280281
__decorate([
281282
x
282-
], C.prototype, _k, void 0);
283+
], C.prototype, _o, void 0);
283284
__decorate([
284285
x
285-
], C.prototype, _l, void 0);
286+
], C.prototype, _p, void 0);
286287
__decorate([
287288
x
288-
], C.prototype, _m, void 0);
289+
], C.prototype, _q, void 0);
289290
__decorate([
290291
x
291-
], C.prototype, _o, void 0);
292+
], C.prototype, _r, void 0);
292293
void class D {
293294
constructor() {
294295
this["property2"] = 2;
295296
this[Symbol.iterator] = null;
296297
this["property4"] = 2;
297298
this[Symbol.match] = null;
298-
this[_q] = null;
299-
this[_s] = null;
299+
this[_t] = null;
300+
this[_v] = null;
300301
}
301-
[(foo(), _p = foo(), _q = foo(), _r = fieldNameB, _s = fieldNameC, "some" + "method")]() { }
302+
[(foo(), _s = foo(), _t = foo(), _u = fieldNameB, _v = fieldNameC, "some" + "method")]() { }
302303
};
303304
class E {
304305
constructor() {
305306
this["property2"] = 2;
306307
this[Symbol.iterator] = null;
307308
this["property4"] = 2;
308309
this[Symbol.match] = null;
309-
this[_u] = null;
310-
this[_w] = null;
310+
this[_x] = null;
311+
this[_z] = null;
311312
}
312-
[(foo(), _t = foo(), _u = foo(), "some" + "method")]() { }
313+
[(foo(), _w = foo(), _x = foo(), "some" + "method")]() { }
313314
}
314-
_v = fieldNameB, _w = fieldNameC;
315+
_y = fieldNameB, _z = fieldNameC;
315316
__decorate([
316317
x
317318
], E.prototype, "property", void 0);
@@ -326,43 +327,43 @@ __decorate([
326327
], E.prototype, Symbol.iterator, void 0);
327328
__decorate([
328329
x
329-
], E.prototype, _t, void 0);
330+
], E.prototype, _w, void 0);
330331
__decorate([
331332
x
332-
], E.prototype, _u, void 0);
333+
], E.prototype, _x, void 0);
333334
__decorate([
334335
x
335-
], E.prototype, _v, void 0);
336+
], E.prototype, _y, void 0);
336337
__decorate([
337338
x
338-
], E.prototype, _w, void 0);
339-
void (_1 = class F {
339+
], E.prototype, _z, void 0);
340+
void (_b = class F {
340341
constructor() {
341342
this["property2"] = 2;
342343
this[Symbol.iterator] = null;
343344
this["property4"] = 2;
344345
this[Symbol.match] = null;
345-
this[_y] = null;
346-
this[_0] = null;
346+
this[_1] = null;
347+
this[_3] = null;
347348
}
348-
[(foo(), _x = foo(), _y = foo(), "some" + "method")]() { }
349+
[(foo(), _0 = foo(), _1 = foo(), "some" + "method")]() { }
349350
},
350-
_z = fieldNameB,
351-
_0 = fieldNameC,
352-
_1);
351+
_2 = fieldNameB,
352+
_3 = fieldNameC,
353+
_b);
353354
class G {
354355
constructor() {
355356
this["property2"] = 2;
356357
this[Symbol.iterator] = null;
357358
this["property4"] = 2;
358359
this[Symbol.match] = null;
359-
this[_3] = null;
360360
this[_5] = null;
361+
this[_7] = null;
361362
}
362-
[(foo(), _2 = foo(), _3 = foo(), "some" + "method")]() { }
363-
[(_4 = fieldNameB, "some" + "method2")]() { }
363+
[(foo(), _4 = foo(), _5 = foo(), "some" + "method")]() { }
364+
[(_6 = fieldNameB, "some" + "method2")]() { }
364365
}
365-
_5 = fieldNameC;
366+
_7 = fieldNameC;
366367
__decorate([
367368
x
368369
], G.prototype, "property", void 0);
@@ -377,43 +378,43 @@ __decorate([
377378
], G.prototype, Symbol.iterator, void 0);
378379
__decorate([
379380
x
380-
], G.prototype, _2, void 0);
381+
], G.prototype, _4, void 0);
381382
__decorate([
382383
x
383-
], G.prototype, _3, void 0);
384+
], G.prototype, _5, void 0);
384385
__decorate([
385386
x
386-
], G.prototype, _4, void 0);
387+
], G.prototype, _6, void 0);
387388
__decorate([
388389
x
389-
], G.prototype, _5, void 0);
390-
void (_10 = class H {
390+
], G.prototype, _7, void 0);
391+
void (_c = class H {
391392
constructor() {
392393
this["property2"] = 2;
393394
this[Symbol.iterator] = null;
394395
this["property4"] = 2;
395396
this[Symbol.match] = null;
396-
this[_7] = null;
397397
this[_9] = null;
398+
this[_11] = null;
398399
}
399-
[(foo(), _6 = foo(), _7 = foo(), "some" + "method")]() { }
400-
[(_8 = fieldNameB, "some" + "method2")]() { }
400+
[(foo(), _8 = foo(), _9 = foo(), "some" + "method")]() { }
401+
[(_10 = fieldNameB, "some" + "method2")]() { }
401402
},
402-
_9 = fieldNameC,
403-
_10);
403+
_11 = fieldNameC,
404+
_c);
404405
class I {
405406
constructor() {
406407
this["property2"] = 2;
407408
this[Symbol.iterator] = null;
408409
this["property4"] = 2;
409410
this[Symbol.match] = null;
410-
this[_12] = null;
411-
this[_15] = null;
411+
this[_13] = null;
412+
this[_16] = null;
412413
}
413-
[(foo(), _11 = foo(), _12 = foo(), _13 = "some" + "method")]() { }
414-
[(_14 = fieldNameB, "some" + "method2")]() { }
414+
[(foo(), _12 = foo(), _13 = foo(), _14 = "some" + "method")]() { }
415+
[(_15 = fieldNameB, "some" + "method2")]() { }
415416
}
416-
_15 = fieldNameC;
417+
_16 = fieldNameC;
417418
__decorate([
418419
x
419420
], I.prototype, "property", void 0);
@@ -426,32 +427,32 @@ __decorate([
426427
__decorate([
427428
x
428429
], I.prototype, Symbol.iterator, void 0);
429-
__decorate([
430-
x
431-
], I.prototype, _11, void 0);
432430
__decorate([
433431
x
434432
], I.prototype, _12, void 0);
435433
__decorate([
436434
x
437-
], I.prototype, _13, null);
435+
], I.prototype, _13, void 0);
438436
__decorate([
439437
x
440-
], I.prototype, _14, void 0);
438+
], I.prototype, _14, null);
441439
__decorate([
442440
x
443441
], I.prototype, _15, void 0);
444-
void (_21 = class J {
442+
__decorate([
443+
x
444+
], I.prototype, _16, void 0);
445+
void (_d = class J {
445446
constructor() {
446447
this["property2"] = 2;
447448
this[Symbol.iterator] = null;
448449
this["property4"] = 2;
449450
this[Symbol.match] = null;
450-
this[_17] = null;
451-
this[_20] = null;
451+
this[_18] = null;
452+
this[_21] = null;
452453
}
453-
[(foo(), _16 = foo(), _17 = foo(), _18 = "some" + "method")]() { }
454-
[(_19 = fieldNameB, "some" + "method2")]() { }
454+
[(foo(), _17 = foo(), _18 = foo(), _19 = "some" + "method")]() { }
455+
[(_20 = fieldNameB, "some" + "method2")]() { }
455456
},
456-
_20 = fieldNameC,
457-
_21);
457+
_21 = fieldNameC,
458+
_d);

tests/baselines/reference/dynamicNamesErrors.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ const y = Symbol();
7373
const z = Symbol();
7474
const w = Symbol();
7575
class ClassMemberVisibility {
76+
static [x];
7677
static [y]() { return 0; }
7778
static get [z]() { return 0; }
7879
static set [w](value) { }
80+
[x];
7981
[y]() { return 0; }
8082
get [z]() { return 0; }
8183
set [w](value) { }

0 commit comments

Comments
 (0)