feat(tvix/eval): implement hasContext primop

`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>
This commit is contained in:
Ryan Lahfa 2023-12-25 22:06:52 +01:00 committed by clbot
parent 5dfb15d2c8
commit 343ee0de57
2 changed files with 4 additions and 5 deletions

View file

@ -64,7 +64,7 @@ The `impl` column indicates implementation status in tvix:
| getContext | false | | | context |
| getEnv | false | | false | |
| hasAttr | false | | | |
| hasContext | false | | | context |
| hasContext | false | | | |
| hashFile | false | | false | todo |
| hashString | false | | | todo |
| head | false | | | |

View file

@ -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")]