mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In contrast to SyntaxData, SyntaxDataRef is not memory-safe, but designed to be fast. In particular, the following guarantees from SyntaxData are being dropped: - SyntaxDataRef does not retain the SyntaxArena containing its RawSyntax. The user of SyntaxDataRef has to provide that guarantee. However, that's usually pretty easily done by just retaining the SyntaxArena of the tree's root node. - The parent of a SyntaxDataRef must outlive the child node. This is the more tricky constraint, but if a tree is just walked top to bottom with nodes stored on the stack, this is given by the way the stack is being unrolled.
3.6 KiB
3.6 KiB