mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-09 21:28:21 +00:00
Move {AnyNodeRef, AstNode} to ruff_python_ast crate root (#8030)
This is a do-over of https://github.com/astral-sh/ruff/pull/8011, which I accidentally merged into a non-`main` branch. Sorry!
This commit is contained in:
parent
d85950ce5a
commit
d685107638
72 changed files with 76 additions and 75 deletions
|
@ -1,6 +1,6 @@
|
|||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::node::AnyNodeRef;
|
||||
use crate::AnyNodeRef;
|
||||
use crate::{self as ast, Expr};
|
||||
|
||||
/// Unowned pendant to [`ast::Expr`] that stores a reference instead of a owned value.
|
||||
|
|
|
@ -8,9 +8,9 @@ use smallvec::SmallVec;
|
|||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::call_path::CallPath;
|
||||
use crate::node::AnyNodeRef;
|
||||
use crate::parenthesize::parenthesized_range;
|
||||
use crate::statement_visitor::{walk_body, walk_stmt, StatementVisitor};
|
||||
use crate::AnyNodeRef;
|
||||
use crate::{
|
||||
self as ast, Arguments, CmpOp, Constant, ExceptHandler, Expr, MatchCase, Pattern, Stmt,
|
||||
TypeParam,
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::path::Path;
|
|||
|
||||
pub use expression::*;
|
||||
pub use int::*;
|
||||
pub use node::{AnyNode, AnyNodeRef, AstNode, NodeKind};
|
||||
pub use nodes::*;
|
||||
|
||||
pub mod all;
|
||||
|
@ -14,7 +15,7 @@ pub mod helpers;
|
|||
pub mod identifier;
|
||||
pub mod imports;
|
||||
mod int;
|
||||
pub mod node;
|
||||
mod node;
|
||||
mod nodes;
|
||||
pub mod parenthesize;
|
||||
pub mod relocate;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use ruff_python_trivia::{BackwardsTokenizer, CommentRanges, SimpleTokenKind, SimpleTokenizer};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange};
|
||||
|
||||
use crate::node::AnyNodeRef;
|
||||
use crate::AnyNodeRef;
|
||||
use crate::ExpressionRef;
|
||||
|
||||
/// Returns the [`TextRange`] of a given expression including parentheses, if the expression is
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::node::{AnyNodeRef, AstNode};
|
||||
use crate::{
|
||||
Alias, Arguments, BoolOp, CmpOp, Comprehension, Constant, Decorator, ElifElseClause,
|
||||
ExceptHandler, Expr, Keyword, MatchCase, Mod, Operator, Parameter, ParameterWithDefault,
|
||||
Parameters, Pattern, PatternArguments, PatternKeyword, Stmt, TypeParam, TypeParams, UnaryOp,
|
||||
WithItem,
|
||||
};
|
||||
use crate::{AnyNodeRef, AstNode};
|
||||
|
||||
/// Visitor that traverses all nodes recursively in pre-order.
|
||||
pub trait PreorderVisitor<'a> {
|
||||
|
|
|
@ -2,12 +2,12 @@ use std::fmt::{Debug, Write};
|
|||
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use ruff_python_ast::visitor::preorder::{
|
||||
walk_alias, walk_comprehension, walk_except_handler, walk_expr, walk_keyword, walk_match_case,
|
||||
walk_module, walk_parameter, walk_parameters, walk_pattern, walk_stmt, walk_type_param,
|
||||
walk_with_item, PreorderVisitor,
|
||||
};
|
||||
use ruff_python_ast::AnyNodeRef;
|
||||
use ruff_python_ast::{
|
||||
Alias, BoolOp, CmpOp, Comprehension, Constant, ExceptHandler, Expr, Keyword, MatchCase, Mod,
|
||||
Operator, Parameter, Parameters, Pattern, Stmt, TypeParam, UnaryOp, WithItem,
|
||||
|
|
|
@ -5,12 +5,12 @@ use ruff_python_ast as ast;
|
|||
use ruff_python_parser::lexer::lex;
|
||||
use ruff_python_parser::{parse_tokens, Mode};
|
||||
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use ruff_python_ast::visitor::{
|
||||
walk_alias, walk_comprehension, walk_except_handler, walk_expr, walk_keyword, walk_match_case,
|
||||
walk_parameter, walk_parameters, walk_pattern, walk_stmt, walk_type_param, walk_with_item,
|
||||
Visitor,
|
||||
};
|
||||
use ruff_python_ast::AnyNodeRef;
|
||||
use ruff_python_ast::{
|
||||
Alias, BoolOp, CmpOp, Comprehension, ExceptHandler, Expr, Keyword, MatchCase, Operator,
|
||||
Parameter, Parameters, Pattern, Stmt, TypeParam, UnaryOp, WithItem,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue