Revert two bad loop conversions in build

pull/66115/head
Matt Bierner 2019-01-03 19:35:20 -08:00
parent b4964bcf35
commit f28c02195a
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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);