From c010cbc17dcbb2f0d6005d21530143bf57cb5871 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 25 May 2022 13:50:33 +0200 Subject: Move route from context to VM --- src/eval/array.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/eval/array.rs') diff --git a/src/eval/array.rs b/src/eval/array.rs index 86347106..840c0aef 100644 --- a/src/eval/array.rs +++ b/src/eval/array.rs @@ -3,11 +3,10 @@ use std::fmt::{self, Debug, Formatter, Write}; use std::ops::{Add, AddAssign}; use std::sync::Arc; -use super::{ops, Args, Func, Value}; +use super::{ops, Args, Func, Machine, Value}; use crate::diag::{At, StrResult, TypResult}; use crate::syntax::Spanned; use crate::util::ArcExt; -use crate::Context; /// Create a new [`Array`] from values. #[allow(unused_macros)] @@ -120,21 +119,21 @@ impl Array { } /// Transform each item in the array with a function. - pub fn map(&self, ctx: &mut Context, f: Spanned) -> TypResult { + pub fn map(&self, vm: &mut Machine, f: Spanned) -> TypResult { Ok(self .iter() .cloned() - .map(|item| f.v.call(ctx, Args::from_values(f.span, [item]))) + .map(|item| f.v.call(vm, Args::new(f.span, [item]))) .collect::>()?) } /// Return a new array with only those elements for which the function /// return true. - pub fn filter(&self, ctx: &mut Context, f: Spanned) -> TypResult { + pub fn filter(&self, vm: &mut Machine, f: Spanned) -> TypResult { let mut kept = vec![]; for item in self.iter() { if f.v - .call(ctx, Args::from_values(f.span, [item.clone()]))? + .call(vm, Args::new(f.span, [item.clone()]))? .cast::() .at(f.span)? { -- cgit v1.2.3