diff options
| author | Yong He <yonghe@outlook.com> | 2024-05-08 20:52:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-08 20:52:36 -0700 |
| commit | 8e86121b6ce0f2995050ebe112306ded6bc87ca2 (patch) | |
| tree | 5c7f03ec9a144fa4d38eba67d563aefaaa1f4f9a /source/slang/slang-lookup.cpp | |
| parent | 448e21adac9ec260d7854076a686bd506bb371ec (diff) | |
Support `[__ref]` attribute to make `this` pass by reference. (#4139)
Fixes #4110.
Diffstat (limited to 'source/slang/slang-lookup.cpp')
| -rw-r--r-- | source/slang/slang-lookup.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp index 9c8b2fa0b..5e30e3ce9 100644 --- a/source/slang/slang-lookup.cpp +++ b/source/slang/slang-lookup.cpp @@ -862,6 +862,13 @@ static void _lookUpInScopes( // thisParameterMode = LookupResultItem::Breadcrumb::ThisParameterMode::MutableValue; } + else if (funcDeclRef.getDecl()->hasModifier<RefAttribute>()) + { + // In a non-`static` method marked `[ref]` there is + // an implicit `this` parameter that is mutable. + // + thisParameterMode = LookupResultItem::Breadcrumb::ThisParameterMode::MutableValue; + } else { // In all other cases, there is an implicit `this` parameter |
