|
13 | 13 |
|
14 | 14 | #include "slang-ast-reflect.h"
|
15 | 15 |
|
| 16 | +#include "slang-serialize-reflection.h" |
| 17 | + |
16 | 18 | #include "slang-name.h"
|
17 | 19 |
|
18 | 20 | #include <assert.h>
|
@@ -462,53 +464,13 @@ namespace Slang
|
462 | 464 |
|
463 | 465 | class ASTBuilder;
|
464 | 466 |
|
465 |
| - struct ReflectClassInfo |
| 467 | + struct ASTClassInfo |
466 | 468 | {
|
467 |
| - typedef ReflectClassInfo ThisType; |
468 |
| - |
469 |
| - typedef void* (*CreateFunc)(ASTBuilder* astBuilder); |
470 |
| - typedef void (*DestructorFunc)(void* ptr); |
471 |
| - |
472 |
| - /// A constant time implementation of isSubClassOf |
473 |
| - SLANG_FORCE_INLINE bool isSubClassOf(const ThisType& super) const |
474 |
| - { |
475 |
| - // We include super.m_classId, because it's a subclass of itself. |
476 |
| - return m_classId >= super.m_classId && m_classId <= super.m_lastClassId; |
477 |
| - } |
478 |
| - // True if typeId derives from this type |
479 |
| - SLANG_FORCE_INLINE bool isDerivedFrom(uint32_t typeId) const |
480 |
| - { |
481 |
| - return typeId >= m_classId && typeId <= m_lastClassId; |
482 |
| - } |
483 |
| - SLANG_FORCE_INLINE static bool isSubClassOf(ASTNodeType type, const ThisType& super) |
484 |
| - { |
485 |
| - // Check the type appears valid |
486 |
| - SLANG_ASSERT(int(type) >= 0); |
487 |
| - // We include super.m_classId, because it's a subclass of itself. |
488 |
| - return uint32_t(type) >= super.m_classId && uint32_t(type) <= super.m_lastClassId; |
489 |
| - } |
490 |
| - |
491 |
| - /// Will produce the same result as isSubClassOf, but more slowly by traversing the m_superClass |
492 |
| - /// Works without initRange being called. |
493 |
| - bool isSubClassOfSlow(const ThisType& super) const; |
494 |
| - |
495 |
| - uint32_t m_classId; |
496 |
| - uint32_t m_lastClassId; |
497 |
| - |
498 |
| - const ReflectClassInfo* m_superClass; ///< The super class of this class, or nullptr if has no super class. |
499 |
| - const char* m_name; ///< Textual class name, for debugging |
500 |
| - CreateFunc m_createFunc; ///< Callback to use when creating instances (using an ASTBuilder for backing memory) |
501 |
| - DestructorFunc m_destructorFunc; ///< The destructor for this type. Being just destructor, does not free backing memory for type. |
502 |
| - uint32_t m_sizeInBytes; ///< Total size of the type |
503 |
| - uint8_t m_alignment; ///< The required alignment of the type |
504 |
| - |
505 | 469 | struct Infos
|
506 | 470 | {
|
507 | 471 | const ReflectClassInfo* infos[int(ASTNodeType::CountOf)];
|
508 | 472 | };
|
509 |
| - |
510 | 473 | SLANG_FORCE_INLINE static const ReflectClassInfo* getInfo(ASTNodeType type) { return kInfos.infos[int(type)]; }
|
511 |
| - |
512 | 474 | static const Infos kInfos;
|
513 | 475 | };
|
514 | 476 |
|
|
0 commit comments