From daf53bb2708982a2bcc6d6cc08fe88790ccf0bc2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 21 May 2020 15:36:02 -0400 Subject: 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. --- source/slang/slang-ast-support-types.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/slang/slang-ast-support-types.h') 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; -- cgit v1.2.3