Merge pull request #4373 from andersk/named

Allow named expression in subscript and set comprehension
This commit is contained in:
Jeong YunWon 2022-12-31 10:58:09 +09:00 committed by GitHub
commit 5f007ffcca

View file

@ -1037,7 +1037,7 @@ SubscriptList: ast::Expr = {
}; };
Subscript: ast::Expr = { Subscript: ast::Expr = {
Test<"all">, NamedExpressionTest,
<location:@L> <e1:Test<"all">?> ":" <e2:Test<"all">?> <e3:SliceOp?> <end_location:@R> => { <location:@L> <e1:Test<"all">?> ":" <e2:Test<"all">?> <e3:SliceOp?> <end_location:@R> => {
let lower = e1.map(Box::new); let lower = e1.map(Box::new);
let upper = e2.map(Box::new); let upper = e2.map(Box::new);
@ -1199,7 +1199,7 @@ Atom<Goal>: ast::Expr = {
custom: (), custom: (),
node: ast::ExprKind::Set { elts } node: ast::ExprKind::Set { elts }
}, },
<location:@L> "{" <elt:Test<"all">> <generators:CompFor> "}" <end_location:@R> => { <location:@L> "{" <elt:NamedExpressionTest> <generators:CompFor> "}" <end_location:@R> => {
ast::Expr { ast::Expr {
location, location,
end_location: Some(end_location), end_location: Some(end_location),