From a924773efd0572b100f12970f55f3a1d217b22b0 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Tue, 23 Aug 2022 11:38:57 +0800 Subject: [PATCH] fixed 5dc686d from https://gitee.com/houhaoyu/developtools_ace-ets2bundle/pulls/998 houhaoyu@huawei.com fix checkneedupdatefiles endless circurlar Signed-off-by: houhaoyu Change-Id: I39ee8ab85c219fa498ce34146bfc53c9417cb9d8 --- compiler/src/compile_info.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index e912ea9..313926c 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -449,12 +449,19 @@ function updateErrorFileCache(diagnostic: ts.Diagnostic): void { function filterInput(rootFileNames: string[]): string[] { return rootFileNames.filter((file: string) => { const needUpdate: NeedUpdateFlag = { flag: false }; - checkNeedUpdateFiles(path.resolve(file), needUpdate); + const alreadyCheckedFiles: Set = new Set(); + checkNeedUpdateFiles(path.resolve(file), needUpdate, alreadyCheckedFiles); return needUpdate.flag; }); } -function checkNeedUpdateFiles(file: string, needUpdate: NeedUpdateFlag): void { +function checkNeedUpdateFiles(file: string, needUpdate: NeedUpdateFlag, alreadyCheckedFiles: Set): void { + if (alreadyCheckedFiles.has(file)) { + return; + } else { + alreadyCheckedFiles.add(file); + } + if (needUpdate.flag) { return; } @@ -467,7 +474,7 @@ function checkNeedUpdateFiles(file: string, needUpdate: NeedUpdateFlag): void { return; } for (let i = 0; i < value.children.length; ++i) { - checkNeedUpdateFiles(value.children[i], needUpdate); + checkNeedUpdateFiles(value.children[i], needUpdate, alreadyCheckedFiles); } } else { cache[file] = { mtimeMs, children: [], error: false };