summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-syntax.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-01 17:37:07 -0700
committerGitHub <noreply@github.com>2022-06-01 17:37:07 -0700
commit17e3b88b541ed7f45d575f0f9caaa808cd0a6619 (patch)
treeefacd5d4bf6381a5adf8055daa28f91ddc048a76 /source/slang/slang-syntax.cpp
parentfa10f7dc23f8b93c0f9ef3fb5477871a20aaa974 (diff)
New language feature: basic error handling. (#2253)
* New language feature: basic error handling. * Fix. * Fix `tryCall` encoding according to code review. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-syntax.cpp')
-rw-r--r--source/slang/slang-syntax.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index b9a5b8cd5..24ccfa4a4 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -1057,6 +1057,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
FuncType* funcType = astBuilder->create<FuncType>();
funcType->resultType = getResultType(astBuilder, declRef);
+ funcType->errorType = getErrorCodeType(astBuilder, declRef);
for (auto paramDeclRef : getParameters(declRef))
{
auto paramDecl = paramDeclRef.getDecl();
@@ -1269,9 +1270,27 @@ char const* getGLSLNameForImageFormat(ImageFormat format)
return kImageFormatInfos[Index(format)].name.begin();
}
- const ImageFormatInfo& getImageFormatInfo(ImageFormat format)
- {
- return kImageFormatInfos[Index(format)];
- }
+
+const ImageFormatInfo& getImageFormatInfo(ImageFormat format)
+{
+ return kImageFormatInfos[Index(format)];
+}
+
+char const* getTryClauseTypeName(TryClauseType c)
+{
+ switch (c)
+ {
+ case TryClauseType::None:
+ return "None";
+ case TryClauseType::Standard:
+ return "Standard";
+ case TryClauseType::Optional:
+ return "Optional";
+ case TryClauseType::Assert:
+ return "Assert";
+ default:
+ return "Unknown";
+ }
+}
} // namespace Slang