-
Notifications
You must be signed in to change notification settings - Fork 441
Eliminate SyntaxNode
#684
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
Eliminate SyntaxNode
#684
Conversation
@swift-ci Please test |
b2f9466
to
dff8f69
Compare
@swift-ci Please test |
dff8f69
to
2f03299
Compare
@swift-ci Please test |
`SyntaxNode` was introduced as a lighter `Syntax` when existentials were needed for creating `Syntax` instance. Now that `Syntax`/`SyntaxData` is just a struct that holds one class (`SyntaxBox`). So it's not that heavy. More importantly `SyntaxNode` was not safe to escape because it didn't retain the `SyntaxArena` of the `AbsoluteRawSyntax` `SyntaxNode` was only used in `SyntaxCursor` for `IncrementalParseLookup`. Use `SyntaxData` instead.
2f03299
to
c8ae3de
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.
A great simplification. Thank you.
@@ -766,3 +663,6 @@ extension RawSyntaxNodeProtocol { | |||
return Syntax(raw: raw).recursiveDescription | |||
} | |||
} | |||
|
|||
@available(*, unavailable, message: "use 'Syntax' instead") | |||
public struct SyntaxNode {} |
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.
Is this useful in any way or just an artifact from your local development?
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 left this only because SyntaxNode
was a public type. Since the initializer was not public, I don't anticipate anyone is using this. But still.
SyntaxNode
was introduced as a lighterSyntax
when existentials were needed for creatingSyntax
instance.Now that
Syntax
/SyntaxData
is just a struct that holds one class (SyntaxBox
). So it's not that heavy.More importantly
SyntaxNode
was not safe to escape because it didn't retain theSyntaxArena
of theAbsoluteRawSyntax
SyntaxNode
was only used inSyntaxCursor
forIncrementalParseLookup
. UseSyntaxData
instead.(Conflicts with #659 . Will rebase after merging it)
(No noticeable performance regression with a test case in rdar://48511326)