-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 swift 5.9+ syntax. #51
Conversation
Note, there are some misc. minor deprecation warnings with some of the existing SwiftSyntax usage but wanted to keep this revision low-touch, and specific to breaking changes with the upgrade from 5.8 → 5.10. |
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.
If you've tested schema-gen
and it still produces the same output as it did before your changes, then I'm happy to merge with that one minor formatting change (for the guard statement that I commented on).
* Using the trimmed description here, in an attempt to keep behavior consistent with the deprecated, and removed withoutTrivia() function, so that we don't run into incorrect comparisons (ex. "static" != "static ").
@stackotter When I run: ./generate_schema.sh I receive the following output: Enum 'PlistValue' requires an explicit schema And the entirety of |
lol whoops, yeah it works for me (on the commit before your changes), must've messed up something in the explicit schema parsing stuff (cause it's true that |
@stackotter actually the deprecations were so stupidly minimal I've included them as well to void stupid warnings, they were simple renamings. ~ also ew, I am unsure why my rebase committed your commits under my name 😕
|
Important Do not merge until |
All fixed, due to my dumb |
Also, since parsing the documentation alone was half the logic in the |
The ultimate premature optimisation 😅 (don't think that affects performance at all, swiftc rearranges things and the stack is constant sized within a function, see this godbolt experiment). Lgtm 👍 |
@stackotter |
Hahah yeah it's pretty smart, today I found out some pretty cool tricks it uses to optimise converting enums to raw values (and vice versa) |
@stackotter Too much greatness 😭 How so? |
enum A: UInt8 {
case one = 2
case two = 3
case three = 5
case four = 7
case five = 11
case six = 13
case seven = 17
} Under the hood The function that computes output.A.rawValue.getter : Swift.UInt8:
lea ecx, [8*rdi]
movabs rax, 4799415617651458
shr rax, cl
ret And for an enum such as enum B: UInt8 {
case one = 1
case two = 4
case three = 7
case four = 10
} output.A.rawValue.getter : Swift.UInt8:
lea eax, [rdi + 2*rdi]
inc al
ret |
This revision adds support for Swift Syntax 5.9 and above.
Important
It also points to the latest revision of @stackotter's fork of
swift-argument-parser
, which otherwise conflicts with the name of the GenerateManual plugin if not brought to that version. As well as updating theswift-log
dependency to the latest v1.5.4.