diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-24T13·24+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-02T12·59+0000 |
commit | b41960c55efd8e9e95ac67681ea21c1b22bbcd99 (patch) | |
tree | 729c1714900ab5f2717841e497f94cb7317d686f | |
parent | b8ac62d5fc269301fd601645065fe38e19fedbf5 (diff) |
feat(tvix/eval): add builtins.isNull r/4590
Change-Id: Iae251d41b4ac6b77df56078a954ec3e33b7f9ccf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6256 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 62bfd145c0a9..b5e8bb289b0e 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -17,6 +17,11 @@ macro_rules! builtin { pub fn global_builtins() -> HashMap<&'static str, Value> { let mut globals = HashMap::new(); + builtin!(globals, "isNull", 1, |args| Ok(Value::Bool(matches!( + args[0], + Value::Null + )))); + builtin!(globals, "toString", 1, |args| { // TODO: toString is actually not the same as Display Ok(Value::String(format!("{}", args[0]).into())) |