summaryrefslogtreecommitdiffstats
path: root/source/slang/syntax.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-04 13:41:09 -0800
committerTim Foley <tfoleyNV@users.noreply.github.com>2018-01-04 13:41:09 -0800
commit3d435f7321c3f9241d33a0f7521573f21b548186 (patch)
tree3a4f2d21250f1dbad1ca9bf4668b566a6c87ea89 /source/slang/syntax.cpp
parente90dfcfd6a0a6d92688012b1216c46c24965cfc0 (diff)
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
Diffstat (limited to 'source/slang/syntax.cpp')
-rw-r--r--source/slang/syntax.cpp18
1 files changed, 17 insertions, 1 deletions
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<Val> ArrayExpressionType::SubstituteImpl(Substitutions* subst, int* ioDiff)
+ {
+ int diff = 0;
+ auto elementType = baseType->SubstituteImpl(subst, &diff).As<Type>();
+ 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<Substitutions> substSubst = substituteSubstitutions(substitutions, subst, &diff);
-
+
if (!diff)
return *this;