mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-14 14:25:58 +00:00
Remove Parse
trait (#6235)
This commit is contained in:
parent
83fe103d6e
commit
debfca3a11
25 changed files with 235 additions and 1420 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::Parse;
|
||||
use crate::{parse_expression, parse_expression_starts_at};
|
||||
use anyhow::Result;
|
||||
use ruff_python_ast::relocate::relocate_expr;
|
||||
use ruff_python_ast::str;
|
||||
|
@ -33,7 +33,7 @@ pub fn parse_type_annotation(
|
|||
// isn't the case, e.g., for implicit concatenations, or for annotations that contain
|
||||
// escaped quotes.
|
||||
let leading_quote = str::leading_quote(expression).unwrap();
|
||||
let expr = Expr::parse_starts_at(
|
||||
let expr = parse_expression_starts_at(
|
||||
value,
|
||||
"<filename>",
|
||||
range.start() + leading_quote.text_len(),
|
||||
|
@ -41,7 +41,7 @@ pub fn parse_type_annotation(
|
|||
Ok((expr, AnnotationKind::Simple))
|
||||
} else {
|
||||
// Otherwise, consider this a "complex" annotation.
|
||||
let mut expr = Expr::parse(value, "<filename>")?;
|
||||
let mut expr = parse_expression(value, "<filename>")?;
|
||||
relocate_expr(&mut expr, range);
|
||||
Ok((expr, AnnotationKind::Complex))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue