summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-support-types.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-05-21 15:36:02 -0400
committerGitHub <noreply@github.com>2020-05-21 15:36:02 -0400
commitdaf53bb2708982a2bcc6d6cc08fe88790ccf0bc2 (patch)
treed72a1f5a820db75072cc1d6055a0f35cf6feaccd /source/slang/slang-ast-support-types.h
parentd90ae365210cdecdad7f66a7b2e3993df2cbb7d4 (diff)
Non virtual accept implementation on AST types (#1351)
* First pass impl of making accept on AST node types non virtual. * A single switch for ITypeVistor on Val type. * Use ORIGIN to choose ITypeVisitor dispatch. * Don't use ORIGIN - we don't need special handling for ITypeVisitor on Val derived types.
Diffstat (limited to 'source/slang/slang-ast-support-types.h')
-rw-r--r--source/slang/slang-ast-support-types.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h
index c1072c923..9b8cfbea2 100644
--- a/source/slang/slang-ast-support-types.h
+++ b/source/slang/slang-ast-support-types.h
@@ -491,6 +491,12 @@ namespace Slang
// We include super.m_classId, because it's a subclass of itself.
return m_classId >= super.m_classId && m_classId <= super.m_lastClassId;
}
+ // True if typeId derives from this type
+ SLANG_FORCE_INLINE bool isDerivedFrom(uint32_t typeId) const
+ {
+ return typeId >= m_classId && typeId <= m_lastClassId;
+ }
+
/// Will produce the same result as isSubClassOf, but more slowly by traversing the m_superClass
/// Works without initRange being called.
bool isSubClassOfSlow(const ThisType& super) const;