From c2d8bef766e60530baee032a3c43446897fd2a7b Mon Sep 17 00:00:00 2001 From: Shimenkov Mikhail Date: Tue, 26 Aug 2025 17:39:34 +0300 Subject: [PATCH] [BUILD SYSTEM] Refactor build system * Removed destroyContext in processErrorState * Removed clearContext in memo-plugin Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/pulls/8011 Tests: python ./test/xts/acts/build.py product_name=rk3568 system_size=standard xts_suitetype=hap_static Change-Id: I1537948e32d7e1f32a08df46e1123b2d70bc8543 Signed-off-by: Shimenkov Mikhail --- arkui-plugins/interop-plugins/index.ts | 6 ++--- arkui-plugins/memo-plugins/index.ts | 4 +--- arkui-plugins/ui-plugins/index.ts | 4 +--- .../src/arkts-api/utilities/public.ts | 23 ++++++++----------- koala-wrapper/src/es2panda.ts | 5 ---- 5 files changed, 13 insertions(+), 29 deletions(-) diff --git a/arkui-plugins/interop-plugins/index.ts b/arkui-plugins/interop-plugins/index.ts index dc69677c9..94f3d2d01 100644 --- a/arkui-plugins/interop-plugins/index.ts +++ b/arkui-plugins/interop-plugins/index.ts @@ -28,9 +28,7 @@ export function interopTransform():Plugins { name: 'interop-plugin', parsed: parsedTransform, checked: checkedTransform, - clean(): void { - arkts.arktsGlobal.clearContext(); - }, + clean(): void {}, }; } @@ -89,7 +87,7 @@ function checkedTransform(this: PluginContext): arkts.EtsScript | undefined { program = programVisitor.programVisitor(program); script = program.astNode; arkts.recheckSubtree(script); - this.setArkTSAst(script); + this.setArkTSAst(script); debugLog('interopTransform:checked exit'); return script; } diff --git a/arkui-plugins/memo-plugins/index.ts b/arkui-plugins/memo-plugins/index.ts index 8ae69bf05..14eeb2deb 100644 --- a/arkui-plugins/memo-plugins/index.ts +++ b/arkui-plugins/memo-plugins/index.ts @@ -29,9 +29,7 @@ export function unmemoizeTransform(): Plugins { return { name: 'memo-plugin', checked: checkedTransform, - clean() { - arkts.arktsGlobal.clearContext(); - }, + clean() {}, }; } diff --git a/arkui-plugins/ui-plugins/index.ts b/arkui-plugins/ui-plugins/index.ts index c89dd6eff..eeb140480 100644 --- a/arkui-plugins/ui-plugins/index.ts +++ b/arkui-plugins/ui-plugins/index.ts @@ -26,9 +26,7 @@ export function uiTransform(): Plugins { name: 'ui-plugin', parsed: parsedTransform, checked: checkedTransform, - clean() { - arkts.arktsGlobal.clearContext(); - }, + clean() {}, }; } diff --git a/koala-wrapper/src/arkts-api/utilities/public.ts b/koala-wrapper/src/arkts-api/utilities/public.ts index 834f12cce..43a7d8acc 100644 --- a/koala-wrapper/src/arkts-api/utilities/public.ts +++ b/koala-wrapper/src/arkts-api/utilities/public.ts @@ -60,21 +60,16 @@ export function proceedToState(state: Es2pandaContextState, context: KNativePoin } function processErrorState(state: Es2pandaContextState, context: KNativePointer, forceDtsEmit = false): void { - try { - if (global.es2panda._ContextState(context) === Es2pandaContextState.ES2PANDA_STATE_ERROR && !forceDtsEmit) { - const errorMessage = withStringResult(global.es2panda._ContextErrorMessage(context)); - if (errorMessage === undefined) { - throwError(`Could not get ContextErrorMessage`); - } - const allErrorMessages = withStringResult(global.es2panda._GetAllErrorMessages(context)); - if (allErrorMessages === undefined) { - throwError(`Could not get AllErrorMessages`); - } - throwError([`Failed to proceed to ${Es2pandaContextState[state]}`, errorMessage, allErrorMessages].join(`\n`)); + if (global.es2panda._ContextState(context) === Es2pandaContextState.ES2PANDA_STATE_ERROR && !forceDtsEmit) { + const errorMessage = withStringResult(global.es2panda._ContextErrorMessage(context)); + if (errorMessage === undefined) { + throwError(`Could not get ContextErrorMessage`); } - } catch (e) { - global.es2panda._DestroyContext(context); - throw e; + const allErrorMessages = withStringResult(global.es2panda._GetAllErrorMessages(context)); + if (allErrorMessages === undefined) { + throwError(`Could not get AllErrorMessages`); + } + throwError([`Failed to proceed to ${Es2pandaContextState[state]}`, errorMessage, allErrorMessages].join(`\n`)); } } diff --git a/koala-wrapper/src/es2panda.ts b/koala-wrapper/src/es2panda.ts index 9e0e14f4e..7a05dea34 100644 --- a/koala-wrapper/src/es2panda.ts +++ b/koala-wrapper/src/es2panda.ts @@ -13,12 +13,7 @@ * limitations under the License. */ -import * as fs from "node:fs" -import * as path from "node:path" import { global } from "./arkts-api/static/global" -import { isNumber, throwError, withWarning, filterSource } from "./utils" -import { Es2pandaContextState } from "./generated/Es2pandaEnums" -import { AstNode, Config, Context, EtsScript, proceedToState } from "./arkts-api" import * as arkts from "./arkts-api" export {arkts, global as arktsGlobal} -- Gitee