-
Notifications
You must be signed in to change notification settings - Fork 422
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
[NFC] Rename 'SyntaxArena' to 'RawSyntaxArena' #2926
base: main
Are you sure you want to change the base?
Conversation
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
@swift-ci Please test Windows |
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.
Just a few comments regarding naming / comments, otherwise LGTM.
/// | ||
/// Because the syntax arena will always outlive any syntax nodes that | ||
/// reference its contents, we know that the pointer's contents won't get | ||
/// deallocated while being accessed and thus we can add an unchecked `Sendable` | ||
/// conformance. | ||
@_spi(RawSyntax) | ||
public struct SyntaxArenaAllocatedPointer<Element: Sendable>: @unchecked Sendable { | ||
public struct ArenaAllocatedPointer<Element: Sendable>: @unchecked Sendable { |
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.
Should the comment also be updated so it doesn’t mention RawSyntaxArena
if this type is supposed to hold pointers allocated in arbitrary arenas?
Same for comments below.
Sources/SwiftSyntax/Syntax.swift
Outdated
private var arena: RetainedSyntaxArena | ||
private var rawNodeArena: RetainedRawSyntaxArena |
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.
You didn’t change all parameters / members from arena
to rawNodeArena
(eg. RawSyntaxTokenView
still has arena: RawSyntaxArena
). I think it would be good to have a consistent naming and I don’t see a problem with continuing to call it arena
.
Same in some more places.
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 missed some places, but my intention was to leave arena:
for RawSyntax
operations. But for Syntax
related operations, I thought it'd be clearer to use rawAllocationArena
or rawNodeArena
. Especially if we'd merge #2925 (let's discuss about it next year), Syntax
has different "arena".
/// be reference-counted, further improving the performance of ``SwiftSyntax`` | ||
/// when worked with at that level. | ||
public class SyntaxArena { | ||
public class RawSyntaxArena { |
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.
It's unfortunate that SyntaxArena
was non-SPI public
. I'm going to add deprecated typealias SyntaxArena = RawSyntaxArena
. Same for ParsingSyntaxArena
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.
Alex and I discussed about this and we think they shouldn't be public. Making them SPI in #2930 before this PR.
38c9f80
to
39ec125
Compare
@swift-ci Please test |
39ec125
to
78053fb
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
The current `SyntaxArena` only manages `RawSyntax` green tree things. In swift-syntax, "Syntax" refers to `Syntax` the red tree. So the naming was a bit confusing. Also rename `SyntaxArenaAllocated(Buffer)Pointer` to 'ArenaAllocated*' in preparation for future introduction of other "arenas".
78053fb
to
69d2897
Compare
@swift-ci Please test |
The current
SyntaxArena
only managesRawSyntax
green tree things. In swift-syntax, "Syntax" refers toSyntax
the red tree. So the naming was a bit confusing.As for
arena:
argument labels, rename it torawAllocationArena:
expect in theRawSyntax
world (i.e.SwiftSyntax/raw/*
andSwiftParser/*
).Also rename
SyntaxArenaAllocated(Buffer)Pointer
toArenaAllocated*
in preparation for future introduction of other "arenas". (i.e. #2925)