From 0cd0a0adc87c5a9ef4937edf2e0b087fbddd4577 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 29 Aug 2022 19:47:02 -0400 Subject: [PATCH] Add expression context parsing --- parser/python.lalrpop | 17 +- parser/src/context.rs | 177 ++++++++++++++++++ parser/src/lib.rs | 1 + ...rser__context__tests__ann_assign_name.snap | 48 +++-- ...python_parser__context__tests__assign.snap | 42 +++++ ...ser__context__tests__assign_attribute.snap | 86 +++++---- ...on_parser__context__tests__assign_for.snap | 84 +++++---- ...n_parser__context__tests__assign_list.snap | 96 ++++++---- ...ser__context__tests__assign_list_comp.snap | 108 ++++++----- ...n_parser__context__tests__assign_name.snap | 72 ++++--- ...er__context__tests__assign_named_expr.snap | 60 +++--- ...rser__context__tests__assign_set_comp.snap | 108 ++++++----- ...arser__context__tests__assign_starred.snap | 108 ++++++----- ...ser__context__tests__assign_subscript.snap | 98 ++++++---- ..._parser__context__tests__assign_tuple.snap | 96 ++++++---- ...n_parser__context__tests__assign_with.snap | 48 +++-- ..._context__tests__aug_assign_attribute.snap | 86 +++++---- ...rser__context__tests__aug_assign_name.snap | 36 ++-- ..._context__tests__aug_assign_subscript.snap | 98 ++++++---- ...parser__context__tests__del_attribute.snap | 38 ++-- ...thon_parser__context__tests__del_name.snap | 24 ++- ...parser__context__tests__del_subscript.snap | 50 ++--- ...rser__tests__parse_dict_comprehension.snap | 2 +- ...ests__parse_double_list_comprehension.snap | 8 +- ..._tests__parse_generator_comprehension.snap | 2 +- ...parse_if_else_generator_comprehension.snap | 2 +- ...rser__tests__parse_list_comprehension.snap | 2 +- ...ed_expression_generator_comprehension.snap | 2 +- ...n_parser__parser__tests__parse_tuples.snap | 6 +- 29 files changed, 1024 insertions(+), 581 deletions(-) create mode 100644 parser/src/context.rs create mode 100644 parser/src/snapshots/rustpython_parser__context__tests__assign.snap diff --git a/parser/python.lalrpop b/parser/python.lalrpop index cf43f0f..310790a 100644 --- a/parser/python.lalrpop +++ b/parser/python.lalrpop @@ -8,6 +8,7 @@ use crate::{ error::{LexicalError, LexicalErrorType}, function::{ArgumentList, parse_args, parse_params}, lexer, + context::set_context, string::parse_strings, token::StringKind }; @@ -82,7 +83,7 @@ DelStatement: ast::Stmt = { location, end_location: Some(end_location), custom: (), - node: ast::StmtKind::Delete { targets }, + node: ast::StmtKind::Delete { targets: targets.into_iter().map(|expr| set_context(expr, ast::ExprContext::Del)).collect() }, } }, }; @@ -98,11 +99,11 @@ ExpressionStatement: ast::Stmt = { node: ast::StmtKind::Expr { value: Box::new(expression) } } } else { - let mut targets = vec![expression]; + let mut targets = vec![set_context(expression, ast::ExprContext::Store)]; let mut values = suffix; while values.len() > 1 { - targets.push(values.remove(0)); + targets.push(set_context(values.remove(0), ast::ExprContext::Store)); } let value = Box::new(values.into_iter().next().unwrap()); @@ -121,7 +122,7 @@ ExpressionStatement: ast::Stmt = { location, end_location: Some(end_location), node: ast::StmtKind::AugAssign { - target: Box::new(target), + target: Box::new(set_context(target, ast::ExprContext::Store)), op, value: Box::new(rhs) }, @@ -134,7 +135,7 @@ ExpressionStatement: ast::Stmt = { location, end_location: Some(end_location), node: ast::StmtKind::AnnAssign { - target: Box::new(target), + target: Box::new(set_context(target, ast::ExprContext::Store)), annotation: Box::new(annotation), value: rhs.map(Box::new), simple: if simple { 1 } else { 0 }, @@ -399,7 +400,7 @@ WhileStatement: ast::Stmt = { ForStatement: ast::Stmt = { "for" "in" ":" => { let orelse = s2.map(|s| s.2).unwrap_or_default(); - let target = Box::new(target); + let target = Box::new(set_context(target, ast::ExprContext::Store)); let iter = Box::new(iter); let type_comment = None; let node = if is_async.is_some() { @@ -484,7 +485,7 @@ WithStatement: ast::Stmt = { WithItem: ast::Withitem = { => { - let optional_vars = n.map(|val| Box::new(val.1)); + let optional_vars = n.map(|val| Box::new(set_context(val.1, ast::ExprContext::Store))); let context_expr = Box::new(context_expr); ast::Withitem { context_expr, optional_vars } }, @@ -1233,7 +1234,7 @@ SingleForComprehension: ast::Comprehension = { "for" "in" => { let is_async = is_async.is_some(); ast::Comprehension { - target: Box::new(target), + target: Box::new(set_context(target, ast::ExprContext::Store)), iter: Box::new(iter), ifs, is_async: if is_async { 1 } else { 0 }, diff --git a/parser/src/context.rs b/parser/src/context.rs new file mode 100644 index 0000000..56fdc35 --- /dev/null +++ b/parser/src/context.rs @@ -0,0 +1,177 @@ +use rustpython_ast::{Expr, ExprContext, ExprKind}; + +pub fn set_context(expr: Expr, ctx: ExprContext) -> Expr { + match expr.node { + ExprKind::Name { id, .. } => Expr { + node: ExprKind::Name { id, ctx }, + ..expr + }, + ExprKind::Tuple { elts, .. } => Expr { + node: ExprKind::Tuple { + elts: elts + .into_iter() + .map(|elt| set_context(elt, ctx.clone())) + .collect(), + ctx, + }, + ..expr + }, + ExprKind::List { elts, .. } => Expr { + node: ExprKind::List { + elts: elts + .into_iter() + .map(|elt| set_context(elt, ctx.clone())) + .collect(), + ctx, + }, + ..expr + }, + ExprKind::Attribute { value, attr, .. } => Expr { + node: ExprKind::Attribute { value, attr, ctx }, + ..expr + }, + ExprKind::Subscript { value, slice, .. } => Expr { + node: ExprKind::Subscript { value, slice, ctx }, + ..expr + }, + ExprKind::Starred { value, .. } => Expr { + node: ExprKind::Starred { + value: Box::new(set_context(*value, ctx.clone())), + ctx, + }, + ..expr + }, + _ => expr, + } +} + +#[cfg(test)] +mod tests { + use crate::parser::parse_program; + + #[test] + fn test_assign_name() { + let source = String::from("x = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_tuple() { + let source = String::from("(x, y) = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_list() { + let source = String::from("[x, y] = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_attribute() { + let source = String::from("x.y = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_subscript() { + let source = String::from("x[y] = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_starred() { + let source = String::from("(x, *y) = (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_for() { + let source = String::from("for x in (1, 2, 3): pass"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_list_comp() { + let source = String::from("x = [y for y in (1, 2, 3)]"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_set_comp() { + let source = String::from("x = {y for y in (1, 2, 3)}"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_with() { + let source = String::from("with 1 as x: pass"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_assign_named_expr() { + let source = String::from("if x:= 1: pass"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_ann_assign_name() { + let source = String::from("x: int = 1"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_aug_assign_name() { + let source = String::from("x += 1"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_aug_assign_attribute() { + let source = String::from("x.y += (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_aug_assign_subscript() { + let source = String::from("x[y] += (1, 2, 3)"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_del_name() { + let source = String::from("del x"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_del_attribute() { + let source = String::from("del x.y"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + + #[test] + fn test_del_subscript() { + let source = String::from("del x[y]"); + let parse_ast = parse_program(&source, "").unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } +} diff --git a/parser/src/lib.rs b/parser/src/lib.rs index f65f736..0bd363a 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -30,5 +30,6 @@ pub mod mode; pub mod parser; #[rustfmt::skip] mod python; +mod context; mod string; pub mod token; diff --git a/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap b/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap index 03b7e43..71888a6 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap @@ -4,25 +4,29 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 11, - }, + end_location: Some( + Location { + row: 1, + column: 11, + }, + ), custom: (), node: AnnAssign { target: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -30,14 +34,16 @@ expression: parse_ast }, }, annotation: Located { - start: Location { + location: Location { row: 1, column: 4, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Name { id: "int", @@ -46,14 +52,16 @@ expression: parse_ast }, value: Some( Located { - start: Location { + location: Location { row: 1, column: 10, }, - end: Location { - row: 1, - column: 11, - }, + end_location: Some( + Location { + row: 1, + column: 11, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign.snap new file mode 100644 index 0000000..a9fe441 --- /dev/null +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign.snap @@ -0,0 +1,42 @@ +--- +source: compiler/parser/src/context.rs +expression: parse_ast +--- +[ + Located { + location: Location { + row: 1, + column: 1, + }, + custom: (), + node: Assign { + targets: [ + Located { + location: Location { + row: 1, + column: 1, + }, + custom: (), + node: Name { + id: "x", + ctx: Store, + }, + }, + ], + value: Located { + location: Location { + row: 1, + column: 5, + }, + custom: (), + node: Constant { + value: Int( + 1, + ), + kind: None, + }, + }, + type_comment: None, + }, + }, +] diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap index 9f3abe1..ff527af 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap @@ -4,37 +4,43 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, - column: 2, - }, - end: Location { - row: 1, - column: 4, + column: 1, }, + end_location: Some( + Location { + row: 1, + column: 4, + }, + ), custom: (), node: Attribute { value: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -47,26 +53,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 8, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 8, }, - end: Location { - row: 1, - column: 9, - }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: Constant { value: Int( @@ -76,14 +86,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 12, - }, + end_location: Some( + Location { + row: 1, + column: 12, + }, + ), custom: (), node: Constant { value: Int( @@ -93,14 +105,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 14, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap index 22d9264..e9bb386 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap @@ -4,25 +4,29 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: For { target: Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "x", @@ -30,26 +34,30 @@ expression: parse_ast }, }, iter: Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 12, - }, + end_location: Some( + Location { + row: 1, + column: 12, + }, + ), custom: (), node: Constant { value: Int( @@ -59,14 +67,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 14, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Constant { value: Int( @@ -76,14 +86,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 17, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Constant { value: Int( @@ -98,14 +110,16 @@ expression: parse_ast }, body: [ Located { - start: Location { + location: Location { row: 1, column: 21, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: Pass, }, diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap index 17abaae..acedc47 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap @@ -4,38 +4,44 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: List { elts: [ Located { - start: Location { + location: Location { row: 1, column: 2, }, - end: Location { - row: 1, - column: 3, - }, + end_location: Some( + Location { + row: 1, + column: 3, + }, + ), custom: (), node: Name { id: "x", @@ -43,14 +49,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "y", @@ -63,26 +71,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 12, - }, + end_location: Some( + Location { + row: 1, + column: 12, + }, + ), custom: (), node: Constant { value: Int( @@ -92,14 +104,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 14, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Constant { value: Int( @@ -109,14 +123,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 17, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap index 929f669..68db2bc 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap @@ -4,26 +4,30 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 27, - }, + end_location: Some( + Location { + row: 1, + column: 27, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -32,25 +36,29 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 27, - }, + end_location: Some( + Location { + row: 1, + column: 27, + }, + ), custom: (), node: ListComp { elt: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Name { id: "y", @@ -60,14 +68,16 @@ expression: parse_ast generators: [ Comprehension { target: Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Name { id: "y", @@ -75,26 +85,30 @@ expression: parse_ast }, }, iter: Located { - start: Location { + location: Location { row: 1, column: 18, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 18, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Constant { value: Int( @@ -104,14 +118,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 21, }, - end: Location { - row: 1, - column: 22, - }, + end_location: Some( + Location { + row: 1, + column: 22, + }, + ), custom: (), node: Constant { value: Int( @@ -121,14 +137,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 24, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap index 614b04a..7db0871 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap @@ -4,26 +4,30 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 14, - }, + end_location: Some( + Location { + row: 1, + column: 14, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -32,26 +36,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Constant { value: Int( @@ -61,14 +69,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 9, }, - end: Location { - row: 1, - column: 10, - }, + end_location: Some( + Location { + row: 1, + column: 10, + }, + ), custom: (), node: Constant { value: Int( @@ -78,14 +88,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Constant { value: Int( 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 7c9559a..cc55850 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 @@ -4,36 +4,42 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: If { test: Located { - start: Location { + location: Location { row: 1, column: 4, }, - end: Location { - row: 1, - column: 9, - }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: NamedExpr { target: Located { - start: Location { + location: Location { row: 1, column: 4, }, - end: Location { - row: 1, - column: 9, - }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: Name { id: "x", @@ -41,14 +47,16 @@ expression: parse_ast }, }, value: Located { - start: Location { + location: Location { row: 1, column: 8, }, - end: Location { - row: 1, - column: 9, - }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: Constant { value: Int( @@ -61,14 +69,16 @@ expression: parse_ast }, body: [ Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Pass, }, diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap index abf7db8..a4b587d 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap @@ -4,26 +4,30 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 27, - }, + end_location: Some( + Location { + row: 1, + column: 27, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -32,25 +36,29 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 27, - }, + end_location: Some( + Location { + row: 1, + column: 27, + }, + ), custom: (), node: SetComp { elt: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Name { id: "y", @@ -60,14 +68,16 @@ expression: parse_ast generators: [ Comprehension { target: Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Name { id: "y", @@ -75,26 +85,30 @@ expression: parse_ast }, }, iter: Located { - start: Location { + location: Location { row: 1, column: 18, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 18, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Constant { value: Int( @@ -104,14 +118,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 21, }, - end: Location { - row: 1, - column: 22, - }, + end_location: Some( + Location { + row: 1, + column: 22, + }, + ), custom: (), node: Constant { value: Int( @@ -121,14 +137,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 24, }, - end: Location { - row: 1, - column: 25, - }, + end_location: Some( + Location { + row: 1, + column: 25, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap index 24c062e..775e47b 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap @@ -4,38 +4,44 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 20, - }, + end_location: Some( + Location { + row: 1, + column: 20, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 2, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 2, }, - end: Location { - row: 1, - column: 3, - }, + end_location: Some( + Location { + row: 1, + column: 3, + }, + ), custom: (), node: Name { id: "x", @@ -43,25 +49,29 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Starred { value: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Name { id: "y", @@ -77,26 +87,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Constant { value: Int( @@ -106,14 +120,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 15, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Constant { value: Int( @@ -123,14 +139,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 18, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap index 7028f2e..707be61 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap @@ -4,37 +4,43 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 17, - }, + end_location: Some( + Location { + row: 1, + column: 17, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, - column: 2, - }, - end: Location { - row: 1, - column: 5, + column: 1, }, + end_location: Some( + Location { + row: 1, + column: 5, + }, + ), custom: (), node: Subscript { value: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -42,14 +48,16 @@ expression: parse_ast }, }, slice: Located { - start: Location { + location: Location { row: 1, column: 3, }, - end: Location { - row: 1, - column: 4, - }, + end_location: Some( + Location { + row: 1, + column: 4, + }, + ), custom: (), node: Name { id: "y", @@ -61,26 +69,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 9, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 9, }, - end: Location { - row: 1, - column: 10, - }, + end_location: Some( + Location { + row: 1, + column: 10, + }, + ), custom: (), node: Constant { value: Int( @@ -90,14 +102,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Constant { value: Int( @@ -107,14 +121,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 15, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap index 0d9a195..08dfed4 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap @@ -4,38 +4,44 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 19, - }, + end_location: Some( + Location { + row: 1, + column: 19, + }, + ), custom: (), node: Assign { targets: [ Located { - start: Location { + location: Location { row: 1, column: 2, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 2, }, - end: Location { - row: 1, - column: 3, - }, + end_location: Some( + Location { + row: 1, + column: 3, + }, + ), custom: (), node: Name { id: "x", @@ -43,14 +49,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "y", @@ -63,26 +71,30 @@ expression: parse_ast }, ], value: Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 12, - }, + end_location: Some( + Location { + row: 1, + column: 12, + }, + ), custom: (), node: Constant { value: Int( @@ -92,14 +104,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 14, }, - end: Location { - row: 1, - column: 15, - }, + end_location: Some( + Location { + row: 1, + column: 15, + }, + ), custom: (), node: Constant { value: Int( @@ -109,14 +123,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 17, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap b/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap index 042d56b..88d1441 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap @@ -4,27 +4,31 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: With { items: [ Withitem { context_expr: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Constant { value: Int( @@ -35,14 +39,16 @@ expression: parse_ast }, optional_vars: Some( Located { - start: Location { + location: Location { row: 1, column: 11, }, - end: Location { - row: 1, - column: 12, - }, + end_location: Some( + Location { + row: 1, + column: 12, + }, + ), custom: (), node: Name { id: "x", @@ -54,14 +60,16 @@ expression: parse_ast ], body: [ Located { - start: Location { + location: Location { row: 1, column: 14, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: Pass, }, diff --git a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap index 1e55a56..ea0d870 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap @@ -4,36 +4,42 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 17, - }, + end_location: Some( + Location { + row: 1, + column: 17, + }, + ), custom: (), node: AugAssign { target: Located { - start: Location { + location: Location { row: 1, - column: 2, - }, - end: Location { - row: 1, - column: 4, + column: 1, }, + end_location: Some( + Location { + row: 1, + column: 4, + }, + ), custom: (), node: Attribute { value: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -46,26 +52,30 @@ expression: parse_ast }, op: Add, value: Located { - start: Location { + location: Location { row: 1, column: 9, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 9, }, - end: Location { - row: 1, - column: 10, - }, + end_location: Some( + Location { + row: 1, + column: 10, + }, + ), custom: (), node: Constant { value: Int( @@ -75,14 +85,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 12, }, - end: Location { - row: 1, - column: 13, - }, + end_location: Some( + Location { + row: 1, + column: 13, + }, + ), custom: (), node: Constant { value: Int( @@ -92,14 +104,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 15, }, - end: Location { - row: 1, - column: 16, - }, + end_location: Some( + Location { + row: 1, + column: 16, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap index 576c613..c11ab23 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap @@ -4,25 +4,29 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: AugAssign { target: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -31,14 +35,16 @@ expression: parse_ast }, op: Add, value: Located { - start: Location { + location: Location { row: 1, column: 6, }, - end: Location { - row: 1, - column: 7, - }, + end_location: Some( + Location { + row: 1, + column: 7, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap index 881f665..0ef667d 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap @@ -4,36 +4,42 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 18, - }, + end_location: Some( + Location { + row: 1, + column: 18, + }, + ), custom: (), node: AugAssign { target: Located { - start: Location { + location: Location { row: 1, - column: 2, - }, - end: Location { - row: 1, - column: 5, + column: 1, }, + end_location: Some( + Location { + row: 1, + column: 5, + }, + ), custom: (), node: Subscript { value: Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 2, - }, + end_location: Some( + Location { + row: 1, + column: 2, + }, + ), custom: (), node: Name { id: "x", @@ -41,14 +47,16 @@ expression: parse_ast }, }, slice: Located { - start: Location { + location: Location { row: 1, column: 3, }, - end: Location { - row: 1, - column: 4, - }, + end_location: Some( + Location { + row: 1, + column: 4, + }, + ), custom: (), node: Name { id: "y", @@ -60,26 +68,30 @@ expression: parse_ast }, op: Add, value: Located { - start: Location { + location: Location { row: 1, column: 10, }, - end: Location { - row: 1, - column: 17, - }, + end_location: Some( + Location { + row: 1, + column: 17, + }, + ), custom: (), node: Tuple { elts: [ Located { - start: Location { + location: Location { row: 1, column: 10, }, - end: Location { - row: 1, - column: 11, - }, + end_location: Some( + Location { + row: 1, + column: 11, + }, + ), custom: (), node: Constant { value: Int( @@ -89,14 +101,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 13, }, - end: Location { - row: 1, - column: 14, - }, + end_location: Some( + Location { + row: 1, + column: 14, + }, + ), custom: (), node: Constant { value: Int( @@ -106,14 +120,16 @@ expression: parse_ast }, }, Located { - start: Location { + location: Location { row: 1, column: 16, }, - end: Location { - row: 1, - column: 17, - }, + end_location: Some( + Location { + row: 1, + column: 17, + }, + ), custom: (), node: Constant { value: Int( diff --git a/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap b/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap index 39e650e..21de28d 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap @@ -4,37 +4,43 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 8, - }, + end_location: Some( + Location { + row: 1, + column: 8, + }, + ), custom: (), node: Delete { targets: [ Located { - start: Location { + location: Location { row: 1, - column: 6, - }, - end: Location { - row: 1, - column: 8, + column: 5, }, + end_location: Some( + Location { + row: 1, + column: 8, + }, + ), custom: (), node: Attribute { value: Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "x", diff --git a/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap b/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap index 396a570..5d8d8e8 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap @@ -4,26 +4,30 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Delete { targets: [ Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "x", diff --git a/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap b/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap index 56da6c4..7a85274 100644 --- a/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap +++ b/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap @@ -4,37 +4,43 @@ expression: parse_ast --- [ Located { - start: Location { + location: Location { row: 1, column: 1, }, - end: Location { - row: 1, - column: 9, - }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: Delete { targets: [ Located { - start: Location { + location: Location { row: 1, - column: 6, - }, - end: Location { - row: 1, - column: 9, + column: 5, }, + end_location: Some( + Location { + row: 1, + column: 9, + }, + ), custom: (), node: Subscript { value: Located { - start: Location { + location: Location { row: 1, column: 5, }, - end: Location { - row: 1, - column: 6, - }, + end_location: Some( + Location { + row: 1, + column: 6, + }, + ), custom: (), node: Name { id: "x", @@ -42,14 +48,16 @@ expression: parse_ast }, }, slice: Located { - start: Location { + location: Location { row: 1, column: 7, }, - end: Location { - row: 1, - column: 8, - }, + end_location: Some( + Location { + row: 1, + column: 8, + }, + ), custom: (), node: Name { id: "y", diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap index a75ccdc..7d5a69f 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap @@ -65,7 +65,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, iter: Located { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap index 3018e3f..9cc392c 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap @@ -62,7 +62,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, Located { @@ -79,11 +79,11 @@ Located { custom: (), node: Name { id: "y2", - ctx: Load, + ctx: Store, }, }, ], - ctx: Load, + ctx: Store, }, }, iter: Located { @@ -121,7 +121,7 @@ Located { custom: (), node: Name { id: "a", - ctx: Load, + ctx: Store, }, }, iter: Located { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap index 0b85a1a..1ceab19 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap @@ -48,7 +48,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, iter: Located { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap index 4505d92..6f8b7c2 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap @@ -97,7 +97,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, iter: Located { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap index d691665..f932e7d 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap @@ -48,7 +48,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, iter: Located { 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 660f0fa..2f534dd 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 @@ -115,7 +115,7 @@ Located { custom: (), node: Name { id: "y", - ctx: Load, + ctx: Store, }, }, iter: Located { diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap index d50b57d..c8e252c 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap @@ -45,7 +45,7 @@ expression: "parse_program(source, \"\").unwrap()" custom: (), node: Name { id: "a", - ctx: Load, + ctx: Store, }, }, Located { @@ -62,11 +62,11 @@ expression: "parse_program(source, \"\").unwrap()" custom: (), node: Name { id: "b", - ctx: Load, + ctx: Store, }, }, ], - ctx: Load, + ctx: Store, }, }, ],