mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 18:12:51 +00:00
Fix a typo
This commit is contained in:
parent
5e00a398f7
commit
ffca2c1fe4
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user