cleanup stale FIXME(#64197)
This commit is contained in:
parent
af6d8865fe
commit
0dc74dc0c6
@ -50,13 +50,13 @@ fn t1() {
|
|||||||
assert_eq!(string_reader.next_token(), token::Whitespace);
|
assert_eq!(string_reader.next_token(), token::Whitespace);
|
||||||
// Read another token.
|
// Read another token.
|
||||||
let tok3 = string_reader.next_token();
|
let tok3 = string_reader.next_token();
|
||||||
assert_eq!(string_reader.pos.clone(), BytePos(28));
|
assert_eq!(string_reader.pos(), BytePos(28));
|
||||||
let tok4 = Token::new(mk_ident("main"), Span::with_root_ctxt(BytePos(24), BytePos(28)));
|
let tok4 = Token::new(mk_ident("main"), Span::with_root_ctxt(BytePos(24), BytePos(28)));
|
||||||
assert_eq!(tok3.kind, tok4.kind);
|
assert_eq!(tok3.kind, tok4.kind);
|
||||||
assert_eq!(tok3.span, tok4.span);
|
assert_eq!(tok3.span, tok4.span);
|
||||||
|
|
||||||
assert_eq!(string_reader.next_token(), token::OpenDelim(token::Paren));
|
assert_eq!(string_reader.next_token(), token::OpenDelim(token::Paren));
|
||||||
assert_eq!(string_reader.pos.clone(), BytePos(29))
|
assert_eq!(string_reader.pos(), BytePos(29))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ pub struct StringReader<'a> {
|
|||||||
/// Initial position, read-only.
|
/// Initial position, read-only.
|
||||||
start_pos: BytePos,
|
start_pos: BytePos,
|
||||||
/// The absolute offset within the source_map of the current character.
|
/// The absolute offset within the source_map of the current character.
|
||||||
// FIXME(#64197): `pub` is needed by tests for now.
|
pos: BytePos,
|
||||||
pub pos: BytePos,
|
|
||||||
/// Stop reading src at this index.
|
/// Stop reading src at this index.
|
||||||
end_src_index: usize,
|
end_src_index: usize,
|
||||||
/// Source text to tokenize.
|
/// Source text to tokenize.
|
||||||
@ -436,6 +435,10 @@ impl<'a> StringReader<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pos(&self) -> BytePos {
|
||||||
|
self.pos
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn src_index(&self, pos: BytePos) -> usize {
|
fn src_index(&self, pos: BytePos) -> usize {
|
||||||
(pos - self.start_pos).to_usize()
|
(pos - self.start_pos).to_usize()
|
||||||
|
Loading…
Reference in New Issue
Block a user