summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ast-type.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-01 22:29:10 -0700
committerGitHub <noreply@github.com>2022-06-01 22:29:10 -0700
commitbc6bc56db51d06b92dc63ef9c9e0def6c9760c9e (patch)
tree55aae1b64e3c0befe4b424764f6f0064701a9ffe /source/slang/slang-ast-type.cpp
parent4f14efc9752d9ebc8538a2e29ed154a00dc99682 (diff)
Clean up void returns. (#2260)
* Clean up `IRReturnVoid`. * Update gitignore. 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.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp
index bcaf8f5a9..5ee0c5c70 100644
--- a/source/slang/slang-ast-type.cpp
+++ b/source/slang/slang-ast-type.cpp
@@ -148,6 +148,27 @@ HashCode ErrorType::_getHashCodeOverride()
return HashCode(size_t(this));
}
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BottomType !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+void BottomType::_toTextOverride(StringBuilder& out) { out << toSlice("never"); }
+
+bool BottomType::_equalsImplOverride(Type* type)
+{
+ if (auto bottomType = as<BottomType>(type))
+ return true;
+ return false;
+}
+
+Type* BottomType::_createCanonicalTypeOverride() { return this; }
+
+Val* BottomType::_substituteImplOverride(
+ ASTBuilder* /* astBuilder */, SubstitutionSet /*subst*/, int* /*ioDiff*/)
+{
+ return this;
+}
+
+HashCode BottomType::_getHashCodeOverride() { return HashCode(size_t(this)); }
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DeclRefType !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void DeclRefType::_toTextOverride(StringBuilder& out)
@@ -550,7 +571,7 @@ void FuncType::_toTextOverride(StringBuilder& out)
}
out << toSlice(") -> ") << getResultType();
- if (!getErrorType()->equals(getASTBuilder()->getVoidType()))
+ if (!getErrorType()->equals(getASTBuilder()->getBottomType()))
{
out << " throws " << getErrorType();
}