Skip to content

Commit d9bbeeb

Browse files
committed
Fix NamedExpr location
1 parent e164a41 commit d9bbeeb

4 files changed

Lines changed: 10 additions & 10 deletions

‎parser/python.lalrpop‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,10 @@ NamedExpressionTest: ast::Expr = {
767767
}
768768

769769
NamedExpression: ast::Expr = {
770-
<location:@L> <id:Identifier> ":=" <value:Test<"all">> <end_location:@R> => {
770+
<location:@L> <id:Identifier> <end_location:@R> ":=" <value:Test<"all">> => {
771771
ast::Expr {
772772
location,
773-
end_location: Some(end_location),
773+
end_location: value.end_location,
774774
custom: (),
775775
node: ast::ExprKind::NamedExpr {
776776
target: Box::new(ast::Expr::new(

‎parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ expression: parse_ast
3737
end_location: Some(
3838
Location {
3939
row: 1,
40-
column: 8,
40+
column: 4,
4141
},
4242
),
4343
custom: (),

‎parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Located {
3636
end_location: Some(
3737
Location {
3838
row: 1,
39-
column: 11,
39+
column: 2,
4040
},
4141
),
4242
custom: (),

‎parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
16161616
end_location: Some(
16171617
Location {
16181618
row: 19,
1619-
column: 12,
1619+
column: 7,
16201620
},
16211621
),
16221622
custom: (),
@@ -1704,7 +1704,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
17041704
end_location: Some(
17051705
Location {
17061706
row: 20,
1707-
column: 12,
1707+
column: 7,
17081708
},
17091709
),
17101710
custom: (),
@@ -1824,7 +1824,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
18241824
end_location: Some(
18251825
Location {
18261826
row: 21,
1827-
column: 12,
1827+
column: 7,
18281828
},
18291829
),
18301830
custom: (),
@@ -1875,7 +1875,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
18751875
end_location: Some(
18761876
Location {
18771877
row: 21,
1878-
column: 20,
1878+
column: 15,
18791879
},
18801880
),
18811881
custom: (),
@@ -1981,7 +1981,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
19811981
end_location: Some(
19821982
Location {
19831983
row: 22,
1984-
column: 12,
1984+
column: 7,
19851985
},
19861986
),
19871987
custom: (),
@@ -2032,7 +2032,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
20322032
end_location: Some(
20332033
Location {
20342034
row: 22,
2035-
column: 20,
2035+
column: 15,
20362036
},
20372037
),
20382038
custom: (),

0 commit comments

Comments
 (0)