Skip to content

Commit 71590de

Browse files
Merge pull request #2539 from Microsoft/forOfLengthCache
Remove experimental flag to cache for-of length checks.
2 parents 78197ed + 3b35473 commit 71590de

File tree

4 files changed

+2
-26
lines changed

4 files changed

+2
-26
lines changed

Jakefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
254254
options += " --stripInternal"
255255
}
256256

257-
options += " --cacheDownlevelForOfLength";
258-
259257
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
260258
cmd = cmd + sources.join(" ");
261259
console.log(cmd + "\n");

src/compiler/commandLineParser.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ module ts {
140140
description: Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
141141
experimental: true
142142
},
143-
{
144-
name: "cacheDownlevelForOfLength",
145-
type: "boolean",
146-
description: "Cache length access when downlevel emitting for-of statements",
147-
experimental: true,
148-
},
149143
{
150144
name: "target",
151145
shortName: "t",

src/compiler/emitter.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,8 +2167,6 @@ module ts {
21672167
let counter = createTempVariable(TempFlags._i);
21682168
let rhsReference = rhsIsIdentifier ? <Identifier>node.expression : createTempVariable(TempFlags.Auto);
21692169

2170-
var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(TempFlags._n) : undefined;
2171-
21722170
// This is the let keyword for the counter and rhsReference. The let keyword for
21732171
// the LHS will be emitted inside the body.
21742172
emitStart(node.expression);
@@ -2189,28 +2187,15 @@ module ts {
21892187
emitEnd(node.expression);
21902188
}
21912189

2192-
if (cachedLength) {
2193-
write(", ");
2194-
emitNodeWithoutSourceMap(cachedLength);
2195-
write(" = ");
2196-
emitNodeWithoutSourceMap(rhsReference);
2197-
write(".length");
2198-
}
2199-
22002190
write("; ");
22012191

22022192
// _i < _a.length;
22032193
emitStart(node.initializer);
22042194
emitNodeWithoutSourceMap(counter);
22052195
write(" < ");
22062196

2207-
if (cachedLength) {
2208-
emitNodeWithoutSourceMap(cachedLength);
2209-
}
2210-
else {
2211-
emitNodeWithoutSourceMap(rhsReference);
2212-
write(".length");
2213-
}
2197+
emitNodeWithoutSourceMap(rhsReference);
2198+
write(".length");
22142199

22152200
emitEnd(node.initializer);
22162201
write("; ");

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,6 @@ module ts {
15881588
version?: boolean;
15891589
watch?: boolean;
15901590
/* @internal */ stripInternal?: boolean;
1591-
/* @internal */ cacheDownlevelForOfLength?: boolean;
15921591
[option: string]: string | number | boolean;
15931592
}
15941593

0 commit comments

Comments
 (0)