about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorRyan Lahfa <tvl@lahfa.xyz>2023-12-25T21·06+0100
committerclbot <clbot@tvl.fyi>2023-12-29T21·58+0000
commit343ee0de57c4d44e6f4ac725eca7e7c4c34eab0d (patch)
tree792e04b9d935192ae5da880e0ee236bd96a6d96a /tvix/eval/src
parent5dfb15d2c8d323979af33027a33f49244a6c892f (diff)
feat(tvix/eval): implement `hasContext` primop r/7281
`hasContext` is now functional.

Change-Id: I23b128afc9150b833bc0d9b042d31fee35badadb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10422
Tested-by: BuildkiteCI
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/builtins/mod.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 341ee6096924..a79199339c13 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -551,10 +551,9 @@ mod pure_builtins {
 
     #[builtin("hasContext")]
     #[allow(non_snake_case)]
-    async fn builtin_hasContext(_co: GenCo, #[lazy] _e: Value) -> Result<Value, ErrorKind> {
-        Ok(Value::Catchable(CatchableErrorKind::UnimplementedFeature(
-            "hasContext".to_string(),
-        )))
+    async fn builtin_hasContext(co: GenCo, e: Value) -> Result<Value, ErrorKind> {
+        let v = e.to_str()?;
+        Ok(Value::Bool(v.has_context()))
     }
 
     #[builtin("hashString")]