MCPcopy Create free account
hub / github.com/astral-sh/ruff / validate_delete_target

Method validate_delete_target

crates/ruff_python_parser/src/parser/statement.rs:3850–3860  ·  view source on GitHub ↗

Validate that the given expression is a valid delete target. If the expression is a list or tuple, then validate each element in the list. See:

(&mut self, expr: &Expr)

Source from the content-addressed store, hash-verified

3848 ///
3849 /// See: <https://github.com/python/cpython/blob/d864b0094f9875c5613cbb0b7f7f3ca8f1c6b606/Parser/action_helpers.c#L1150-L1180>
3850 fn validate_delete_target(&mut self, expr: &Expr) {
3851 match expr {
3852 Expr::List(ast::ExprList { elts, .. }) | Expr::Tuple(ast::ExprTuple { elts, .. }) => {
3853 for expr in elts {
3854 self.validate_delete_target(expr);
3855 }
3856 }
3857 Expr::Name(_) | Expr::Attribute(_) | Expr::Subscript(_) => {}
3858 _ => self.add_error(ParseErrorType::InvalidDeleteTarget, expr),
3859 }
3860 }
3861
3862 /// Classify the `match` soft keyword token.
3863 ///

Callers 1

Calls 1

add_errorMethod · 0.45

Tested by

no test coverage detected