summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-08 20:52:36 -0700
committerGitHub <noreply@github.com>2024-05-08 20:52:36 -0700
commit8e86121b6ce0f2995050ebe112306ded6bc87ca2 (patch)
tree5c7f03ec9a144fa4d38eba67d563aefaaa1f4f9a /source/slang/slang-lower-to-ir.cpp
parent448e21adac9ec260d7854076a686bd506bb371ec (diff)
Support `[__ref]` attribute to make `this` pass by reference. (#4139)
Fixes #4110.
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index a8cf11cdc..0d666306b 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -2709,6 +2709,10 @@ ParameterDirection getThisParamDirection(Decl* parentDecl, ParameterDirection de
{
return kParameterDirection_ConstRef;
}
+ else if (parentDecl->hasModifier<RefAttribute>())
+ {
+ return kParameterDirection_Ref;
+ }
// A `set` accessor on a property or subscript declaration
// defaults to a mutable `this` parameter, but the programmer