Fix a typo

This commit is contained in:
Dale Wijnand 2019-02-26 17:59:32 +00:00
parent 5e00a398f7
commit ffca2c1fe4
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF

View File

@ -8,7 +8,7 @@ use ra_syntax::{
#[derive(Default)]
pub struct TokenMap {
/// Maps `tt::TokenId` to the *relative* source range.
toknes: Vec<TextRange>,
tokens: Vec<TextRange>,
}
/// Convert the syntax tree (what user has written) to a `TokenTree` (what macro
@ -32,12 +32,12 @@ pub fn token_tree_to_ast_item_list(tt: &tt::Subtree) -> TreeArc<ast::SourceFile>
impl TokenMap {
pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> {
let idx = tt.0 as usize;
self.toknes.get(idx).map(|&it| it)
self.tokens.get(idx).map(|&it| it)
}
fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId {
let id = self.toknes.len();
self.toknes.push(relative_range);
let id = self.tokens.len();
self.tokens.push(relative_range);
tt::TokenId(id as u32)
}
}