@@ -11815,7 +11815,7 @@ var ts;
1181511815 }
1181611816 ts.bindSourceFile = bindSourceFile;
1181711817 function bindSourceFileWorker(file) {
11818- var parent ;
11818+ var _parent ;
1181911819 var container;
1182011820 var blockScopeContainer;
1182111821 var lastContainer;
@@ -11956,10 +11956,10 @@ var ts;
1195611956 if (symbolKind & 255504) {
1195711957 node.locals = {};
1195811958 }
11959- var saveParent = parent ;
11959+ var saveParent = _parent ;
1196011960 var saveContainer = container;
1196111961 var savedBlockScopeContainer = blockScopeContainer;
11962- parent = node;
11962+ _parent = node;
1196311963 if (symbolKind & 262128) {
1196411964 container = node;
1196511965 if (lastContainer) {
@@ -11972,7 +11972,7 @@ var ts;
1197211972 }
1197311973 ts.forEachChild(node, bind);
1197411974 container = saveContainer;
11975- parent = saveParent;
11975+ _parent = saveParent;
1197611976 blockScopeContainer = savedBlockScopeContainer;
1197711977 }
1197811978 function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) {
@@ -12075,7 +12075,7 @@ var ts;
1207512075 return "__" + ts.indexOf(node.parent.parameters, node);
1207612076 }
1207712077 function bind(node) {
12078- node.parent = parent ;
12078+ node.parent = _parent ;
1207912079 switch (node.kind) {
1208012080 case 127:
1208112081 bindDeclaration(node, 262144, 530912, false);
@@ -12209,10 +12209,10 @@ var ts;
1220912209 bindChildren(node, 0, true);
1221012210 break;
1221112211 default:
12212- var saveParent = parent ;
12213- parent = node;
12212+ var saveParent = _parent ;
12213+ _parent = node;
1221412214 ts.forEachChild(node, bind);
12215- parent = saveParent;
12215+ _parent = saveParent;
1221612216 }
1221712217 }
1221812218 function bindParameter(node) {
@@ -24542,6 +24542,7 @@ var ts;
2454224542 var rhsIsIdentifier = node.expression.kind === 64;
2454324543 var counter = createTempVariable(node, true);
2454424544 var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false);
24545+ var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined;
2454524546 emitStart(node.expression);
2454624547 write("var ");
2454724548 emitNodeWithoutSourceMap(counter);
@@ -24555,12 +24556,24 @@ var ts;
2455524556 emitNodeWithoutSourceMap(node.expression);
2455624557 emitEnd(node.expression);
2455724558 }
24559+ if (cachedLength) {
24560+ write(", ");
24561+ emitNodeWithoutSourceMap(cachedLength);
24562+ write(" = ");
24563+ emitNodeWithoutSourceMap(rhsReference);
24564+ write(".length");
24565+ }
2455824566 write("; ");
2455924567 emitStart(node.initializer);
2456024568 emitNodeWithoutSourceMap(counter);
2456124569 write(" < ");
24562- emitNodeWithoutSourceMap(rhsReference);
24563- write(".length");
24570+ if (cachedLength) {
24571+ emitNodeWithoutSourceMap(cachedLength);
24572+ }
24573+ else {
24574+ emitNodeWithoutSourceMap(rhsReference);
24575+ write(".length");
24576+ }
2456424577 emitEnd(node.initializer);
2456524578 write("; ");
2456624579 emitStart(node.initializer);
@@ -26921,6 +26934,12 @@ var ts;
2692126934 description: ts.Diagnostics.Preserve_new_lines_when_emitting_code,
2692226935 experimental: true
2692326936 },
26937+ {
26938+ name: "cacheDownlevelForOfLength",
26939+ type: "boolean",
26940+ description: "Cache length access when downlevel emitting for-of statements",
26941+ experimental: true
26942+ },
2692426943 {
2692526944 name: "target",
2692626945 shortName: "t",
0 commit comments