diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 12:15:55 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 12:15:55 +0100 |
commit | f209843e31af7f0e0212aa28ffec2efad2a70c6f (patch) | |
tree | 548227da78a3bea644f57714d075410c0bdf7469 /crates/ra_mbe/src/syntax_bridge.rs | |
parent | 58d4983ba5745975446d60f2886d96f8d2adf0f2 (diff) | |
parent | d4a66166c002f0a49e41d856a49cb5685ac93202 (diff) |
Merge #1545
1545: migrate ra_syntax to the new rowan API r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_mbe/src/syntax_bridge.rs')
-rw-r--r-- | crates/ra_mbe/src/syntax_bridge.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index bfc351f81..64ed6a517 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -2,7 +2,7 @@ use crate::subtree_source::SubtreeTokenSource; | |||
2 | use crate::ExpandError; | 2 | use crate::ExpandError; |
3 | use ra_parser::{ParseError, TreeSink}; | 3 | use ra_parser::{ParseError, TreeSink}; |
4 | use ra_syntax::{ | 4 | use ra_syntax::{ |
5 | ast, AstNode, Parse, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxNode, | 5 | ast, AstNode, AstToken, Parse, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxNode, |
6 | SyntaxTreeBuilder, TextRange, TextUnit, T, | 6 | SyntaxTreeBuilder, TextRange, TextUnit, T, |
7 | }; | 7 | }; |
8 | use tt::buffer::{Cursor, TokenBuffer}; | 8 | use tt::buffer::{Cursor, TokenBuffer}; |
@@ -116,8 +116,6 @@ impl TokenMap { | |||
116 | /// and strips the ending `*/` | 116 | /// and strips the ending `*/` |
117 | /// And then quote the string, which is needed to convert to `tt::Literal` | 117 | /// And then quote the string, which is needed to convert to `tt::Literal` |
118 | fn doc_comment_text(comment: &ast::Comment) -> SmolStr { | 118 | fn doc_comment_text(comment: &ast::Comment) -> SmolStr { |
119 | use ast::AstToken; | ||
120 | |||
121 | let prefix_len = comment.prefix().len(); | 119 | let prefix_len = comment.prefix().len(); |
122 | let mut text = &comment.text()[prefix_len..]; | 120 | let mut text = &comment.text()[prefix_len..]; |
123 | 121 | ||
@@ -132,9 +130,8 @@ fn doc_comment_text(comment: &ast::Comment) -> SmolStr { | |||
132 | text.into() | 130 | text.into() |
133 | } | 131 | } |
134 | 132 | ||
135 | fn convert_doc_comment<'a>(token: &ra_syntax::SyntaxToken<'a>) -> Option<Vec<tt::TokenTree>> { | 133 | fn convert_doc_comment(token: &ra_syntax::SyntaxToken) -> Option<Vec<tt::TokenTree>> { |
136 | use ast::AstToken; | 134 | let comment = ast::Comment::cast(token.clone())?; |
137 | let comment = ast::Comment::cast(*token)?; | ||
138 | let doc = comment.kind().doc?; | 135 | let doc = comment.kind().doc?; |
139 | 136 | ||
140 | // Make `doc="\" Comments\"" | 137 | // Make `doc="\" Comments\"" |
@@ -245,7 +242,7 @@ fn convert_tt( | |||
245 | } | 242 | } |
246 | } | 243 | } |
247 | SyntaxElement::Node(node) => { | 244 | SyntaxElement::Node(node) => { |
248 | let child = convert_tt(token_map, global_offset, node)?.into(); | 245 | let child = convert_tt(token_map, global_offset, &node)?.into(); |
249 | token_trees.push(child); | 246 | token_trees.push(child); |
250 | } | 247 | } |
251 | }; | 248 | }; |