From f28c02195a8a18182090c77bb73b52b2bd8eef78 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 3 Jan 2019 19:35:20 -0800 Subject: [PATCH] Revert two bad loop conversions in build --- build/lib/standalone.ts | 4 ++-- build/lib/treeshaking.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/lib/standalone.ts b/build/lib/standalone.ts index 9813b4fd75e..b7b0fee295f 100644 --- a/build/lib/standalone.ts +++ b/build/lib/standalone.ts @@ -241,8 +241,8 @@ export function createESMSourcesAndResources2(options: IOptions2): void { function toggleComments(fileContents: string): string { let lines = fileContents.split(/\r\n|\r|\n/); let mode = 0; - for (const line of lines) { - + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; if (mode === 0) { if (/\/\/ ESM-comment-begin/.test(line)) { mode = 1; diff --git a/build/lib/treeshaking.ts b/build/lib/treeshaking.ts index 223e8047c1f..060808312e6 100644 --- a/build/lib/treeshaking.ts +++ b/build/lib/treeshaking.ts @@ -464,7 +464,8 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt } if (black_queue.length === 0) { - for (const node of gray_queue) { + for (let i = 0; i< gray_queue.length; i++) { + const node = gray_queue[i]; const nodeParent = node.parent; if ((ts.isClassDeclaration(nodeParent) || ts.isInterfaceDeclaration(nodeParent)) && nodeOrChildIsBlack(nodeParent)) { gray_queue.splice(i, 1);