summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-json-rpc-connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-json-rpc-connection.cpp')
-rw-r--r--source/compiler-core/slang-json-rpc-connection.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-rpc-connection.cpp b/source/compiler-core/slang-json-rpc-connection.cpp
index c4413d306..af9dd9e48 100644
--- a/source/compiler-core/slang-json-rpc-connection.cpp
+++ b/source/compiler-core/slang-json-rpc-connection.cpp
@@ -136,6 +136,24 @@ SlangResult JSONRPCConnection::sendError(JSONRPC::ErrorCode errorCode, const Uno
return sendRPC(&errorResponse);
}
+SlangResult JSONRPCConnection::checkArrayObjectWrap( const JSONValue& srcArgs, const RttiInfo* dstArgsRttiInfo, void* dstArgs, const JSONValue& id )
+{
+ if ( dstArgsRttiInfo->m_kind == RttiInfo::Kind::Struct &&
+ srcArgs.getKind() == JSONValue::Kind::Array )
+ {
+ auto array = m_container.getArray( srcArgs );
+ if ( array.getCount() == 1 )
+ {
+ return toNativeOrSendError( array[0], dstArgsRttiInfo, dstArgs, id );
+ }
+ return SLANG_OK;
+ }
+ else
+ {
+ return toNativeOrSendError( srcArgs, dstArgsRttiInfo, dstArgs, id );
+ }
+}
+
SlangResult JSONRPCConnection::toNativeArgsOrSendError(const JSONValue& srcArgs, const RttiInfo* dstArgsRttiInfo, void* dstArgs, const JSONValue& id)
{
if (dstArgsRttiInfo->m_kind == RttiInfo::Kind::Struct &&