From e5741104dd13f33ebce16950fcbb2b9733fa1402 Mon Sep 17 00:00:00 2001 From: xudan16 Date: Mon, 7 Jul 2025 19:22:05 +0800 Subject: [PATCH] homecheck get array item with index instead of at Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICKL7K Signed-off-by: xudan16 --- ets2panda/linter/homecheck/src/utils/common/ScopeHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ets2panda/linter/homecheck/src/utils/common/ScopeHelper.ts b/ets2panda/linter/homecheck/src/utils/common/ScopeHelper.ts index 4c481600dd..461709e972 100644 --- a/ets2panda/linter/homecheck/src/utils/common/ScopeHelper.ts +++ b/ets2panda/linter/homecheck/src/utils/common/ScopeHelper.ts @@ -226,7 +226,7 @@ export class ScopeHelper { const succStmts = succBlock.getStmts(); if (succStmts.length > 0 && this.gTernaryConditionLines.has(succStmts[0].getOriginPositionInfo().getLineNo())) { return true; - } else if (predBlocks.length === 1 && this.gTernaryConditionLines.has(predBlocks?.[0].getStmts()?.at(-1)?.getOriginPositionInfo().getLineNo() ?? 0)) { + } else if (predBlocks.length === 1 && this.gTernaryConditionLines.has(predBlocks[0].getTail()?.getOriginPositionInfo().getLineNo() ?? 0)) { return true; } else { return false; -- Gitee