From d9b3f40d64d1431f75de06e9293604dfb8fb8488 Mon Sep 17 00:00:00 2001 From: liushitong Date: Thu, 24 Jul 2025 09:27:54 +0800 Subject: [PATCH] [LSP]: fix bindings test failure on macOS Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICOA19 Signed-off-by: liushitong Change-Id: I78e5a9fb530f10868763c03c81a8fa612ee3fe77 --- ets2panda/bindings/native/src/lsp.cpp | 10 +++++----- .../bindings/test/expected/getOffsetByColAndLine.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ets2panda/bindings/native/src/lsp.cpp b/ets2panda/bindings/native/src/lsp.cpp index e59829da41..58fef1622a 100644 --- a/ets2panda/bindings/native/src/lsp.cpp +++ b/ets2panda/bindings/native/src/lsp.cpp @@ -65,7 +65,7 @@ TS_INTEROP_3(getClassPropertyInfo, KNativePointer, KNativePointer, KInt, KBoolea KNativePointer impl_getRenameLocationFileName(KNativePointer renameLocationPtr) { auto *renameLocationRef = reinterpret_cast(renameLocationPtr); - return &renameLocationRef->fileName; + return new std::string(renameLocationRef->fileName); } TS_INTEROP_1(getRenameLocationFileName, KNativePointer, KNativePointer) @@ -445,7 +445,7 @@ TS_INTEROP_1(getDiagRelatedInfo, KNativePointer, KNativePointer) KNativePointer impl_getRelatedInfoMsg(KNativePointer relatedInfoPtr) { auto *relatedInfoRef = reinterpret_cast(relatedInfoPtr); - return &relatedInfoRef->message_; + return new std::string(relatedInfoRef->message_); } TS_INTEROP_1(getRelatedInfoMsg, KNativePointer, KNativePointer) @@ -459,7 +459,7 @@ TS_INTEROP_1(getRelatedInfoLoc, KNativePointer, KNativePointer) KNativePointer impl_getLocUri(KNativePointer locPtr) { auto *locRef = reinterpret_cast(locPtr); - return &locRef->uri_; + return new std::string(locRef->uri_); } TS_INTEROP_1(getLocUri, KNativePointer, KNativePointer) @@ -1617,7 +1617,7 @@ TS_INTEROP_3(getSpanOfEnclosingComment, KNativePointer, KNativePointer, KInt, KB KNativePointer impl_getInlayHintText(KNativePointer hintPtr) { auto *hint = reinterpret_cast(hintPtr); - return &hint->text; + return new std::string(hint->text); } TS_INTEROP_1(getInlayHintText, KNativePointer, KNativePointer) @@ -1672,7 +1672,7 @@ TS_INTEROP_2(getInlayHintList, KNativePointer, KNativePointer, KNativePointer) KNativePointer impl_getSignatureHelpParameterName(KNativePointer parameterPtr) { auto *parameterRef = reinterpret_cast(parameterPtr); - return ¶meterRef->GetName(); + return new std::string(parameterRef->GetName()); } TS_INTEROP_1(getSignatureHelpParameterName, KNativePointer, KNativePointer) diff --git a/ets2panda/bindings/test/expected/getOffsetByColAndLine.json b/ets2panda/bindings/test/expected/getOffsetByColAndLine.json index dd10a0ae86..20feeefb69 100644 --- a/ets2panda/bindings/test/expected/getOffsetByColAndLine.json +++ b/ets2panda/bindings/test/expected/getOffsetByColAndLine.json @@ -1,3 +1,3 @@ { - "1": 1373 -} \ No newline at end of file + "1": 1373 +} -- Gitee