mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
46 lines
2.0 KiB
Plaintext
46 lines
2.0 KiB
Plaintext
//// [tests/cases/compiler/argumentsAsPropertyName.ts] ////
|
|
|
|
=== argumentsAsPropertyName.ts ===
|
|
// target: es5
|
|
type MyType = {
|
|
>MyType : Symbol(MyType, Decl(argumentsAsPropertyName.ts, 0, 0))
|
|
|
|
arguments: Array<string>
|
|
>arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
|
|
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
|
}
|
|
|
|
declare function use(s: any);
|
|
>use : Symbol(use, Decl(argumentsAsPropertyName.ts, 3, 1))
|
|
>s : Symbol(s, Decl(argumentsAsPropertyName.ts, 5, 21))
|
|
|
|
function myFunction(myType: MyType) {
|
|
>myFunction : Symbol(myFunction, Decl(argumentsAsPropertyName.ts, 5, 29))
|
|
>myType : Symbol(myType, Decl(argumentsAsPropertyName.ts, 7, 20))
|
|
>MyType : Symbol(MyType, Decl(argumentsAsPropertyName.ts, 0, 0))
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
>i : Symbol(i, Decl(argumentsAsPropertyName.ts, 8, 12))
|
|
>i : Symbol(i, Decl(argumentsAsPropertyName.ts, 8, 12))
|
|
>i : Symbol(i, Decl(argumentsAsPropertyName.ts, 8, 12))
|
|
|
|
use(myType.arguments[i]);
|
|
>use : Symbol(use, Decl(argumentsAsPropertyName.ts, 3, 1))
|
|
>myType.arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
|
|
>myType : Symbol(myType, Decl(argumentsAsPropertyName.ts, 7, 20))
|
|
>arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
|
|
>i : Symbol(i, Decl(argumentsAsPropertyName.ts, 8, 12))
|
|
|
|
// create closure so that tsc will turn loop body into function
|
|
const x = 5;
|
|
>x : Symbol(x, Decl(argumentsAsPropertyName.ts, 11, 13))
|
|
|
|
[1, 2, 3].forEach(function(j) { use(x); })
|
|
>[1, 2, 3].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
|
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
|
|
>j : Symbol(j, Decl(argumentsAsPropertyName.ts, 12, 35))
|
|
>use : Symbol(use, Decl(argumentsAsPropertyName.ts, 3, 1))
|
|
>x : Symbol(x, Decl(argumentsAsPropertyName.ts, 11, 13))
|
|
}
|
|
}
|