about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-11-25T10·18-0800
committerclbot <clbot@tvl.fyi>2022-11-26T11·57+0000
commit5f52c97a3abe84d155e030891dc258ff25b3c2a7 (patch)
tree48db4ddf20b878e0356025f528c63955c0577d91 /tvix/eval/src
parentb79822a105deea18dcd8da65b60a4ffa576d7c21 (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/eval/src')
-rw-r--r--tvix/eval/src/builtins/mod.rs24
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,