summaryrefslogtreecommitdiff
path: root/source/slang/slang-serialize-ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-serialize-ast.cpp')
-rw-r--r--source/slang/slang-serialize-ast.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/source/slang/slang-serialize-ast.cpp b/source/slang/slang-serialize-ast.cpp
index aad3bcc57..b91fac89a 100644
--- a/source/slang/slang-serialize-ast.cpp
+++ b/source/slang/slang-serialize-ast.cpp
@@ -1135,14 +1135,27 @@ private:
template<typename T>
void decodePtr(T*& node, Decoder& decoder, DeclBase*)
{
- if (decoder.getTag() == SerialBinary::kInt64FourCC)
- {
- DeclID id = decodeDeclID(decoder);
- node = static_cast<T*>(getDeclByID(id));
- }
- else
+ // This case is a bit of a hack. We need
+ // to identify whether we are looking at
+ // an indirection to a `Decl` (which would
+ // be serialized as an integer `DeclID`),
+ // or something else derived from `DeclBase`.
+ //
+ switch (decoder.getTag())
{
+ default:
decodeASTNode(node, decoder);
+ break;
+
+ case SerialBinary::kInt32FourCC:
+ case SerialBinary::kInt64FourCC:
+ case SerialBinary::kUInt32FourCC:
+ case SerialBinary::kUInt64FourCC:
+ {
+ DeclID id = decodeDeclID(decoder);
+ node = static_cast<T*>(getDeclByID(id));
+ }
+ break;
}
}