feat(tvix/eval): Support builtins.lessThan
Extend and export the `cmp_op`, and this becomes trivial. Change-Id: I9c93fa4db0f5a1fc8b56928ea144676f79247de1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6557 Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
		
							parent
							
								
									9e16d70809
								
							
						
					
					
						commit
						890bbf9b1f
					
				
					 4 changed files with 41 additions and 13 deletions
				
			
		|  | @ -16,7 +16,7 @@ use crate::{ | |||
|     vm::VM, | ||||
| }; | ||||
| 
 | ||||
| use crate::arithmetic_op; | ||||
| use crate::{arithmetic_op, cmp_op}; | ||||
| 
 | ||||
| use self::versions::{VersionPart, VersionPartsIter}; | ||||
| 
 | ||||
|  | @ -160,6 +160,11 @@ fn pure_builtins() -> Vec<Builtin> { | |||
|                 .map(|list| Value::List(NixList::from(list))) | ||||
|                 .map_err(Into::into) | ||||
|         }), | ||||
|         Builtin::new( | ||||
|             "lessThan", | ||||
|             &[false, false], | ||||
|             |args, vm| cmp_op!(&*args[0].force(vm)?, &*args[1].force(vm)?, <), | ||||
|         ), | ||||
|         Builtin::new("hasAttr", &[true, true], |args, _| { | ||||
|             let k = args[0].to_str()?; | ||||
|             let xs = args[1].to_attrs()?; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue