61 lines
837 B
Plaintext
61 lines
837 B
Plaintext
=== tests/cases/compiler/duplicateVariablesByScope.ts ===
|
|
// duplicate local variables are only reported at global scope
|
|
|
|
module M {
|
|
>M : typeof M
|
|
|
|
for (var j = 0; j < 10; j++) {
|
|
>j : number
|
|
>j < 10 : boolean
|
|
>j : number
|
|
>j++ : number
|
|
>j : number
|
|
}
|
|
|
|
for (var j = 0; j < 10; j++) {
|
|
>j : number
|
|
>j < 10 : boolean
|
|
>j : number
|
|
>j++ : number
|
|
>j : number
|
|
}
|
|
}
|
|
|
|
function foo() {
|
|
>foo : () => void
|
|
|
|
var x = 2;
|
|
>x : number
|
|
|
|
var x = 1;
|
|
>x : number
|
|
|
|
if (true) {
|
|
var result = 1;
|
|
>result : number
|
|
}
|
|
else {
|
|
var result = 2;
|
|
>result : number
|
|
}
|
|
}
|
|
|
|
class C {
|
|
>C : C
|
|
|
|
foo() {
|
|
>foo : () => void
|
|
|
|
try {
|
|
var x = 1;
|
|
>x : number
|
|
}
|
|
catch (e) {
|
|
>e : any
|
|
|
|
var x = 2;
|
|
>x : number
|
|
}
|
|
}
|
|
}
|