Track call arguments in a single list (#5125)

* Initial implementation of ordered call args

* Run cargo fmt

* Fix some clippy lints

* Add positional len and nth

* Cargo fmt

* Remove more old nth calls

* Good ole rustfmt

* Add named len

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
This commit is contained in:
Hristo Filaretov
2022-04-09 04:55:02 +02:00
committed by GitHub
parent 3bac480ca0
commit 683b912263
25 changed files with 263 additions and 190 deletions

View File

@ -133,12 +133,12 @@ impl Expression {
Expr::Binary(_) => false,
Expr::Bool(_) => false,
Expr::Call(call) => {
for positional in &call.positional {
for positional in call.positional_iter() {
if positional.has_in_variable(working_set) {
return true;
}
}
for named in &call.named {
for named in call.named_iter() {
if let Some(expr) = &named.1 {
if expr.has_in_variable(working_set) {
return true;
@ -302,10 +302,10 @@ impl Expression {
Expr::Binary(_) => {}
Expr::Bool(_) => {}
Expr::Call(call) => {
for positional in &mut call.positional {
for positional in call.positional_iter_mut() {
positional.replace_in_variable(working_set, new_var_id);
}
for named in &mut call.named {
for named in call.named_iter_mut() {
if let Some(expr) = &mut named.1 {
expr.replace_in_variable(working_set, new_var_id)
}
@ -449,10 +449,10 @@ impl Expression {
if replaced.contains_span(call.head) {
call.head = new_span;
}
for positional in &mut call.positional {
for positional in call.positional_iter_mut() {
positional.replace_span(working_set, replaced, new_span);
}
for named in &mut call.named {
for named in call.named_iter_mut() {
if let Some(expr) = &mut named.1 {
expr.replace_span(working_set, replaced, new_span)
}