Add parenthesized flag to ExprTuple and ExprGenerator (#9614)

This commit is contained in:
Micha Reiser 2024-02-26 16:35:20 +01:00 committed by GitHub
parent ab4bd71755
commit 77c5561646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 391 additions and 139 deletions

View file

@ -1,5 +1,5 @@
// auto-generated: "lalrpop 0.20.0"
// sha3: 8c85e4bbac54760ed8be03b56a428d76e14d18e6dbde62b424d0b2b5e8e65dbe
// sha3: d64ca7ff27121baee9d7a1b4d0f341932391a365fe75f115987b05bf2aaf538e
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
use ruff_python_ast::{self as ast, Int, IpyEscapeKind};
use crate::{
@ -33938,7 +33938,8 @@ fn __action86<
ast::ExprTuple {
elts: vec![subject.into()],
ctx: ast::ExprContext::Load,
range: (tuple_location..tuple_end_location).into()
range: (tuple_location..tuple_end_location).into(),
parenthesized: false
},
)),
cases,
@ -33982,7 +33983,8 @@ fn __action87<
ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (tuple_location..tuple_end_location).into()
range: (tuple_location..tuple_end_location).into(),
parenthesized: false
},
)),
cases,
@ -36227,6 +36229,7 @@ fn __action208<
elts: vec![s1.into()],
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: false
}.into()
}
}
@ -36249,6 +36252,7 @@ fn __action209<
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: false
}.into()
}
}
@ -36796,7 +36800,8 @@ fn __action242<
ast::ExprGeneratorExp {
elt: Box::new(elt.into()),
generators,
range: (location..end_location).into()
range: (location..end_location).into(),
parenthesized: false
}
),
None => elt.into(),
@ -37049,7 +37054,12 @@ fn __action259<
}
} else {
let elts = elts.into_iter().map(ast::Expr::from).collect();
ast::ExprTuple { elts, ctx: ast::ExprContext::Load, range: (location..end_location).into() }.into()
ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: false
}.into()
}
}
}
@ -37103,7 +37113,12 @@ fn __action262<
}
} else {
let elts = elts.into_iter().map(ast::Expr::from).collect();
ast::ExprTuple { elts, ctx: ast::ExprContext::Load, range: (location..end_location).into() }.into()
ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: false
}.into()
}
}
}
@ -41292,7 +41307,12 @@ fn __action553<
}
} else {
let elts = elts.into_iter().map(ast::Expr::from).collect();
ast::ExprTuple { elts, ctx: ast::ExprContext::Load, range: (location..end_location).into() }.into()
ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: true
}.into()
}
}
}
@ -41327,7 +41347,12 @@ fn __action554<
})
} else {
let elts = left.into_iter().flatten().chain([mid]).chain(right).map(ast::Expr::from).collect();
Ok(ast::ExprTuple { elts, ctx: ast::ExprContext::Load, range: (location..end_location).into() }.into())
Ok(ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: true
}.into())
}
}
}
@ -41348,6 +41373,7 @@ fn __action555<
elts: Vec::new(),
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: true
}.into()
}
@ -41388,6 +41414,7 @@ fn __action557<
elt: Box::new(elt.into()),
generators,
range: (location..end_location).into(),
parenthesized: true
}.into()
}
@ -42025,7 +42052,12 @@ fn __action596<
})
} else {
let elts = left.into_iter().flatten().chain([mid]).chain(right).map(ast::Expr::from).collect();
Ok(ast::ExprTuple { elts, ctx: ast::ExprContext::Load, range: (location..end_location).into() }.into())
Ok(ast::ExprTuple {
elts,
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: true
}.into())
}
}
}
@ -42046,6 +42078,7 @@ fn __action597<
elts: Vec::new(),
ctx: ast::ExprContext::Load,
range: (location..end_location).into(),
parenthesized: true
}.into()
}
@ -42086,6 +42119,7 @@ fn __action599<
elt: Box::new(elt.into()),
generators,
range: (location..end_location).into(),
parenthesized: true
}.into()
}