diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-05-01 10:46:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 10:46:21 -0700 |
| commit | 853987defb7090d77938593c271413d92447f7b1 (patch) | |
| tree | 2fbf03db310d2c50351206674d7abb33333adcad /source | |
| parent | ca62ec2591de40e7c8226330670cc8c8d4840065 (diff) | |
Add ParamDecl as the attribute target (#4067)
Currently we only allow variable, struct, and function as the target
for the user-defined attribute, this change adds the function parameter
to the target as well.
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/core.meta.slang | 1 | ||||
| -rw-r--r-- | source/slang/slang-check-modifier.cpp | 5 | ||||
| -rw-r--r-- | source/slang/slang-syntax.h | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 6e4c06d7c..e6a98bc40 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -2569,6 +2569,7 @@ enum _AttributeTargets Struct = $( (int) UserDefinedAttributeTargets::Struct), Var = $( (int) UserDefinedAttributeTargets::Var), Function = $( (int) UserDefinedAttributeTargets::Function), + Param = $( (int) UserDefinedAttributeTargets::Param), }; __attributeTarget(StructDecl) attribute_syntax [__AttributeUsage(target : _AttributeTargets)] : AttributeUsageAttribute; diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp index 13ad8be3a..56d905063 100644 --- a/source/slang/slang-check-modifier.cpp +++ b/source/slang/slang-check-modifier.cpp @@ -318,6 +318,11 @@ namespace Slang cls = m_astBuilder->findSyntaxClass(UnownedStringSlice::fromLiteral("FuncDecl")); return true; } + if (typeFlags == (int)UserDefinedAttributeTargets::Param) + { + cls = m_astBuilder->findSyntaxClass(UnownedStringSlice::fromLiteral("ParamDecl")); + return true; + } return false; } diff --git a/source/slang/slang-syntax.h b/source/slang/slang-syntax.h index 807db9a85..cd8f426ea 100644 --- a/source/slang/slang-syntax.h +++ b/source/slang/slang-syntax.h @@ -322,7 +322,8 @@ namespace Slang Struct = 1, Var = 2, Function = 4, - All = 7 + Param = 8, + All = 0x0F }; const int kUnsizedArrayMagicLength = 0x7FFFFFFF; |
