From 2be8ac88545c14ea3f13e5ec2bf290a9ee07d0bd Mon Sep 17 00:00:00 2001 From: xudan16 Date: Wed, 11 Jun 2025 16:19:24 +0800 Subject: [PATCH] fix bug of custom-builder rule Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICED88 Signed-off-by: xudan16 --- .../src/checker/migration/CustomBuilderCheck.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts index b8dcb06db7..8aa70c4807 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts @@ -149,15 +149,18 @@ export class CustomBuilderCheck implements BaseChecker { } private isPassToCustomBuilder(stmt: Stmt, locals: Set): Local | undefined { + let res: Local | undefined = undefined; if (stmt instanceof ArkAssignStmt) { - if (!this.isCustomBuilderTy(stmt.getLeftOp().getType())) { - return undefined; - } - const rightOp = stmt.getRightOp(); - if (rightOp instanceof Local && locals.has(rightOp)) { - return rightOp; + if (this.isCustomBuilderTy(stmt.getLeftOp().getType())) { + const rightOp = stmt.getRightOp(); + if (rightOp instanceof Local && locals.has(rightOp)) { + res = rightOp; + } } } + if (res !== undefined) { + return res; + } const invokeExpr = stmt.getInvokeExpr(); if (invokeExpr) { const paramTys = invokeExpr.getMethodSignature().getMethodSubSignature().getParameterTypes(); -- Gitee