From c4615fe0ae7e1849b23e9a96d1453794b0b40e90 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 9 Aug 2023 09:11:23 -0700 Subject: Clean up and improve Val deduplication performance. (#3069) * Clean up and improve Val deuplication performance. * Fix. * Fix. * Fix. * Fix. --------- Co-authored-by: Yong He --- source/slang/slang-syntax.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/slang/slang-syntax.cpp') diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index f6b902c68..b7e9af43a 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -423,21 +423,20 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } else if (auto magicMod = declRef.getDecl()->findModifier()) { + if (magicMod->magicNodeType == ASTNodeType(-1)) + { + SLANG_UNEXPECTED("unhandled type"); + } // Always create builtin types in global AST builder. if (astBuilder->getSharedASTBuilder()->getInnerASTBuilder() != astBuilder) return DeclRefType::create(astBuilder->getSharedASTBuilder()->getInnerASTBuilder(), declRef); declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, declRef); - auto classInfo = astBuilder->findSyntaxClass(magicMod->magicName.getUnownedSlice()); - if (!classInfo.classInfo) - { - SLANG_UNEXPECTED("unhandled type"); - } ValNodeDesc nodeDesc = {}; - nodeDesc.type = (ASTNodeType)classInfo.classInfo->m_classId; + nodeDesc.type = magicMod->magicNodeType; nodeDesc.operands.add(ValNodeOperand(declRef)); nodeDesc.init(); - NodeBase* type = astBuilder->_getOrCreateImpl(nodeDesc); + NodeBase* type = astBuilder->_getOrCreateImpl(_Move(nodeDesc)); if (!type) { SLANG_UNEXPECTED("constructor failure"); -- cgit v1.2.3