about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-12-23 23:09:07 +0100
committerGitHub <noreply@github.com>2018-12-23 23:09:07 +0100
commit61f50d9d2e446ebc4fb4a8f5b5ea886f9e661efd (patch)
tree117c01e01465bc16e5c0723a4215932a7787c6ad /src/libsyntax/parse
parent5157c22eba67e0761e6068dac96368b394efcb0c (diff)
parente7c5146c5d801c020f13c81b8b550f465c33d03a (diff)
downloadrust-61f50d9d2e446ebc4fb4a8f5b5ea886f9e661efd.tar.gz
rust-61f50d9d2e446ebc4fb4a8f5b5ea886f9e661efd.zip
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()`.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/tokentrees.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libsyntax/parse/lexer/tokentrees.rs b/src/libsyntax/parse/lexer/tokentrees.rs
index 6f9dc247a78..265ff5f57e4 100644
--- a/src/libsyntax/parse/lexer/tokentrees.rs
+++ b/src/libsyntax/parse/lexer/tokentrees.rs
@@ -11,7 +11,7 @@
 use print::pprust::token_to_string;
 use parse::lexer::StringReader;
 use parse::{token, PResult};
-use tokenstream::{DelimSpan, TokenStream, TokenTree};
+use tokenstream::{DelimSpan, IsJoint::*, TokenStream, TokenTree};
 
 impl<'a> StringReader<'a> {
     // Parse a stream of tokens into a list of `TokenTree`s, up to an `Eof`.
@@ -186,8 +186,7 @@ impl<'a> StringReader<'a> {
                 let raw = self.span_src_raw;
                 self.real_token();
                 let is_joint = raw.hi() == self.span_src_raw.lo() && token::is_op(&self.token);
-
-                Ok(if is_joint { tt.joint() } else { tt.into() })
+                Ok(TokenStream::Tree(tt, if is_joint { Joint } else { NonJoint }))
             }
         }
     }