diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-16 18:14:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-16 18:14:58 +0200 |
| commit | cb0aab3cfab2122a87d1d221290f7178b4291758 (patch) | |
| tree | 65c1562be490d4cb87c6419e8c773e00de401f65 /src/eval/function.rs | |
| parent | ba6b91e2ee9dfa729d21879f27773de7c7731cfe (diff) | |
Change how functions are called
Diffstat (limited to 'src/eval/function.rs')
| -rw-r--r-- | src/eval/function.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/eval/function.rs b/src/eval/function.rs index f18af05e..85608ca1 100644 --- a/src/eval/function.rs +++ b/src/eval/function.rs @@ -1,5 +1,4 @@ use std::fmt::{self, Debug, Display, Formatter, Write}; -use std::ops::Deref; use std::rc::Rc; use super::{Cast, EvalContext, Str, Value}; @@ -34,13 +33,10 @@ impl Function { pub fn name(&self) -> Option<&EcoString> { self.repr.name.as_ref() } -} - -impl Deref for Function { - type Target = Func; - fn deref(&self) -> &Self::Target { - &self.repr.func + /// Call the function in the context with the arguments. + pub fn call(&self, ctx: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { + (&self.repr.func)(ctx, args) } } |
