-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support init accessor in CSharpSyntaxFacts #48137
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
24c66a9
Support init accessor in CSharpSyntaxFacts
Youssef1313 43f31da
Update CSharpSyntaxFacts.cs
Youssef1313 6138658
Revert
Youssef1313 67f795d
Update src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Se…
Youssef1313 4d8cee0
Apply suggestions from code review
Youssef1313 75d0a26
Update CSharpSyntaxFacts.cs
Youssef1313 244f780
Update SyntaxGeneratorTests.cs
Youssef1313 f4b99e5
Revert
Youssef1313 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1315,6 +1315,7 @@ private static bool IsMemberDeclaration(SyntaxNode node) | |
case SyntaxKind.PropertyDeclaration: | ||
case SyntaxKind.GetAccessorDeclaration: | ||
case SyntaxKind.SetAccessorDeclaration: | ||
case SyntaxKind.InitAccessorDeclaration: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's a good idea to update this one without knowing the change it introduce. This whole method isn't covered in the tests. See how #48158 is green.
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case SyntaxKind.EventDeclaration: | ||
case SyntaxKind.EventFieldDeclaration: | ||
case SyntaxKind.AddAccessorDeclaration: | ||
|
@@ -1756,6 +1757,7 @@ public override bool CanHaveAccessibility(SyntaxNode declaration) | |
case SyntaxKind.EventFieldDeclaration: | ||
case SyntaxKind.GetAccessorDeclaration: | ||
case SyntaxKind.SetAccessorDeclaration: | ||
case SyntaxKind.InitAccessorDeclaration: | ||
case SyntaxKind.AddAccessorDeclaration: | ||
case SyntaxKind.RemoveAccessorDeclaration: | ||
return true; | ||
|
@@ -2006,7 +2008,7 @@ public override DeclarationKind GetDeclarationKind(SyntaxNode declaration) | |
return DeclarationKind.Attribute; | ||
} | ||
break; | ||
|
||
// Add InitAccessor once https://github.com/dotnet/roslyn/issues/48136 is resolved | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case SyntaxKind.GetAccessorDeclaration: | ||
return DeclarationKind.GetAccessor; | ||
case SyntaxKind.SetAccessorDeclaration: | ||
|
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.
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.
@davidwengier I removed both GetAccessorDeclaration and InitAccessorDeclaration in a draft. There are no test failures. So the current tests, unfortunately, doesn't cover those.
The usages that depend on this method are in:
syntaxFactsService.IsDeclaration(node)
).DescendantNodes(n => !syntaxFacts.IsDeclaration(n))
)Unlike the other change, I'm not able to guess the effect of this change.
I'll try to change the method to only
return false
in the draft in a hope to see test failures (i.e. other switch arms are tested).