-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SwiftSyntax: Teach SwiftSyntax to use SourceKit to serialize syntax trees. #14424
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
When using SwiftSyntax as a standalone tool, we invoke Swiftc internally to get the serialized syntax tree. This is not ideal for several reasons: (1) we have to hard-code the relative path of swiftc to invoke it; (2) we have to rely on standard input/output to pass the tree across the process boundaries; and (3) we have to maintain two different ways to get syntax tree (swiftc and sourcekitd). This patch attempts to teach SwiftSyntax to use SourceKit to get the tree just like other clients. We first add a SourceKit client library written in Swift; and next teach SwiftSyntax to use this SourceKit client-side library. For platforms other than MacOS, we still use Swiftc to get syntax trees. This patch also re-enables several flaky tests.
@swift-ci please smoke test |
return Dictionary(dict: val) | ||
} | ||
|
||
public func asAnyObject() -> AnyObject? { |
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.
What's the reason you're using AnyObject
and Foundation types here instead of stdlib types?
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.
oh, I'm not sure because this is borrowed code from internal clients. I'll try to convert to stdlib types.
Super glad to see SwiftSyntax communicating with SourceKit! |
@harlanhaskins it seems we don't need the bridging with NS-types so I removed them altogether. |
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please smoke test |
@nkcsgexi Could this change have something to do with this source compatibility failure? |
… serialize syntax trees. (swiftlang#14424)" (swiftlang#14465)" This reverts commit f8c77e1.
When using SwiftSyntax as a standalone tool, we invoke Swiftc
internally to get the serialized syntax tree. This is not ideal for
several reasons: (1) we have to hard-code the relative path of swiftc
to invoke it; (2) we have to rely on standard input/output to pass the
tree across the process boundaries; and (3) we have to maintain two
different ways to get syntax tree (swiftc and sourcekitd).
This patch attempts to teach SwiftSyntax to use SourceKit to get the
tree just like other clients. We first add a SourceKit client library
written in Swift; and next teach SwiftSyntax to use this SourceKit
client-side library. For platforms other than MacOS, we still use Swiftc
to get syntax trees.
This patch also re-enables several flaky tests.