forked from swiftlang/swift-syntax
-
Notifications
You must be signed in to change notification settings - Fork 0
[DNM] test swiftlang/swift-syntax#2944 #148
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mark `SyntaxArena` and `ParsingSyntaxArena` with `@_spi(RawSyntax)`. `SyntaxArena` and its subclass `ParsingSyntaxArena` were only meant be used when dealing with `RawSyntax` which is already a SPI. Although type type itself was `public`, most initializers were SPI, also there was no way to retrieve it from existing types via public API. So we assume no one was actually using it directly.
Make `SyntaxArena` SPI
Rework `Syntax` internals. "Red" tree is now bump-pointer allocated and visited children are cached. * `Syntax` is a pair of the allocator (strong reference to `SyntaxDataArena` class) and a pointer to the allocated data (`SyntaxData` struct). * All the red-tree data (parent and positions) are bump-pointer-allocated and cached. * The arena and the tree are 1:1. Each mutation creates a new arena. * `child(at:)` is now O(1) because the red-tree children are cached in the arena. * `root` is now O(1) regardless of the depth because the arena holds the reference. * Simplify `SyntaxChildren`. `SyntaxChildrenIndex` is now just a `Int` Remove some hacks as they aren't needed anymore: * `UnownedSyntax` because `SyntaxDataReference` replaces it. * `SyntaxNodeFactory` because `Syntax.Info` is gone. Additionally: * Flatten `AbsoluteSyntaxInfo` to simplify the data and clarify what `advancedBySibling(_:)` and `advancedToFirstChild()` do. * Remove `RawSyntaxChildren` and `RawNonNilSyntaxChildren` as they were implementation detail of `SyntaxChildren`. * Remove `AbsoluteRawSyntax` and `AbsoluteSyntaxPosition` as nobody was really using it. * Rename `Syntax.indexInParent` to `layoutIndexInParent` because it was confusing with `SyntaxProtocol.indexInParent: SyntaxChildrenIndex`
[Syntax] Use BumpPtrAllocator for Syntax node internals
…FunctionCallExprSyntax initializer
…tax-builder-initializer Remove default values for leftParen and rightParen parameters in the FunctionCallExprSyntax initializer
…ata-arena Revert "[Syntax] Use BumpPtrAllocator for Syntax node internals"
Describe an RFC process to request feedback for public API changes
…925-syntax-data-arena Revert "Revert "[Syntax] Use BumpPtrAllocator for Syntax node internals""
There was no reason to convert it to UInt.
i.e. 'previousToken', 'nextToken', 'firstToken', and 'lastToken' Iterate over 'layoutBuffer' directly to avoid 'SyntaxChildren' which implies retaining 'SyntaxDataArena' for each element. This way, it only retains the found 'TokenSyntax', nothing else.
[Syntax] Let SyntaxIdentifier use RawSyntax.ID directly
[Perf] Optimize TokenSequence
…ritten node When an accessor macro contains a closure, it gets rewritten to a new node in `MacroSystem` by calling `super.visit`. That rewritten node doesn’t have any parents (because `SyntaxRewriter` is expecting that node to get inserted into the tree when the node’s parent gets rewritten). This caused us to generate an empty lexical context in these situations. To fix this, generate the lexical context based on the node before we rewrite it. rdar://142639902
Compute the lexical context of an accessor macro based on the pre-rewritten node
Can be detected with `defined(__wasi__) && !defined(_REENTRANT)`
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains:
The purpose of this PR is to test swiftlang#2944 with our CI.