diff options
| author | Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> | 2024-08-27 21:13:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-27 18:13:00 -0700 |
| commit | 6bb32aa976494466bd6303f8ae6e348b297edb44 (patch) | |
| tree | 54765fd5168e1d6590f403c6df04b30404ee6346 /source/slang/core.meta.slang | |
| parent | a9882c648c58e6f2821df11c7ee6ac77d9f09473 (diff) | |
Adds a warning for using `[PreferRecompute]` on methods that may contain side effects (#4707)
* Adds a warning for using prefer-recompute on methods that contain side effects
* Rename `SideEffects` -> `SideEffectBehavior`
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/core.meta.slang')
| -rw-r--r-- | source/slang/core.meta.slang | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 0b57993ef..c1eb2597a 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -2884,8 +2884,16 @@ attribute_syntax [payload] : PayloadAttribute; __attributeTarget(DeclBase) attribute_syntax [deprecated(message: String)] : DeprecatedAttribute; +enum SideEffectBehavior +{ + /// Causes a warning if the method is detected to have side-effects + Warn = 0, + + /// Suppresses the warning + Allow = 1 +}; __attributeTarget(FunctionDeclBase) -attribute_syntax [PreferRecompute] : PreferRecomputeAttribute; +attribute_syntax[PreferRecompute(behavior: SideEffectBehavior = SideEffectBehavior.Warn)] : PreferRecomputeAttribute; __attributeTarget(FunctionDeclBase) attribute_syntax [PreferCheckpoint] : PreferCheckpointAttribute; |
