mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
79 lines
3.8 KiB
Plaintext
79 lines
3.8 KiB
Plaintext
//// [tests/cases/compiler/declarationEmitSimpleComputedNames1.ts] ////
|
|
|
|
=== declarationEmitSimpleComputedNames1.ts ===
|
|
export const fieldName = Math.random() > 0.5 ? "f1" : "f2";
|
|
>fieldName : Symbol(fieldName, Decl(declarationEmitSimpleComputedNames1.ts, 0, 12))
|
|
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
|
|
export const conatainer = {
|
|
>conatainer : Symbol(conatainer, Decl(declarationEmitSimpleComputedNames1.ts, 1, 12))
|
|
|
|
[fieldName]() {
|
|
>[fieldName] : Symbol([fieldName], Decl(declarationEmitSimpleComputedNames1.ts, 1, 27))
|
|
>fieldName : Symbol(fieldName, Decl(declarationEmitSimpleComputedNames1.ts, 0, 12))
|
|
|
|
return "result";
|
|
}
|
|
};
|
|
|
|
const classFieldName = Math.random() > 0.5 ? "g1" : "g2";
|
|
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
|
|
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
|
|
const otherField = classFieldName === "g1" ? "g2" : "g1";
|
|
>otherField : Symbol(otherField, Decl(declarationEmitSimpleComputedNames1.ts, 8, 5))
|
|
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
|
|
|
|
const staticField = Math.random() > 0.5 ? "s1" : "s2";
|
|
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
|
|
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
|
|
|
|
export class Holder {
|
|
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
|
|
|
|
[classFieldName]() {
|
|
>[classFieldName] : Symbol(Holder[classFieldName], Decl(declarationEmitSimpleComputedNames1.ts, 10, 21))
|
|
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
|
|
|
|
return "value";
|
|
}
|
|
[otherField]() {
|
|
>[otherField] : Symbol(Holder[otherField], Decl(declarationEmitSimpleComputedNames1.ts, 13, 5))
|
|
>otherField : Symbol(otherField, Decl(declarationEmitSimpleComputedNames1.ts, 8, 5))
|
|
|
|
return 42;
|
|
}
|
|
static [staticField]() {
|
|
>[staticField] : Symbol(Holder[staticField], Decl(declarationEmitSimpleComputedNames1.ts, 16, 5))
|
|
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
|
|
|
|
return { static: true };
|
|
>static : Symbol(static, Decl(declarationEmitSimpleComputedNames1.ts, 18, 16))
|
|
}
|
|
static [staticField]() {
|
|
>[staticField] : Symbol(Holder[staticField], Decl(declarationEmitSimpleComputedNames1.ts, 19, 5))
|
|
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
|
|
|
|
return { static: "sometimes" };
|
|
>static : Symbol(static, Decl(declarationEmitSimpleComputedNames1.ts, 21, 16))
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Could be `"prototype"`, so all static string indexers include the instance type
|
|
*/
|
|
export const staticLookup = Holder["some" + "thing"];
|
|
>staticLookup : Symbol(staticLookup, Decl(declarationEmitSimpleComputedNames1.ts, 28, 12))
|
|
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
|
|
|
|
export const instanceLookup = (new Holder())["some" + "thing"];
|
|
>instanceLookup : Symbol(instanceLookup, Decl(declarationEmitSimpleComputedNames1.ts, 29, 12))
|
|
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
|
|
|