Use CommentRanges in backwards lexing (#7360)
## Summary The tokenizer was split into a forward and a backwards tokenizer. The backwards tokenizer uses the same names as the forwards ones (e.g. `next_token`). The backwards tokenizer gets the comment ranges that we already built to skip comments. --------- Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
@@ -182,6 +182,7 @@ mod tests {
|
||||
use ruff_formatter::SourceCode;
|
||||
use ruff_python_ast::node::AnyNode;
|
||||
use ruff_python_ast::{StmtBreak, StmtContinue};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
|
||||
use crate::comments::map::MultiMap;
|
||||
@@ -231,7 +232,8 @@ break;
|
||||
),
|
||||
);
|
||||
|
||||
let comments = Comments::new(comments_map);
|
||||
let comment_ranges = CommentRanges::default();
|
||||
let comments = Comments::new(comments_map, &comment_ranges);
|
||||
|
||||
assert_debug_snapshot!(comments.debug(source_code));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user