From 4cb899f824ee5e4421f36506e4c77f682b238b09 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 16 Mar 2023 15:19:20 -0400 Subject: 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. --- source/compiler-core/slang-json-native.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/compiler-core/slang-json-native.cpp') 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::get(), GetRttiTypeFuncsForZeroPod::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(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) { -- cgit v1.2.3