Skip to content

Commit a8cfdfa

Browse files
Replace 'let' with 'const' for iterator variables in main functions to enforce immutability
1 parent 7d9f8d6 commit a8cfdfa

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

tslang/test/tester/tests/00generator.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ function makeRangeIterator1(start: int, end: int, step: int) {
2222
}
2323

2424
function main1() {
25-
// DO NOT PUT CONST, otherwise you can't edit
26-
let it = makeRangeIterator1(1, 10, 2);
25+
const it = makeRangeIterator1(1, 10, 2);
2726

2827
let count = 0;
2928
let result = it.next();
@@ -60,8 +59,7 @@ function makeRangeIterator2(start: int, end: int, step: int) {
6059
}
6160

6261
function main2() {
63-
// DO NOT PUT CONST, otherwise you can't edit
64-
let it = makeRangeIterator2(1, 10, 2);
62+
const it = makeRangeIterator2(1, 10, 2);
6563

6664
let count = 0;
6765
let result = it.next();
@@ -98,8 +96,7 @@ function makeRangeIterator3(start = 0, end = 10000, step = 1) {
9896
}
9997

10098
function main3() {
101-
// DO NOT PUT CONST, otherwise you can't edit
102-
let it = makeRangeIterator3(1, 10, 2);
99+
const it = makeRangeIterator3(1, 10, 2);
103100

104101
let count = 0;
105102
let result = it.next();

0 commit comments

Comments
 (0)