-
Notifications
You must be signed in to change notification settings - Fork 441
Move SwiftSyntaxParser related code to its own module #614
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
705acf9
to
8eeb394
Compare
@@ -286,6 +287,3 @@ extension Diagnostic { | |||
} | |||
} | |||
|
|||
fileprivate func verifyCNodeLayoutHash() -> Bool { | |||
return cNodeLayoutHash() == SwiftSyntax.cNodeLayoutHash() |
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.
Now that SwiftSyntax
doesn't know anything about CNodes
, so this is not needed anymore.
@swift-ci Please test |
105fcc8
to
9ecba2b
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.
Nice. This is great work, making the SwiftSyntax
module smaller.
guard var ptr = buffer.baseAddress else { return } | ||
for cnode in cnodes { | ||
let element: RawSyntax? = cnode.map { | ||
// 'CClinentNode' is a node created with `toOpaque()` |
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.
Typo
// 'CClinentNode' is a node created with `toOpaque()` | |
// 'CClientNode' is a node created with `toOpaque()` |
let syntaxKind = SyntaxKind(serializationCode: cnode.kind) | ||
assert(syntaxKind != .token) | ||
|
||
let cnodes = UnsafeBufferPointer<CClientNode?>( |
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.
Maybe call cnodes
children
instead?
* Remove `_SyntaxParserInterop.swift` * Use `RawSyntax.toOpaque()`/`RawSyntax.fromOpaque(:_)` to interop * Move `RawSyntax.createFromCSyntaxNode()` to the module * Move SyntaxKind/RawTokenKind/RawTriviaPiece creation from C serialization code to the module * Tweak some RawSyntax API visibility * Refactor materialized token creation API to efficiently create a them from the parser modules * Introduce `Syntax.withUnsafeRawSyntax(_:)` API
9ecba2b
to
6bcf9fd
Compare
@swift-ci Please test |
_SyntaxParserInterop.swift
RawSyntax.toOpaque()
/RawSyntax.fromOpaque(:_)
to interopRawSyntax.createFromCSyntaxNode()
to the moduleSyntax.withUnsafeRawSyntax(_:)
API