mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:56 +00:00
Remove Expr
postfix from ExprNamed
, ExprIf
, and ExprGenerator
(#10229)
The expression types in our AST are called `ExprYield`, `ExprAwait`, `ExprStringLiteral` etc, except `ExprNamedExpr`, `ExprIfExpr` and `ExprGenratorExpr`. This seems to align with [Python AST's naming](https://docs.python.org/3/library/ast.html) but feels inconsistent and excessive. This PR removes the `Expr` postfix from `ExprNamedExpr`, `ExprIfExpr`, and `ExprGeneratorExpr`.
This commit is contained in:
parent
8b749e1d4d
commit
184241f99a
64 changed files with 418 additions and 428 deletions
|
@ -811,7 +811,7 @@ impl<'a> Generator<'a> {
|
|||
}
|
||||
});
|
||||
}
|
||||
Expr::NamedExpr(ast::ExprNamedExpr {
|
||||
Expr::Named(ast::ExprNamed {
|
||||
target,
|
||||
value,
|
||||
range: _,
|
||||
|
@ -887,7 +887,7 @@ impl<'a> Generator<'a> {
|
|||
self.unparse_expr(body, precedence::LAMBDA);
|
||||
});
|
||||
}
|
||||
Expr::IfExp(ast::ExprIfExp {
|
||||
Expr::If(ast::ExprIf {
|
||||
test,
|
||||
body,
|
||||
orelse,
|
||||
|
@ -967,7 +967,7 @@ impl<'a> Generator<'a> {
|
|||
self.unparse_comp(generators);
|
||||
self.p("}");
|
||||
}
|
||||
Expr::GeneratorExp(ast::ExprGeneratorExp {
|
||||
Expr::Generator(ast::ExprGenerator {
|
||||
elt,
|
||||
generators,
|
||||
parenthesized: _,
|
||||
|
@ -1034,7 +1034,7 @@ impl<'a> Generator<'a> {
|
|||
self.unparse_expr(func, precedence::MAX);
|
||||
self.p("(");
|
||||
if let (
|
||||
[Expr::GeneratorExp(ast::ExprGeneratorExp {
|
||||
[Expr::Generator(ast::ExprGenerator {
|
||||
elt,
|
||||
generators,
|
||||
range: _,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue