fix(tvix/eval): declare locals before marking them initialised

This has no effect yet, other than changing the way in which some
upvalue captures break (that are already not working correctly).

However, after this change the compiler correctly detects
self-recursion and can start emitting the instructions to deal with
this at runtime.

Change-Id: Id3b0ac206c0204739597a4325bcc66f9c806c242
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6309
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-08-27 19:37:02 +03:00 committed by tazjin
parent 4bf096ee6e
commit 83aa5917b4

View file

@ -833,9 +833,9 @@ impl Compiler {
todo!("nested bindings in let expressions :(")
}
self.compile(entry.value().unwrap());
let name = path.pop().unwrap();
self.declare_local(entry.attrpath().unwrap().syntax().clone(), &name);
self.compile(entry.value().unwrap());
self.mark_initialised(&name);
}