Skip to content

Audit the public API of the SwiftSyntax module #1482

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

Merged
merged 12 commits into from
Apr 11, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Apr 1, 2023

This is a collection of quite a few independent commits that all have one goal: Not making any functions that we don’t want to support long-term public in SwiftSyntax. While doing this, I was able to move a few things from SwiftSyntax to SwiftParserDiagnostics. There is no functionality change, and very little refactoring.

@ahoppen
Copy link
Member Author

ahoppen commented Apr 1, 2023

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/swiftsyntax-public-api branch from a4889ed to aecc4f4 Compare April 4, 2023 22:36
@ahoppen
Copy link
Member Author

ahoppen commented Apr 4, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Apr 5, 2023

@ahoppen ahoppen force-pushed the ahoppen/swiftsyntax-public-api branch from 5519653 to 19cc276 Compare April 6, 2023 16:49
@ahoppen
Copy link
Member Author

ahoppen commented Apr 6, 2023

@ahoppen
Copy link
Member Author

ahoppen commented Apr 6, 2023

ahoppen added 12 commits April 11, 2023 11:07
These names never belonged in `SwiftSyntax`. It was just most convenient to put them there. Move them to `SwiftParserDiagnostics` so we can mark them as `internal`.
This allows us to make the properties internal and remove them from the public API surface.
Nobody loves files whose best description is “miscellaneous”.
I has been a bit incosistent that something named `Raw` was part of SwiftSyntax’s public API. Put it behind `RawSyntax` SPI for now. If we want to make it public again, we should rename it to something that doesn’t contain `Raw`
These getters were redundant with other ways to check the properties.
Clients should never need to worry about a node’s index within the parent, especially because `indexInParent` will return the index while also including `nil` nodes and that’s a view of the tree you cannot get anywhere.
I know that it’s really verbose but I would like to be explicit about the view mode be explicit about the view mode because different clients will have different needs and we shouldn’t be assuming that one of the view modes is superior to the other.
`with(\.tokenKind, newValue)` should be used instead.
@ahoppen ahoppen force-pushed the ahoppen/swiftsyntax-public-api branch from 19cc276 to 84358d0 Compare April 11, 2023 18:07
@ahoppen
Copy link
Member Author

ahoppen commented Apr 11, 2023

@ahoppen
Copy link
Member Author

ahoppen commented Apr 11, 2023

@ahoppen ahoppen merged commit d2a1060 into swiftlang:main Apr 11, 2023
@ahoppen ahoppen deleted the ahoppen/swiftsyntax-public-api branch April 11, 2023 23:04
ahoppen added a commit to ahoppen/swift-syntax that referenced this pull request Apr 18, 2023
…blic-api

Audit the public API of the SwiftSyntax module
ahoppen added a commit to ahoppen/swift-syntax that referenced this pull request Apr 18, 2023
…blic-api

Audit the public API of the SwiftSyntax module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant