diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 10:59:10 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-20 10:59:10 +0100 |
commit | 6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (patch) | |
tree | f19271365126259a7975dda9ee3e1e1496a299dd /crates/ra_mbe/src/syntax_bridge.rs | |
parent | 2830d1376b05794c7bf1467fe52ad3bc0eb4ca41 (diff) | |
parent | f3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (diff) |
Merge #1560
1560: move debug_dump to fmt::Debug 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 | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 64ed6a517..7ff0fc472 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -19,7 +19,7 @@ pub struct TokenMap { | |||
19 | pub fn ast_to_token_tree(ast: &ast::TokenTree) -> Option<(tt::Subtree, TokenMap)> { | 19 | pub fn ast_to_token_tree(ast: &ast::TokenTree) -> Option<(tt::Subtree, TokenMap)> { |
20 | let mut token_map = TokenMap::default(); | 20 | let mut token_map = TokenMap::default(); |
21 | let node = ast.syntax(); | 21 | let node = ast.syntax(); |
22 | let tt = convert_tt(&mut token_map, node.range().start(), node)?; | 22 | let tt = convert_tt(&mut token_map, node.text_range().start(), node)?; |
23 | Some((tt, token_map)) | 23 | Some((tt, token_map)) |
24 | } | 24 | } |
25 | 25 | ||
@@ -27,7 +27,7 @@ pub fn ast_to_token_tree(ast: &ast::TokenTree) -> Option<(tt::Subtree, TokenMap) | |||
27 | /// will consume). | 27 | /// will consume). |
28 | pub fn syntax_node_to_token_tree(node: &SyntaxNode) -> Option<(tt::Subtree, TokenMap)> { | 28 | pub fn syntax_node_to_token_tree(node: &SyntaxNode) -> Option<(tt::Subtree, TokenMap)> { |
29 | let mut token_map = TokenMap::default(); | 29 | let mut token_map = TokenMap::default(); |
30 | let tt = convert_tt(&mut token_map, node.range().start(), node)?; | 30 | let tt = convert_tt(&mut token_map, node.text_range().start(), node)?; |
31 | Some((tt, token_map)) | 31 | Some((tt, token_map)) |
32 | } | 32 | } |
33 | 33 | ||
@@ -229,7 +229,7 @@ fn convert_tt( | |||
229 | || token.kind() == IDENT | 229 | || token.kind() == IDENT |
230 | || token.kind() == LIFETIME | 230 | || token.kind() == LIFETIME |
231 | { | 231 | { |
232 | let relative_range = token.range() - global_offset; | 232 | let relative_range = token.text_range() - global_offset; |
233 | let id = token_map.alloc(relative_range); | 233 | let id = token_map.alloc(relative_range); |
234 | let text = token.text().clone(); | 234 | let text = token.text().clone(); |
235 | tt::Leaf::from(tt::Ident { text, id }).into() | 235 | tt::Leaf::from(tt::Ident { text, id }).into() |