From 8e86121b6ce0f2995050ebe112306ded6bc87ca2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 8 May 2024 20:52:36 -0700 Subject: Support `[__ref]` attribute to make `this` pass by reference. (#4139) Fixes #4110. --- source/slang/slang-lower-to-ir.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/slang/slang-lower-to-ir.cpp') 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()) + { + return kParameterDirection_Ref; + } // A `set` accessor on a property or subscript declaration // defaults to a mutable `this` parameter, but the programmer -- cgit v1.2.3