about summary refs log tree commit diff
path: root/tvix/eval/src/value/string.rs
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-10-13T03·27-0400
committertazjin <tazjin@tvl.su>2022-10-17T11·29+0000
commite63d14419f5cc2ea1f0d9e9221062c2c8d40fe31 (patch)
tree8212cd200cb60f58f141ba74f693185b10a26c6d /tvix/eval/src/value/string.rs
parent89dbcbbb3d292c612056ed75a35a78ebd6fae3e1 (diff)
feat(tvix/eval): Record formals on lambda r/5153
In preparation for both implementing the `functionArgs` builtin and
adding support for validating closed formals, record information about
the formal arguments to a function *on the Lambda itself*. This may seem
a little odd for the purposes of just closed formal checking, but is
something we have to have anyway for builtins.functionArgs so I figured
I'd do it this way to kill both birds with one stone.

Change-Id: Ie3770a607bf352a1eb395c79ca29bb25d5978cd8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7001
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value/string.rs')
-rw-r--r--tvix/eval/src/value/string.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs
index d146ee4cec95..4caef653f2cc 100644
--- a/tvix/eval/src/value/string.rs
+++ b/tvix/eval/src/value/string.rs
@@ -1,5 +1,6 @@
 //! This module implements Nix language strings and their different
 //! backing implementations.
+use rnix::ast;
 use smol_str::SmolStr;
 use std::ffi::OsStr;
 use std::hash::Hash;
@@ -55,6 +56,12 @@ impl From<SmolStr> for NixString {
     }
 }
 
+impl From<ast::Ident> for NixString {
+    fn from(ident: ast::Ident) -> Self {
+        ident.ident_token().unwrap().text().into()
+    }
+}
+
 impl Hash for NixString {
     fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
         self.as_str().hash(state)