mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Syntax] Represent TokenSyntax as a Syntax node (#10606)
Previously, users of TokenSyntax would always deal with RC<TokenSyntax> which is a subclass of RawSyntax. Instead, provide TokenSyntax as a fully-realized Syntax node, that will always exist as a leaf in the Syntax tree. This hides the implementation detail of RawSyntax and SyntaxData completely from clients of libSyntax, and paves the way for future generation of Syntax nodes.
This commit is contained in:
@@ -282,7 +282,7 @@ std::vector<Token> swift::tokenize(const LangOptions &LangOpts,
|
||||
}
|
||||
|
||||
// TODO: Refactor into common implementation with swift::tokenize.
|
||||
std::vector<std::pair<RC<syntax::TokenSyntax>,
|
||||
std::vector<std::pair<RC<syntax::RawTokenSyntax>,
|
||||
syntax::AbsolutePosition>>
|
||||
swift::tokenizeWithTrivia(const LangOptions &LangOpts,
|
||||
const SourceManager &SM,
|
||||
@@ -296,7 +296,7 @@ swift::tokenizeWithTrivia(const LangOptions &LangOpts,
|
||||
CommentRetentionMode::AttachToNextToken,
|
||||
TriviaRetentionMode::WithTrivia,
|
||||
Offset, EndOffset);
|
||||
std::vector<std::pair<RC<syntax::TokenSyntax>,
|
||||
std::vector<std::pair<RC<syntax::RawTokenSyntax>,
|
||||
syntax::AbsolutePosition>> Tokens;
|
||||
syntax::AbsolutePosition RunningPos;
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user