From bc6bc56db51d06b92dc63ef9c9e0def6c9760c9e Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 1 Jun 2022 22:29:10 -0700 Subject: Clean up void returns. (#2260) * Clean up `IRReturnVoid`. * Update gitignore. Co-authored-by: Yong He --- source/slang/slang-ast-type.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ast-type.cpp') 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(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(); } -- cgit v1.2.3