* Revised emit for computed property names * Fix downlevel name generation scopes * Accept slightly more conservative baseline * First feedback pass * Reduce number of nonrequired variable declarations and assignments * Remove side-effect-free identifier references * skip partially emitted expressions * Comments, move starsOnNewLine to emitNode * Put expressions on newlines when inlined in class expressions for consistency * Update new ref * Fix typo in comment
191 lines
4.9 KiB
TypeScript
191 lines
4.9 KiB
TypeScript
// @target: es6
|
|
// @experimentalDecorators: true
|
|
function x(o: object, k: PropertyKey) { }
|
|
let i = 0;
|
|
function foo(): string { return ++i + ""; }
|
|
|
|
const fieldNameA: string = "fieldName1";
|
|
const fieldNameB: string = "fieldName2";
|
|
const fieldNameC: string = "fieldName3";
|
|
|
|
class A {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
}
|
|
|
|
void class B {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
};
|
|
|
|
class C {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
["some" + "method"]() {}
|
|
}
|
|
|
|
void class D {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
["some" + "method"]() {}
|
|
};
|
|
|
|
class E {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
}
|
|
|
|
void class F {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
@x [fieldNameC]: any = null;
|
|
};
|
|
|
|
class G {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
["some" + "method2"]() {}
|
|
@x [fieldNameC]: any = null;
|
|
}
|
|
|
|
void class H {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
["some" + "method2"]() {}
|
|
@x [fieldNameC]: any = null;
|
|
};
|
|
|
|
class I {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
@x ["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
["some" + "method2"]() {}
|
|
@x [fieldNameC]: any = null;
|
|
}
|
|
|
|
void class J {
|
|
@x ["property"]: any;
|
|
@x [Symbol.toStringTag]: any;
|
|
@x ["property2"]: any = 2;
|
|
@x [Symbol.iterator]: any = null;
|
|
["property3"]: any;
|
|
[Symbol.isConcatSpreadable]: any;
|
|
["property4"]: any = 2;
|
|
[Symbol.match]: any = null;
|
|
[foo()]: any;
|
|
@x [foo()]: any;
|
|
@x [foo()]: any = null;
|
|
@x ["some" + "method"]() {}
|
|
[fieldNameA]: any;
|
|
@x [fieldNameB]: any;
|
|
["some" + "method2"]() {}
|
|
@x [fieldNameC]: any = null;
|
|
}; |