[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:
Harlan
2017-06-27 11:08:10 -07:00
committed by GitHub
parent e89e7f58b2
commit 70089a7bcc
34 changed files with 1378 additions and 1340 deletions

View File

@@ -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 {