File: controlFlowLoopAnalysis.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (129 lines) | stat: -rw-r--r-- 4,799 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
=== tests/cases/compiler/controlFlowLoopAnalysis.ts ===
// Repro from #8418

let cond: boolean;
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

function foo(x: number): number { return 1; }
>foo : Symbol(foo, Decl(controlFlowLoopAnalysis.ts, 2, 18))
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 4, 13))

function test1() {
>test1 : Symbol(test1, Decl(controlFlowLoopAnalysis.ts, 4, 45))

    let x: number | undefined;
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 7, 7))

    while (cond) {
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

        while (cond) {
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

            while (cond) {
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

                x = foo(x);
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 7, 7))
>foo : Symbol(foo, Decl(controlFlowLoopAnalysis.ts, 2, 18))
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 7, 7))
            }
        }
        x = 1;
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 7, 7))
    }
}

// Repro from #8418

function test2() {
>test2 : Symbol(test2, Decl(controlFlowLoopAnalysis.ts, 16, 1))

    let x: number | undefined;
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 21, 7))

    x = 1;
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 21, 7))

    while (cond) {
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

        while (cond) {
>cond : Symbol(cond, Decl(controlFlowLoopAnalysis.ts, 2, 3))

            x = foo(x);
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 21, 7))
>foo : Symbol(foo, Decl(controlFlowLoopAnalysis.ts, 2, 18))
>x : Symbol(x, Decl(controlFlowLoopAnalysis.ts, 21, 7))
        }
    }
}

// Repro from #8511

function mapUntilCant<a, b>(
>mapUntilCant : Symbol(mapUntilCant, Decl(controlFlowLoopAnalysis.ts, 28, 1))
>a : Symbol(a, Decl(controlFlowLoopAnalysis.ts, 32, 22))
>b : Symbol(b, Decl(controlFlowLoopAnalysis.ts, 32, 24))

    values: a[],
>values : Symbol(values, Decl(controlFlowLoopAnalysis.ts, 32, 28))
>a : Symbol(a, Decl(controlFlowLoopAnalysis.ts, 32, 22))

    canTake: (value: a, index: number) => boolean,
>canTake : Symbol(canTake, Decl(controlFlowLoopAnalysis.ts, 33, 16))
>value : Symbol(value, Decl(controlFlowLoopAnalysis.ts, 34, 14))
>a : Symbol(a, Decl(controlFlowLoopAnalysis.ts, 32, 22))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 34, 23))

    mapping: (value: a, index: number) => b
>mapping : Symbol(mapping, Decl(controlFlowLoopAnalysis.ts, 34, 50))
>value : Symbol(value, Decl(controlFlowLoopAnalysis.ts, 35, 14))
>a : Symbol(a, Decl(controlFlowLoopAnalysis.ts, 32, 22))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 35, 23))
>b : Symbol(b, Decl(controlFlowLoopAnalysis.ts, 32, 24))

): b[] {
>b : Symbol(b, Decl(controlFlowLoopAnalysis.ts, 32, 24))

    let result: b[] = [];
>result : Symbol(result, Decl(controlFlowLoopAnalysis.ts, 37, 7))
>b : Symbol(b, Decl(controlFlowLoopAnalysis.ts, 32, 24))

    for (let index = 0, length = values.length; index < length; index++) {
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))
>length : Symbol(length, Decl(controlFlowLoopAnalysis.ts, 38, 23))
>values.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>values : Symbol(values, Decl(controlFlowLoopAnalysis.ts, 32, 28))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))
>length : Symbol(length, Decl(controlFlowLoopAnalysis.ts, 38, 23))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))

        let value = values[index];
>value : Symbol(value, Decl(controlFlowLoopAnalysis.ts, 39, 11))
>values : Symbol(values, Decl(controlFlowLoopAnalysis.ts, 32, 28))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))

        if (canTake(value, index)) {
>canTake : Symbol(canTake, Decl(controlFlowLoopAnalysis.ts, 33, 16))
>value : Symbol(value, Decl(controlFlowLoopAnalysis.ts, 39, 11))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))

            result.push(mapping(value, index));
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result : Symbol(result, Decl(controlFlowLoopAnalysis.ts, 37, 7))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>mapping : Symbol(mapping, Decl(controlFlowLoopAnalysis.ts, 34, 50))
>value : Symbol(value, Decl(controlFlowLoopAnalysis.ts, 39, 11))
>index : Symbol(index, Decl(controlFlowLoopAnalysis.ts, 38, 12))

        } else {
            return result;
>result : Symbol(result, Decl(controlFlowLoopAnalysis.ts, 37, 7))
        }
    }
    return result;
>result : Symbol(result, Decl(controlFlowLoopAnalysis.ts, 37, 7))
}