summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-json-native.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-03-16 15:19:20 -0400
committerGitHub <noreply@github.com>2023-03-16 15:19:20 -0400
commit4cb899f824ee5e4421f36506e4c77f682b238b09 (patch)
treec348029866666fad59531032ba76f325d67c32ab /source/compiler-core/slang-json-native.cpp
parent1036d1a9edec83d8840577f388af8599b5e18f5f (diff)
Preliminary SourceMap support (#2701)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP source map. * Split out handling of RttiTypeFuncs to a map type. * Make RttiTypeFuncsMap hold default impls. * Slightly more sophisticated RttiTypeFuncsMap * Source map decoding. * Fix tabs. * Fix asserts due to negative values. * Use less obscure mechanisms in SourceMap.
Diffstat (limited to 'source/compiler-core/slang-json-native.cpp')
-rw-r--r--source/compiler-core/slang-json-native.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/compiler-core/slang-json-native.cpp b/source/compiler-core/slang-json-native.cpp
index c7a90df4c..8b0ec1194 100644
--- a/source/compiler-core/slang-json-native.cpp
+++ b/source/compiler-core/slang-json-native.cpp
@@ -8,6 +8,13 @@
namespace Slang {
+/* static */RttiTypeFuncsMap JSONNativeUtil::getTypeFuncsMap()
+{
+ RttiTypeFuncsMap typeMap;
+ typeMap.add(GetRttiInfo<JSONValue>::get(), GetRttiTypeFuncsForZeroPod<JSONValue>::getFuncs());
+ return typeMap;
+}
+
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!! JSONToNativeConverter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* static */Index JSONToNativeConverter::_getFieldCount(const StructRttiInfo* structRttiInfo)
@@ -193,10 +200,9 @@ SlangResult JSONToNativeConverter::convert(const JSONValue& in, const RttiInfo*
const ListRttiInfo* listRttiInfo = static_cast<const ListRttiInfo*>(rttiInfo);
auto elementType = listRttiInfo->m_elementType;
- SLANG_RETURN_ON_FAIL(RttiUtil::setListCount(elementType, out, arr.getCount()));
+ SLANG_RETURN_ON_FAIL(RttiUtil::setListCount(m_typeMap, elementType, out, arr.getCount()));
// Okay, we need to copy over one by one
-
Byte* dstEles = list.getBuffer();
for (Index i = 0; i < count; ++i, dstEles += elementType->m_size)
{