mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
Rename PreorderVisitor
to SourceOrderVisitor
(#11798)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
37d8de3316
commit
32ca704956
27 changed files with 496 additions and 491 deletions
|
@ -406,11 +406,11 @@ impl<'a> Comments<'a> {
|
|||
/// normally if `node` is the first or last node of a suppression range.
|
||||
#[cfg(debug_assertions)]
|
||||
pub(crate) fn mark_verbatim_node_comments_formatted(&self, node: AnyNodeRef) {
|
||||
use ruff_python_ast::visitor::preorder::{PreorderVisitor, TraversalSignal};
|
||||
use ruff_python_ast::visitor::source_order::{SourceOrderVisitor, TraversalSignal};
|
||||
|
||||
struct MarkVerbatimCommentsAsFormattedVisitor<'a>(&'a Comments<'a>);
|
||||
|
||||
impl<'a> PreorderVisitor<'a> for MarkVerbatimCommentsAsFormattedVisitor<'a> {
|
||||
impl<'a> SourceOrderVisitor<'a> for MarkVerbatimCommentsAsFormattedVisitor<'a> {
|
||||
fn enter_node(&mut self, node: AnyNodeRef<'a>) -> TraversalSignal {
|
||||
for comment in self.0.leading_dangling_trailing(node) {
|
||||
comment.mark_formatted();
|
||||
|
|
|
@ -7,7 +7,7 @@ use ruff_python_ast::{Mod, Stmt};
|
|||
// The interface is designed to only export the members relevant for iterating nodes in
|
||||
// pre-order.
|
||||
#[allow(clippy::wildcard_imports)]
|
||||
use ruff_python_ast::visitor::preorder::*;
|
||||
use ruff_python_ast::visitor::source_order::*;
|
||||
use ruff_python_trivia::{CommentLinePosition, CommentRanges};
|
||||
use ruff_source_file::Locator;
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
@ -70,7 +70,7 @@ impl<'a, 'builder> CommentsVisitor<'a, 'builder> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ast> PreorderVisitor<'ast> for CommentsVisitor<'ast, '_> {
|
||||
impl<'ast> SourceOrderVisitor<'ast> for CommentsVisitor<'ast, '_> {
|
||||
fn enter_node(&mut self, node: AnyNodeRef<'ast>) -> TraversalSignal {
|
||||
let node_range = node.range();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue