Collapse Desc flag boilerplate into shared helpers#710
Merged
tannergooding merged 2 commits intoJul 12, 2026
Conversation
`FunctionOrDelegateDesc`, `StructDesc`, and `EnumDesc` each duplicated the same `(Flags & X) != 0` get and `value ? Flags | X : Flags & ~X` set logic across every single-bit flag property. Route them through per-struct `GetFlag`/`SetFlag` helpers so the accessors are one line each. Behavior-preserving; the tri-state `IsStatic` on `FunctionOrDelegateDesc` is left as-is since it spans two flags, and `ValueDesc` already used concise read-only getters. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…-flag-boilerplate
tannergooding
enabled auto-merge
July 12, 2026 22:52
tannergooding
disabled auto-merge
July 12, 2026 22:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each single-bit flag property on the
*Descabstractions duplicated the same(Flags & X) != 0get andvalue ? Flags | X : Flags & ~Xset logic. This routes them through per-structGetFlag/SetFlaghelpers so each accessor is a single line, which makes the boilerplate far easier to scan and keeps the three types consistent with one another.FunctionOrDelegateDesc-- 16 flag properties collapsedStructDesc-- 4 flag properties collapsedEnumDesc-- 1 flag property collapsedPurely behavior-preserving. The tri-state
IsStaticonFunctionOrDelegateDescis intentionally left as-is since it spans two flags (IsStatic/IsNotStatic), andValueDescalready used concise read-only getters so it needed no change.Block-bodied accessors are kept to satisfy the repo's
csharp_style_expression_bodied_accessors = falserule; the helpers themselves are single-line expression-bodied methods.Verified with a 0-warning build and all 3706 golden tests passing.
Note
This PR description was drafted by Copilot.