diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-09-30 13:28:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-30 13:28:56 -0400 |
| commit | 274c20a5eb133779a9d890ca79120815fb92b04e (patch) | |
| tree | 50f8074917a102b25a7f34adeacffaf185d59242 /source/slang/slang-ast-reflect.cpp | |
| parent | 94d3f2bd9c5557658751f73bc5fc443b41230d2c (diff) | |
Generalizing Serialization (#1563)
* First pass at generalizing serializer.
* Split out ReflectClassInfo
* Use the general ReflectClassInfo
* Fix some typos in debug generalized serialization.
* Add calculation of classIds.
Make distinct addCopy/add on SerialClasses.
* Write up of more generalized serialization
* WIP to transition from ASTSerialReader/Writer etc to generalized SerialReader/Writer and associated types.
* Improvements to SerialExtraObjects.
Keep RefObjects in scope in factory
* Compiles with Serial refactor - doesn't quite work yet.
* First pass serialization appears to work with refector.
* Split out type info for general slang types.
* Split out slang-serialize-misc-type-info.h
* DebugSerialData -> SerialSourecLocData
DebugSerialReader -> SerialSourceLocReader
DebugSerialWriter -> SerialSourceLocWriter
* Remove unused template that only compiles on VS.
* Fix warning around unused function on non-VS.
Diffstat (limited to 'source/slang/slang-ast-reflect.cpp')
| -rw-r--r-- | source/slang/slang-ast-reflect.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/source/slang/slang-ast-reflect.cpp b/source/slang/slang-ast-reflect.cpp index 7ed5057b9..520592e73 100644 --- a/source/slang/slang-ast-reflect.cpp +++ b/source/slang/slang-ast-reflect.cpp @@ -18,27 +18,15 @@ namespace Slang #define SLANG_REFLECT_GET_REFLECT_CLASS_INFO(NAME, SUPER, ORIGIN, LAST, MARKER, TYPE, param) infos.infos[int(ASTNodeType::NAME)] = &NAME::kReflectClassInfo; -static ReflectClassInfo::Infos _calcInfos() +static ASTClassInfo::Infos _calcInfos() { - ReflectClassInfo::Infos infos; + ASTClassInfo::Infos infos; memset(&infos, 0, sizeof(infos)); SLANG_ALL_ASTNode_NodeBase(SLANG_REFLECT_GET_REFLECT_CLASS_INFO, _) return infos; } -/* static */const ReflectClassInfo::Infos ReflectClassInfo::kInfos = _calcInfos(); - -bool ReflectClassInfo::isSubClassOfSlow(const ThisType& super) const -{ - ReflectClassInfo const* info = this; - while (info) - { - if (info == &super) - return true; - info = info->m_superClass; - } - return false; -} +/* static */const ASTClassInfo::Infos ASTClassInfo::kInfos = _calcInfos(); // Now try and implement all of the classes // Macro generated is of the format @@ -48,8 +36,9 @@ struct ASTConstructAccess template <typename T> struct Impl { - static void* create(ASTBuilder* astBuilder) + static void* create(void* context) { + ASTBuilder* astBuilder = (ASTBuilder*)context; return astBuilder->create<T>(); } static void destroy(void* ptr) |
