about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/interpreter/builtins.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-01-17T09·13+0300
committertazjin <mail@tazj.in>2021-01-17T09·34+0000
commitf8b3e2a100fdb28cad24948703439d2964c31580 (patch)
treefdd7b13f4a359532f6acaa183d78e7d777f5c32d /users/tazjin/rlox/src/interpreter/builtins.rs
parent052f8976bb3273d16fb0e1c4643de5abcaf0f135 (diff)
refactor(tazjin/rlox): Move treewalk interpreter into subdirectory r/2120
Change-Id: I9163f75db5a1ff75e1b1f81bad78fd9d8ddb104a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2409
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/rlox/src/interpreter/builtins.rs')
-rw-r--r--users/tazjin/rlox/src/interpreter/builtins.rs25
1 files changed, 0 insertions, 25 deletions
diff --git a/users/tazjin/rlox/src/interpreter/builtins.rs b/users/tazjin/rlox/src/interpreter/builtins.rs
deleted file mode 100644
index 6ed9f07c3ffa..000000000000
--- a/users/tazjin/rlox/src/interpreter/builtins.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use std::fmt;
-use std::time::{SystemTime, UNIX_EPOCH};
-
-use crate::errors::Error;
-use crate::interpreter::Value;
-use crate::parser::Literal;
-
-pub trait Builtin: fmt::Debug {
-    fn arity(&self) -> usize;
-    fn call(&self, args: Vec<Value>) -> Result<Value, Error>;
-}
-
-// Builtin to return the current timestamp.
-#[derive(Debug)]
-pub struct Clock {}
-impl Builtin for Clock {
-    fn arity(&self) -> usize {
-        0
-    }
-
-    fn call(&self, _args: Vec<Value>) -> Result<Value, Error> {
-        let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
-        Ok(Value::Literal(Literal::Number(now.as_secs() as f64)))
-    }
-}