mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-28 14:25:43 +00:00
Avoid removing elements from the beginning of a vec (#69)
This commit is contained in:
parent
d23611db65
commit
5493c9f4e3
2 changed files with 9 additions and 9 deletions
|
@ -114,11 +114,11 @@ ExpressionStatement: ast::Stmt = {
|
||||||
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
|
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
|
||||||
let mut values = suffix;
|
let mut values = suffix;
|
||||||
|
|
||||||
while values.len() > 1 {
|
let value = Box::new(values.pop().unwrap());
|
||||||
targets.push(set_context(values.remove(0), ast::ExprContext::Store));
|
|
||||||
}
|
|
||||||
|
|
||||||
let value = Box::new(values.into_iter().next().unwrap());
|
for target in values {
|
||||||
|
targets.push(set_context(target, ast::ExprContext::Store));
|
||||||
|
}
|
||||||
|
|
||||||
ast::Stmt::Assign(
|
ast::Stmt::Assign(
|
||||||
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }
|
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }
|
||||||
|
|
10
parser/src/python.rs
generated
10
parser/src/python.rs
generated
|
@ -1,5 +1,5 @@
|
||||||
// auto-generated: "lalrpop 0.20.0"
|
// auto-generated: "lalrpop 0.20.0"
|
||||||
// sha3: a33e9abb4be2a3730161519ce0f298452edbc50335b9e0c812d5a1730f1d8816
|
// sha3: 978b442f9e59b7597dbf53a952a1528232a8ad35ee3a9c9cae78d3d3234a5abe
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::{self as ast, Ranged},
|
ast::{self as ast, Ranged},
|
||||||
lexer::{LexicalError, LexicalErrorType},
|
lexer::{LexicalError, LexicalErrorType},
|
||||||
|
@ -28915,11 +28915,11 @@ fn __action24<
|
||||||
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
|
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
|
||||||
let mut values = suffix;
|
let mut values = suffix;
|
||||||
|
|
||||||
while values.len() > 1 {
|
let value = Box::new(values.pop().unwrap());
|
||||||
targets.push(set_context(values.remove(0), ast::ExprContext::Store));
|
|
||||||
}
|
|
||||||
|
|
||||||
let value = Box::new(values.into_iter().next().unwrap());
|
for target in values {
|
||||||
|
targets.push(set_context(target, ast::ExprContext::Store));
|
||||||
|
}
|
||||||
|
|
||||||
ast::Stmt::Assign(
|
ast::Stmt::Assign(
|
||||||
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }
|
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue