360 lines
5.5 KiB
Plaintext
360 lines
5.5 KiB
Plaintext
=== tests/cases/compiler/capturedLetConstInLoop9.ts ===
|
|
for (let x = 0; x < 1; ++x) {
|
|
>x : number
|
|
>0 : number
|
|
>x < 1 : boolean
|
|
>x : number
|
|
>1 : number
|
|
>++x : number
|
|
>x : number
|
|
|
|
let x;
|
|
>x : any
|
|
|
|
(function() { return x });
|
|
>(function() { return x }) : () => any
|
|
>function() { return x } : () => any
|
|
>x : any
|
|
{
|
|
let x;
|
|
>x : any
|
|
|
|
(function() { return x });
|
|
>(function() { return x }) : () => any
|
|
>function() { return x } : () => any
|
|
>x : any
|
|
}
|
|
|
|
try { }
|
|
catch (e) {
|
|
>e : any
|
|
|
|
let x;
|
|
>x : any
|
|
|
|
(function() { return x });
|
|
>(function() { return x }) : () => any
|
|
>function() { return x } : () => any
|
|
>x : any
|
|
}
|
|
|
|
switch (x) {
|
|
>x : any
|
|
|
|
case 1:
|
|
>1 : 1
|
|
|
|
let x;
|
|
>x : any
|
|
|
|
(function() { return x });
|
|
>(function() { return x }) : () => any
|
|
>function() { return x } : () => any
|
|
>x : any
|
|
|
|
break;
|
|
}
|
|
|
|
while (1 == 1) {
|
|
>1 == 1 : boolean
|
|
>1 : 1
|
|
>1 : 1
|
|
|
|
let x;
|
|
>x : any
|
|
|
|
(function() { return x });
|
|
>(function() { return x }) : () => any
|
|
>function() { return x } : () => any
|
|
>x : any
|
|
}
|
|
|
|
class A {
|
|
>A : A
|
|
|
|
m() {
|
|
>m : () => any
|
|
|
|
return x + 1;
|
|
>x + 1 : any
|
|
>x : any
|
|
>1 : number
|
|
}
|
|
}
|
|
}
|
|
|
|
declare function use(a: any);
|
|
>use : (a: any) => any
|
|
>a : any
|
|
|
|
function foo() {
|
|
>foo : () => number
|
|
|
|
l0:
|
|
>l0 : any
|
|
|
|
for (let a of []) {
|
|
>a : any
|
|
>[] : undefined[]
|
|
|
|
if (a === 1) {
|
|
>a === 1 : boolean
|
|
>a : any
|
|
>1 : 1
|
|
|
|
break;
|
|
}
|
|
|
|
if (a === 2) {
|
|
>a === 2 : boolean
|
|
>a : any
|
|
>2 : 2
|
|
|
|
break l0;
|
|
>l0 : any
|
|
}
|
|
|
|
for (let b of []) {
|
|
>b : any
|
|
>[] : undefined[]
|
|
|
|
var [{x, y:z}] = [{x:1, y:2}];
|
|
>x : number
|
|
>y : any
|
|
>z : number
|
|
>[{x:1, y:2}] : [{ x: number; y: number; }]
|
|
>{x:1, y:2} : { x: number; y: number; }
|
|
>x : number
|
|
>1 : number
|
|
>y : number
|
|
>2 : number
|
|
|
|
if (b === 1) {
|
|
>b === 1 : boolean
|
|
>b : any
|
|
>1 : 1
|
|
|
|
break;
|
|
}
|
|
|
|
|
|
if (b === 2) {
|
|
>b === 2 : boolean
|
|
>b : any
|
|
>2 : 2
|
|
|
|
break l0;
|
|
>l0 : any
|
|
}
|
|
|
|
l1:
|
|
>l1 : any
|
|
|
|
if (b === 3) {
|
|
>b === 3 : boolean
|
|
>b : any
|
|
>3 : 3
|
|
|
|
break l1;
|
|
>l1 : any
|
|
}
|
|
|
|
return 50;
|
|
>50 : number
|
|
}
|
|
|
|
for (let b of []) {
|
|
>b : any
|
|
>[] : undefined[]
|
|
|
|
var [{x1, y:z1}] = [{x1:1, y:arguments.length}];
|
|
>x1 : number
|
|
>y : any
|
|
>z1 : number
|
|
>[{x1:1, y:arguments.length}] : [{ x1: number; y: number; }]
|
|
>{x1:1, y:arguments.length} : { x1: number; y: number; }
|
|
>x1 : number
|
|
>1 : number
|
|
>y : number
|
|
>arguments.length : number
|
|
>arguments : IArguments
|
|
>length : number
|
|
|
|
if (b === 1) {
|
|
>b === 1 : boolean
|
|
>b : any
|
|
>1 : 1
|
|
|
|
break;
|
|
}
|
|
|
|
if (b === 2) {
|
|
>b === 2 : boolean
|
|
>b : any
|
|
>2 : 2
|
|
|
|
break l0;
|
|
>l0 : any
|
|
}
|
|
|
|
() => b
|
|
>() => b : () => any
|
|
>b : any
|
|
|
|
return 100;
|
|
>100 : number
|
|
}
|
|
|
|
|
|
() => a;
|
|
>() => a : () => any
|
|
>a : any
|
|
}
|
|
|
|
use(x);
|
|
>use(x) : any
|
|
>use : (a: any) => any
|
|
>x : number
|
|
|
|
use(z);
|
|
>use(z) : any
|
|
>use : (a: any) => any
|
|
>z : number
|
|
|
|
use(x1);
|
|
>use(x1) : any
|
|
>use : (a: any) => any
|
|
>x1 : number
|
|
|
|
use(z1);
|
|
>use(z1) : any
|
|
>use : (a: any) => any
|
|
>z1 : number
|
|
}
|
|
|
|
function foo2() {
|
|
>foo2 : () => void
|
|
|
|
for (let x of []) {
|
|
>x : any
|
|
>[] : undefined[]
|
|
|
|
if (x === 1) {
|
|
>x === 1 : boolean
|
|
>x : any
|
|
>1 : 1
|
|
|
|
break;
|
|
}
|
|
else if (x === 2) {
|
|
>x === 2 : boolean
|
|
>x : any
|
|
>2 : 2
|
|
|
|
continue;
|
|
}
|
|
|
|
while (1 === 1) {
|
|
>1 === 1 : boolean
|
|
>1 : 1
|
|
>1 : 1
|
|
|
|
if (x) {
|
|
>x : any
|
|
|
|
break;
|
|
}
|
|
else {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
switch(x) {
|
|
>x : any
|
|
|
|
case 1: break;
|
|
>1 : 1
|
|
|
|
case 2: continue;
|
|
>2 : 2
|
|
}
|
|
|
|
for (let y of []) {
|
|
>y : any
|
|
>[] : undefined[]
|
|
|
|
switch(y) {
|
|
>y : any
|
|
|
|
case 1: break;
|
|
>1 : 1
|
|
|
|
case 2: continue;
|
|
>2 : 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class C {
|
|
>C : C
|
|
|
|
constructor(private N: number) { }
|
|
>N : number
|
|
|
|
foo() {
|
|
>foo : () => void
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
>i : number
|
|
>0 : number
|
|
>i < 100 : boolean
|
|
>i : number
|
|
>100 : number
|
|
>i++ : number
|
|
>i : number
|
|
|
|
let f = () => this.N * i;
|
|
>f : () => number
|
|
>() => this.N * i : () => number
|
|
>this.N * i : number
|
|
>this.N : number
|
|
>this : this
|
|
>N : number
|
|
>i : number
|
|
}
|
|
}
|
|
}
|
|
|
|
function foo3 () {
|
|
>foo3 : () => void
|
|
|
|
let x = arguments.length;
|
|
>x : number
|
|
>arguments.length : number
|
|
>arguments : IArguments
|
|
>length : number
|
|
|
|
for (let y of []) {
|
|
>y : any
|
|
>[] : undefined[]
|
|
|
|
let z = arguments.length;
|
|
>z : number
|
|
>arguments.length : number
|
|
>arguments : IArguments
|
|
>length : number
|
|
|
|
(function() { return y + z + arguments.length; });
|
|
>(function() { return y + z + arguments.length; }) : () => any
|
|
>function() { return y + z + arguments.length; } : () => any
|
|
>y + z + arguments.length : any
|
|
>y + z : any
|
|
>y : any
|
|
>z : number
|
|
>arguments.length : number
|
|
>arguments : IArguments
|
|
>length : number
|
|
}
|
|
}
|