From bd3e191a224980e45198b7229ebd923c36c4a3ee Mon Sep 17 00:00:00 2001 From: dengxinyu Date: Wed, 6 Mar 2024 22:47:12 +0800 Subject: [PATCH] Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I96GIK Signed-off-by: dengxinyu Change-Id: Ic02fb0201239647fcc143244c8089f918fc7c98d --- arkguard/src/common/ApiExtractor.ts | 3 ++- arkguard/src/common/ApiReader.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arkguard/src/common/ApiExtractor.ts b/arkguard/src/common/ApiExtractor.ts index 4d7043df8a..e2b9ee0599 100644 --- a/arkguard/src/common/ApiExtractor.ts +++ b/arkguard/src/common/ApiExtractor.ts @@ -444,8 +444,9 @@ export namespace ApiExtractor { if (nodeName && mCurrentExportNameSet.has(nodeName)) { addElement(currentPropsSet); + } else if (isEnumDeclaration(astNode) && scanProjectConfig.isHarCompiled) { + addElement(currentPropsSet); } - forEachChild(astNode, visitProjectNode); }; diff --git a/arkguard/src/common/ApiReader.ts b/arkguard/src/common/ApiReader.ts index c9d5c8828c..96a92b1e73 100644 --- a/arkguard/src/common/ApiReader.ts +++ b/arkguard/src/common/ApiReader.ts @@ -22,7 +22,7 @@ import type {IOptions} from '../configs/IOptions'; import { stringPropsSet, structPropsSet } from '../utils/OhsUtil'; import { sys } from 'typescript'; -export const scanProjectConfig: {mKeepStringProperty?: boolean, mExportObfuscation?: boolean} = {}; +export const scanProjectConfig: {mKeepStringProperty?: boolean, mExportObfuscation?: boolean, isHarCompiled?: boolean} = {}; /** * if rename property is not open, api read and extract can be skipped @@ -127,7 +127,7 @@ export function readProjectProperties(projectPaths: string[], customProfiles: IO * @param filesForCompilation set collection of files * @param customProfiles */ -export function readProjectPropertiesByCollectedPaths(filesForCompilation: Set, customProfiles: IOptions): +export function readProjectPropertiesByCollectedPaths(filesForCompilation: Set, customProfiles: IOptions, isHarCompiled: boolean): {projectAndLibsReservedProperties: string[]; libExportNames: string[]} { const ApiType = ApiExtractor.ApiType; let scanningCommonType = undefined; @@ -144,6 +144,7 @@ export function readProjectPropertiesByCollectedPaths(filesForCompilation: Set