From 6b4220cf600c4a55dbf7e92d94fa4d2228a227b6 Mon Sep 17 00:00:00 2001 From: liyue Date: Fri, 6 Jun 2025 15:31:51 +0800 Subject: [PATCH] CallThis instruction bound to property node Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICD6FK Signed-off-by: liyue Change-Id: I6acff199a777ceb5b684b74dffc886c6d854a666 --- es2panda/ir/expressions/callExpression.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/es2panda/ir/expressions/callExpression.cpp b/es2panda/ir/expressions/callExpression.cpp index 96085be9ab..cc1963c9c7 100644 --- a/es2panda/ir/expressions/callExpression.cpp +++ b/es2panda/ir/expressions/callExpression.cpp @@ -180,7 +180,11 @@ void CallExpression::Compile(compiler::PandaGen *pg) const realCallee->Compile(pg); } - pg->StoreAccumulator(this, callee); + if (realCallee->IsMemberExpression()) { + pg->StoreAccumulator(realCallee->AsMemberExpression()->Property(), callee); + } else { + pg->StoreAccumulator(this, callee); + } pg->GetOptionalChain()->CheckNullish(optional_, callee); if (containsSpread) { @@ -202,6 +206,16 @@ void CallExpression::Compile(compiler::PandaGen *pg) const } if (hasThis) { + /* + * To obtain more accurate line number information in the MemberExpression scenario, + * bind CallThis to the property node instead of the entire callee. + * especially for cases involving async stack tracing. + */ + if (realCallee->IsMemberExpression()) { + pg->CallThis(realCallee->AsMemberExpression()->Property(), callee, + static_cast(arguments_.size() + 1)); + return; + } pg->CallThis(this, callee, static_cast(arguments_.size() + 1)); return; } -- Gitee