-
Notifications
You must be signed in to change notification settings - Fork 404
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
Split FunctionParameterSyntax and related types #1455
Split FunctionParameterSyntax and related types #1455
Conversation
@swift-ci Please test |
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
… nodes for function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…ultiple nodes for function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
c9a3785
to
9f9f53b
Compare
9f9f53b
to
33d4ce3
Compare
swiftlang/swift#64697 @swift-ci Please test Windows |
33d4ce3
to
89d5d32
Compare
89d5d32
to
1621138
Compare
…ultiple nodes for function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
swiftlang/swift#64697 @swift-ci Please test Windows |
Sources/SwiftParser/Parameters.swift
Outdated
// MARK: Parameter parsing | ||
|
||
extension Parser { | ||
mutating func parseFunctionParameter() -> RawFunctionParameterSyntax { |
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.
There's a fair bit of duplication between these. Did you find that made more sense then having options on a parseParameterLikeDecl(...)
sort of function? RawParameterTrait
could include an init
that just has alllll the things, where we ignore params that don't make sense where necessary.
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.
I wanted to get the compile-time safety of not forgetting to pass one of the required arguments and I think we can only reasonably to do was to duplicate 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.
You can still have separate parseFunctionParameter
etc. for callers outside. It'd just be fileprivate
within Parameters
.
nameForDiagnostics: "type", | ||
isOptional: true |
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.
🥳
FunctionParameterSyntax was used in a number of cases (function parameter, closure parameter and enum case parameter) and because it needs to satisfy all of them all its parameters are optional. Split it into three different types that have non-optional children. rdar://106874808
1621138
to
fe710b2
Compare
1 similar comment
swiftlang/swift#64697 @swift-ci Please test Windows |
…ultiple nodes for function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
…r function parameters, closure parameters and enum parameters Companion of swiftlang/swift-syntax#1455
FunctionParameterSyntax was used in a number of cases (function parameter, closure parameter and enum case parameter) and because it needs to satisfy all of them all its parameters are optional. Split it into three different types that have non-optional children.
rdar://106874808