-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix layering of modifier api. #79022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| using DeclarationModifiers = Microsoft.CodeAnalysis.Internal.Editing.DeclarationModifiers; | ||
| #else | ||
| using DeclarationModifiers = Microsoft.CodeAnalysis.Editing.DeclarationModifiers; | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was teh core thing i wanted to get rid of. we have DeclarationModifiers as a public API in teh workspace. We then also cloned it into an internal namespace, both to get access to internal parts of it and to pull it down to our 'analyzer/compiler' layer. That's awwful.
I've separated this out so there's a trivial enum now at hte analyzer/compiler layer. ANd only workspace/fixer/refactoring layer types access the true DeclarationModifiers type.
| File = 1 << 17, | ||
| Fixed = 1 << 18, | ||
| #pragma warning restore format | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what was extracted out to the lower layer.
| #if WORKSPACE | ||
| return new DeclarationModifiers(modifiers); | ||
| #else | ||
| return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugly, but simple. if we are ever worried about this, we can always write the full logic that checks each flag and creates teh final DeclarationModifiers from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this works because DeclarationModifiers is a struct with a single field that is of type Modifiers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
No description provided.