diff options
| author | Yong He <yonghe@outlook.com> | 2022-08-24 10:56:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-24 10:56:53 -0700 |
| commit | d245c72f2a92a74ccda83f41758c1948ae5132d3 (patch) | |
| tree | f036e1f2afb7febe2de9b09990bcde6c04f3bad1 /source/slang/slang-ast-type.cpp | |
| parent | 0b808453407f8feef8574cae99afd90771712185 (diff) | |
Compiler time evaluation of all int and bool operators. (#2376)
* Compiler time evaluation of all int and bool operators.
* Fix linux compile error.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-type.cpp')
| -rw-r--r-- | source/slang/slang-ast-type.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp index 664c940a8..a84f04a32 100644 --- a/source/slang/slang-ast-type.cpp +++ b/source/slang/slang-ast-type.cpp @@ -387,15 +387,19 @@ Val* ArrayExpressionType::_substituteImplOverride(ASTBuilder* astBuilder, Substi { int diff = 0; auto elementType = as<Type>(baseType->substituteImpl(astBuilder, subst, &diff)); - auto arrlen = as<IntVal>(arrayLength->substituteImpl(astBuilder, subst, &diff)); - SLANG_ASSERT(arrlen); + IntVal* newArrayLength = nullptr; + if (arrayLength) + { + newArrayLength = as<IntVal>(arrayLength->substituteImpl(astBuilder, subst, &diff)); + SLANG_ASSERT(newArrayLength); + } if (diff) { *ioDiff = 1; auto rsType = getArrayType( astBuilder, elementType, - arrlen); + newArrayLength); return rsType; } return this; |
