mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 21:15:19 +00:00
Introduce a ruff_python_semantic
crate (#3865)
This commit is contained in:
parent
46bcb1f725
commit
d919adc13c
64 changed files with 267 additions and 225 deletions
|
@ -13,7 +13,6 @@ use rustpython_parser::{lexer, Mode, Tok};
|
|||
use smallvec::SmallVec;
|
||||
|
||||
use crate::call_path::CallPath;
|
||||
use crate::context::Context;
|
||||
use crate::source_code::{Generator, Indexer, Locator, Stylist};
|
||||
use crate::types::Range;
|
||||
use crate::visitor;
|
||||
|
@ -50,14 +49,6 @@ pub fn unparse_constant(constant: &Constant, stylist: &Stylist) -> String {
|
|||
generator.generate()
|
||||
}
|
||||
|
||||
/// Return `true` if the `Expr` contains a reference to `${module}.${target}`.
|
||||
pub fn contains_call_path(ctx: &Context, expr: &Expr, target: &[&str]) -> bool {
|
||||
any_over_expr(expr, &|expr| {
|
||||
ctx.resolve_call_path(expr)
|
||||
.map_or(false, |call_path| call_path.as_slice() == target)
|
||||
})
|
||||
}
|
||||
|
||||
/// Return `true` if the `Expr` contains an expression that appears to include a
|
||||
/// side-effect (like a function call).
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue