-
Notifications
You must be signed in to change notification settings - Fork 440
Refactor Syntax
initializer
#1092
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
Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift
Outdated
Show resolved
Hide resolved
0841315
to
37c8e1d
Compare
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.
Thanks a lot, this is a great simplification 🙏
Do you know if the generic initializers affect code size or performance in either direction?
Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift
Outdated
Show resolved
Hide resolved
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 can check performance/size next week
Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift
Outdated
Show resolved
Hide resolved
2f904b1
to
8cbc881
Compare
8cbc881
to
93a6d61
Compare
We don't really have any infrastructure for testing syntax building performance at the moment. There's no changes to Raw* so unsurprisingly there's no real parsing difference. Sizes have dropped slightly:
|
@swift-ci please test |
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.
Thanks for checking performance and size.
93a6d61
to
eda8373
Compare
@swift-ci please test |
eda8373
to
71d4767
Compare
@swift-ci please test |
1bd363c
to
9a4e8a9
Compare
@swift-ci please test |
9a4e8a9
to
8e9bf5c
Compare
@swift-ci please test |
88ca6bb
to
b6c9ea4
Compare
@swift-ci please test |
b6c9ea4
to
ef5a12c
Compare
@swift-ci please test |
ef5a12c
to
f8830ef
Compare
@swift-ci please test |
f8830ef
to
4f4fcdc
Compare
@swift-ci please test |
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’ve reviewed the entire PR again and have one more comment. Otherwise, let’s 🚢it
Use generics rather than existentials, add `nil` defaults for *all* optional nodes, and add a default for tokens where there's only a single choice. Allows removing the default initializer in SwiftSyntaxBuilder, since the regular initializer covers it entirely. There's a small hack that adds a second initializer when a parameter with a generic type has a empty default, since a `Optional<BaseType>.none` default doesn't work in Swift 5.6. This can be removed and the property initializer updated once 5.7 is our minimum version.
4f4fcdc
to
e71b64a
Compare
@swift-ci please test |
Use generics rather than existentials, add
nil
defaults for alloptional nodes, and add a default for tokens where there's only a single
choice. Allows removing the default initializer in SwiftSyntaxBuilder,
since the regular initializer covers it entirely.
There's a small hack that adds a second initializer when a parameter
with a generic type has a empty default, since a
Optional<BaseType>.none
default doesn't work in Swift 5.6. This can beremoved and the property initializer updated once 5.7 is our minimum
version.