Merge pull request #4356 from andersk/with-tuple-named

Fix parsing of tuple with named expression as context manager
This commit is contained in:
Jeong YunWon 2022-12-26 16:02:17 +09:00 committed by GitHub
commit d7986317c1
2 changed files with 141 additions and 116 deletions

View file

@ -1792,106 +1792,121 @@ expression: "parse_program(source, \"<test>\").unwrap()"
context_expr: Located {
location: Location {
row: 21,
column: 6,
column: 5,
},
end_location: Some(
Location {
row: 21,
column: 12,
column: 21,
},
),
custom: (),
node: NamedExpr {
target: Located {
location: Location {
row: 21,
column: 6,
},
end_location: Some(
Location {
node: Tuple {
elts: [
Located {
location: Location {
row: 21,
column: 12,
column: 6,
},
),
custom: (),
node: Name {
id: "a",
ctx: Store,
},
},
value: Located {
location: Location {
row: 21,
column: 11,
},
end_location: Some(
Location {
row: 21,
column: 12,
},
),
custom: (),
node: Constant {
value: Int(
0,
end_location: Some(
Location {
row: 21,
column: 12,
},
),
kind: None,
},
},
},
},
optional_vars: None,
},
Withitem {
context_expr: Located {
location: Location {
row: 21,
column: 14,
},
end_location: Some(
Location {
row: 21,
column: 20,
},
),
custom: (),
node: NamedExpr {
target: Located {
location: Location {
row: 21,
column: 14,
},
end_location: Some(
Location {
row: 21,
column: 20,
custom: (),
node: NamedExpr {
target: Located {
location: Location {
row: 21,
column: 6,
},
end_location: Some(
Location {
row: 21,
column: 12,
},
),
custom: (),
node: Name {
id: "a",
ctx: Store,
},
},
value: Located {
location: Location {
row: 21,
column: 11,
},
end_location: Some(
Location {
row: 21,
column: 12,
},
),
custom: (),
node: Constant {
value: Int(
0,
),
kind: None,
},
},
},
),
custom: (),
node: Name {
id: "b",
ctx: Store,
},
},
value: Located {
location: Location {
row: 21,
column: 19,
},
end_location: Some(
Location {
Located {
location: Location {
row: 21,
column: 20,
column: 14,
},
),
custom: (),
node: Constant {
value: Int(
1,
end_location: Some(
Location {
row: 21,
column: 20,
},
),
kind: None,
custom: (),
node: NamedExpr {
target: Located {
location: Location {
row: 21,
column: 14,
},
end_location: Some(
Location {
row: 21,
column: 20,
},
),
custom: (),
node: Name {
id: "b",
ctx: Store,
},
},
value: Located {
location: Location {
row: 21,
column: 19,
},
end_location: Some(
Location {
row: 21,
column: 20,
},
),
custom: (),
node: Constant {
value: Int(
1,
),
kind: None,
},
},
},
},
},
],
ctx: Load,
},
},
optional_vars: None,