refactor(tvix/eval): explicitly construct attrs in phases

This makes the phases of attribute set construction that Nix has very
explicit (inherits, static keys, dynamic keys).

This change focuses on the split between dynamic/static keys by
collecting all dynamic ones while compiling the static ones, and then
phasing them in afterwards. It's possible we also need to do some
additional splitting inside of the inherits.

Change-Id: Icae782e2a5c106e3ce0831dda47ed81c923c0a42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6530
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-12 00:41:18 +03:00 committed by tazjin
parent 4b1fb8868d
commit 6cc9d298aa
2 changed files with 101 additions and 32 deletions

View file

@ -1257,6 +1257,7 @@ impl Compiler<'_, '_> {
/// Convert the provided `ast::Attr` into a statically known
/// string if possible.
// TODO(tazjin): these should probably be SmolStr
fn expr_static_attr_str(&self, node: &ast::Attr) -> Option<String> {
match node {
ast::Attr::Ident(ident) => Some(ident.ident_token().unwrap().text().into()),