summaryrefslogtreecommitdiffstats
path: root/source/slang/syntax.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-21 10:48:31 -0800
committerGitHub <noreply@github.com>2018-01-21 10:48:31 -0800
commit4044a1d3a0605198465a7eb6e0e3c1f8b1a3c298 (patch)
tree62927d4d2722b36c8e7eb4060e741b9032686835 /source/slang/syntax.cpp
parent2079b941bc5849b6ab33774fb90cefe9c2d624cb (diff)
parentf681a1505c98995683a7fbae7ce208dc5e444b9b (diff)
Merge pull request #372 from csyonghe/master
Allow type expression as type argument, fix global param enum order
Diffstat (limited to 'source/slang/syntax.cpp')
-rw-r--r--source/slang/syntax.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp
index 552f1dc56..ab4a5f94c 100644
--- a/source/slang/syntax.cpp
+++ b/source/slang/syntax.cpp
@@ -355,19 +355,21 @@ void Type::accept(IValVisitor* visitor, void* extra)
auto arrType = type->AsArrayType();
if (!arrType)
return false;
- return (ArrayLength == arrType->ArrayLength && baseType->Equals(arrType->baseType.Ptr()));
+ return (ArrayLength->EqualsVal(arrType->ArrayLength) && baseType->Equals(arrType->baseType.Ptr()));
}
RefPtr<Val> ArrayExpressionType::SubstituteImpl(SubstitutionSet subst, int* ioDiff)
{
int diff = 0;
auto elementType = baseType->SubstituteImpl(subst, &diff).As<Type>();
+ auto arrlen = ArrayLength->SubstituteImpl(subst, &diff).As<IntVal>();
+ SLANG_ASSERT(arrlen);
if (diff)
{
*ioDiff = 1;
auto rsType = getArrayType(
elementType,
- ArrayLength);
+ arrlen);
return rsType;
}
return this;