diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-11-25T10·18-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-11-26T11·57+0000 |
commit | 5f52c97a3abe84d155e030891dc258ff25b3c2a7 (patch) | |
tree | 48db4ddf20b878e0356025f528c63955c0577d91 /tvix | |
parent | b79822a105deea18dcd8da65b60a4ffa576d7c21 (diff) |
feat(tvix/eval): mock builtins.unsafeGetAttrPos r/5327
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I9d986dd8c0aad4e67df01bda13cee443e0fc0d20 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7415 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 7c4f40479bc2..b2344a422e63 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -982,6 +982,30 @@ fn placeholders() -> Vec<Builtin> { }, ), Builtin::new( + "unsafeGetAttrPos", + &[ + BuiltinArgument { + strict: true, + name: "name", + }, + BuiltinArgument { + strict: true, + name: "attrset", + }, + ], + None, + |mut args: Vec<Value>, vm: &mut VM| { + vm.emit_warning(WarningKind::NotImplemented("builtins.unsafeGetAttrsPos")); + let _attrset = args.pop().unwrap().to_attrs(); + let _name = args.pop().unwrap().to_str(); + let mut res: BTreeMap<NixString, Value> = BTreeMap::new(); + res.insert("line".into(), 42.into()); + res.insert("col".into(), 42.into()); + res.insert("file".into(), Value::Path("/deep/thought".into())); + Ok(Value::attrs(NixAttrs::from_map(res))) + }, + ), + Builtin::new( "derivation", &[BuiltinArgument { strict: true, |