summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-support-types.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-30 23:39:07 -0800
committerGitHub <noreply@github.com>2024-12-30 23:39:07 -0800
commitcc1b96d91d8875bf727079d58fbf78af1135f505 (patch)
tree593a6aae09e2710390ac34fdeb84614872ac9d5f /source/slang/slang-ast-support-types.cpp
parent88e221bad60ce20087fe2f8a85d506be36a6e6ca (diff)
Check mismatching method parameter direction against interface declaration. (#5964)
Diffstat (limited to 'source/slang/slang-ast-support-types.cpp')
-rw-r--r--source/slang/slang-ast-support-types.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-ast-support-types.cpp b/source/slang/slang-ast-support-types.cpp
index a06fa2b88..d59b6b286 100644
--- a/source/slang/slang-ast-support-types.cpp
+++ b/source/slang/slang-ast-support-types.cpp
@@ -70,4 +70,29 @@ UnownedStringSlice getHigherOrderOperatorName(HigherOrderInvokeExpr* expr)
return UnownedStringSlice();
}
+void printDiagnosticArg(StringBuilder& sb, ParameterDirection direction)
+{
+ switch (direction)
+ {
+ case kParameterDirection_In:
+ sb << "in";
+ break;
+ case kParameterDirection_Out:
+ sb << "out";
+ break;
+ case kParameterDirection_Ref:
+ sb << "ref";
+ break;
+ case kParameterDirection_InOut:
+ sb << "inout";
+ break;
+ case kParameterDirection_ConstRef:
+ sb << "constref";
+ break;
+ default:
+ sb << "(" << int(direction) << ")";
+ break;
+ }
+}
+
} // namespace Slang