From d284b74bbde434b0db205d60c85042d521c01ba6 Mon Sep 17 00:00:00 2001 From: liyancheng2 Date: Thu, 14 Aug 2025 14:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90optimization=E3=80=91reduce=20memory?= =?UTF-8?q?=20usage=20by=20removing=20lambdas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICSXPM Signed-off-by: liyancheng2 Change-Id: Ie6a214c551d5055cd829169e061945164c29cc7f --- lib/tsc.js | 2 +- lib/tsserver.js | 2 +- lib/tsserverlibrary.js | 2 +- lib/typescript.js | 2 +- src/compiler/program.ts | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 274f67b5d0..d2f4724a9b 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -107804,7 +107804,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) { } function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { var _a2, _b; - const fileOrDirectoryExistsUsingSource2 = isFile ? (file) => fileExistsIfProjectReferenceDts(file) : (dir) => directoryExistsIfProjectReferenceDeclDir(dir); + const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir; const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); if (result !== void 0) return result; diff --git a/lib/tsserver.js b/lib/tsserver.js index 19f90ccd71..4a45127468 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -110146,7 +110146,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) { } function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { var _a2, _b; - const fileOrDirectoryExistsUsingSource2 = isFile ? (file) => fileExistsIfProjectReferenceDts(file) : (dir) => directoryExistsIfProjectReferenceDeclDir(dir); + const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir; const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); if (result !== void 0) return result; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 12708fe2e4..75f0fbc675 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -110048,7 +110048,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) { } function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { var _a2, _b; - const fileOrDirectoryExistsUsingSource2 = isFile ? (file) => fileExistsIfProjectReferenceDts(file) : (dir) => directoryExistsIfProjectReferenceDeclDir(dir); + const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir; const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); if (result !== void 0) return result; diff --git a/lib/typescript.js b/lib/typescript.js index 5ed4b520b1..d4a8c5c9b8 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -110410,7 +110410,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) { } function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { var _a2, _b; - const fileOrDirectoryExistsUsingSource2 = isFile ? (file) => fileExistsIfProjectReferenceDts(file) : (dir) => directoryExistsIfProjectReferenceDeclDir(dir); + const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir; const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); if (result !== void 0) return result; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index d1ff3495e0..f03ca96b18 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4463,8 +4463,8 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host: HostForUseSource function fileOrDirectoryExistsUsingSource(fileOrDirectory: string, isFile: boolean): boolean { const fileOrDirectoryExistsUsingSource = isFile ? - (file: string) => fileExistsIfProjectReferenceDts(file) : - (dir: string) => directoryExistsIfProjectReferenceDeclDir(dir); + fileExistsIfProjectReferenceDts : + directoryExistsIfProjectReferenceDeclDir; // Check current directory or file const result = fileOrDirectoryExistsUsingSource(fileOrDirectory); if (result !== undefined) return result; -- Gitee