From d9bbeeb9b355d436f6036f07d6e1819a17544b7a Mon Sep 17 00:00:00 2001 From: harupy Date: Sat, 31 Dec 2022 23:32:08 +0900 Subject: [PATCH] Fix NamedExpr location --- parser/python.lalrpop | 4 ++-- ...on_parser__context__tests__assign_named_expr.snap | 2 +- ...rse_named_expression_generator_comprehension.snap | 2 +- ...stpython_parser__with__tests__with_statement.snap | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/parser/python.lalrpop b/parser/python.lalrpop index 0bee50d..9e6dd98 100644 --- a/parser/python.lalrpop +++ b/parser/python.lalrpop @@ -767,10 +767,10 @@ NamedExpressionTest: ast::Expr = { } NamedExpression: ast::Expr = { - ":=" > => { + ":=" > => { ast::Expr { location, - end_location: Some(end_location), + end_location: value.end_location, custom: (), node: ast::ExprKind::NamedExpr { target: Box::new(ast::Expr::new( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap index 68d212a..64ddb63 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap @@ -37,7 +37,7 @@ expression: parse_ast end_location: Some( Location { row: 1, - column: 8, + column: 4, }, ), custom: (), diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap index 3bbe6c1..639bf21 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap @@ -36,7 +36,7 @@ Located { end_location: Some( Location { row: 1, - column: 11, + column: 2, }, ), custom: (), diff --git a/parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap b/parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap index 33cd37c..bee9138 100644 --- a/parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap +++ b/parser/src/snapshots/rustpython_parser__with__tests__with_statement.snap @@ -1616,7 +1616,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 19, - column: 12, + column: 7, }, ), custom: (), @@ -1704,7 +1704,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 20, - column: 12, + column: 7, }, ), custom: (), @@ -1824,7 +1824,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 21, - column: 12, + column: 7, }, ), custom: (), @@ -1875,7 +1875,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 21, - column: 20, + column: 15, }, ), custom: (), @@ -1981,7 +1981,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 22, - column: 12, + column: 7, }, ), custom: (), @@ -2032,7 +2032,7 @@ expression: "parse_program(source, \"\").unwrap()" end_location: Some( Location { row: 22, - column: 20, + column: 15, }, ), custom: (),