From 58897dd8ddfd08ef494b7bc05ac15f5b1e3a4e1a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 11 Feb 2019 19:28:39 +0300 Subject: assign ids to tokens --- crates/ra_mbe/src/mbe_expander.rs | 4 +++- crates/ra_mbe/src/mbe_parser.rs | 2 +- crates/ra_mbe/src/syntax_bridge.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index eec713d9c..f6177f078 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs @@ -3,6 +3,7 @@ /// `tt::TokenTree` for the result of the expansion. use rustc_hash::FxHashMap; use ra_syntax::SmolStr; +use tt::TokenId; use crate::tt_cursor::TtCursor; @@ -185,7 +186,8 @@ fn expand_tt( } crate::TokenTree::Leaf(leaf) => match leaf { crate::Leaf::Ident(ident) => { - tt::Leaf::from(tt::Ident { text: ident.text.clone() }).into() + tt::Leaf::from(tt::Ident { text: ident.text.clone(), id: TokenId::unspecified() }) + .into() } crate::Leaf::Punct(punct) => tt::Leaf::from(punct.clone()).into(), crate::Leaf::Var(v) => bindings.get(&v.text, nesting)?.clone(), diff --git a/crates/ra_mbe/src/mbe_parser.rs b/crates/ra_mbe/src/mbe_parser.rs index 60e566ed2..58e2533f1 100644 --- a/crates/ra_mbe/src/mbe_parser.rs +++ b/crates/ra_mbe/src/mbe_parser.rs @@ -41,7 +41,7 @@ fn parse_subtree(tt: &tt::Subtree) -> Option { } } tt::Leaf::Punct(punct) => crate::Leaf::from(*punct).into(), - tt::Leaf::Ident(tt::Ident { text }) => { + tt::Leaf::Ident(tt::Ident { text, id: _ }) => { crate::Leaf::from(crate::Ident { text: text.clone() }).into() } tt::Leaf::Literal(tt::Literal { text }) => { diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 9a2eceaba..d734f5597 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -37,7 +37,7 @@ fn convert_tt(tt: &SyntaxNode) -> Option { convert_tt(child)?.into() } else if child.kind().is_keyword() || child.kind() == IDENT { let text = child.leaf_text().unwrap().clone(); - tt::Leaf::from(tt::Ident { text }).into() + tt::Leaf::from(tt::Ident { text, id: tt::TokenId::unspecified() }).into() } else if child.kind().is_literal() { tt::Leaf::from(tt::Literal { text: child.leaf_text().unwrap().clone() }).into() } else { -- cgit v1.2.3