feat(tvix/eval): mock builtins.unsafeGetAttrPos
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
This commit is contained in:
		
							parent
							
								
									b79822a105
								
							
						
					
					
						commit
						5f52c97a3a
					
				
					 1 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -981,6 +981,30 @@ fn placeholders() -> Vec<Builtin> {
 | 
			
		|||
                Ok(args.pop().unwrap())
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
        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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue