From 3d435f7321c3f9241d33a0f7521573f21b548186 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 4 Jan 2018 13:41:09 -0800 Subject: Bug fixes for Slang integration (#356) * fix #353 * move validateEntryPoint to after all entrypoints has been checked * bug fix: DeclRefType::SubstituteImpl should change ioDiff * bug fix: generic resource usage should have count of 1 instead of 0. * update test case --- source/slang/syntax.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source/slang/syntax.cpp') diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index c49cd3648..cdc112846 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -358,6 +358,21 @@ void Type::accept(IValVisitor* visitor, void* extra) return (ArrayLength == arrType->ArrayLength && baseType->Equals(arrType->baseType.Ptr())); } + RefPtr ArrayExpressionType::SubstituteImpl(Substitutions* subst, int* ioDiff) + { + int diff = 0; + auto elementType = baseType->SubstituteImpl(subst, &diff).As(); + if (diff) + { + *ioDiff = 1; + auto rsType = getArrayType( + elementType, + ArrayLength); + return rsType; + } + return this; + } + Type* ArrayExpressionType::CreateCanonicalType() { auto canonicalElementType = baseType->GetCanonicalType(); @@ -531,6 +546,7 @@ void Type::accept(IValVisitor* visitor, void* extra) { if (genericSubst->paramDecl == globalGenParam) { + (*ioDiff)++; return genericSubst->actualType; } } @@ -1393,7 +1409,7 @@ void Type::accept(IValVisitor* visitor, void* extra) { int diff = 0; RefPtr substSubst = substituteSubstitutions(substitutions, subst, &diff); - + if (!diff) return *this; -- cgit v1.2.3