Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkov
Remove `TokenStream::JointTree`. This is done by adding a new `IsJoint` field to `TokenStream::Tree`, which simplifies a lot of `match` statements. And likewise for `CursorKind`. The commit also adds a new method `TokenTree:stream()` which can replace a choice between `.into()` and `.joint()`.
This commit is contained in:
commit
61f50d9d2e
3 changed files with 46 additions and 60 deletions
|
@ -21,7 +21,7 @@ use syntax::ast;
|
|||
use syntax::ext::base::ExtCtxt;
|
||||
use syntax::parse::lexer::comments;
|
||||
use syntax::parse::{self, token, ParseSess};
|
||||
use syntax::tokenstream::{self, DelimSpan, TokenStream};
|
||||
use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream};
|
||||
use syntax_pos::hygiene::{SyntaxContext, Transparency};
|
||||
use syntax_pos::symbol::{keywords, Symbol};
|
||||
use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span};
|
||||
|
@ -278,11 +278,7 @@ impl ToInternal<TokenStream> for TokenTree<Group, Punct, Ident, Literal> {
|
|||
};
|
||||
|
||||
let tree = tokenstream::TokenTree::Token(span, token);
|
||||
if joint {
|
||||
tree.joint()
|
||||
} else {
|
||||
tree.into()
|
||||
}
|
||||
TokenStream::Tree(tree, if joint { Joint } else { NonJoint })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue