mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Fix a typo
This commit is contained in:
parent
5e00a398f7
commit
ffca2c1fe4
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ use ra_syntax::{
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct TokenMap {
|
pub struct TokenMap {
|
||||||
/// Maps `tt::TokenId` to the *relative* source range.
|
/// 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
|
/// 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 {
|
impl TokenMap {
|
||||||
pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> {
|
pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> {
|
||||||
let idx = tt.0 as usize;
|
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 {
|
fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId {
|
||||||
let id = self.toknes.len();
|
let id = self.tokens.len();
|
||||||
self.toknes.push(relative_range);
|
self.tokens.push(relative_range);
|
||||||
tt::TokenId(id as u32)
|
tt::TokenId(id as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue