summaryrefslogtreecommitdiff
path: root/src/eval/methods.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-17 11:32:15 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-17 11:45:57 +0100
commit312197b276748e1a17258ad21837850f582a467c (patch)
tree3fd0c078a2673a98b74bc12b4d654a4c143b4e1f /src/eval/methods.rs
parente8435df5ec718e8ecc8a2ad48e4eb3ddd1f92a72 (diff)
Counters
Diffstat (limited to 'src/eval/methods.rs')
-rw-r--r--src/eval/methods.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/eval/methods.rs b/src/eval/methods.rs
index 197a2f65..a449ac16 100644
--- a/src/eval/methods.rs
+++ b/src/eval/methods.rs
@@ -134,6 +134,14 @@ pub fn call(
_ => return missing(),
},
+ Value::Dyn(dynamic) => {
+ if dynamic.type_name() == "counter" {
+ return (vm.items.counter_method)(&dynamic, method, args, span);
+ }
+
+ return missing();
+ }
+
_ => return missing(),
};
@@ -281,6 +289,13 @@ pub fn methods_on(type_name: &str) -> &[(&'static str, bool)] {
],
"function" => &[("where", true), ("with", true)],
"arguments" => &[("named", false), ("pos", false)],
+ "counter" => &[
+ ("get", true),
+ ("final", true),
+ ("both", true),
+ ("step", true),
+ ("update", true),
+ ],
_ => &[],
}
}