about summary refs log tree commit diff
path: root/tvix/eval/src/compiler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/compiler.rs')
-rw-r--r--tvix/eval/src/compiler.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index c840056b48f3..a0c62b112869 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -32,6 +32,30 @@ pub struct CompilationResult {
     pub warnings: Vec<EvalWarning>,
 }
 
+// Represents a single local already known to the compiler.
+struct Local {
+    // Definition name, which can be different kinds of tokens (plain
+    // string or identifier). Nix does not allow dynamic names inside
+    // of `let`-expressions.
+    name: rnix::SyntaxNode,
+
+    // Scope depth of this local.
+    depth: usize,
+}
+
+/// Represents locals known during compilation, which can be resolved
+/// directly to stack indices.
+///
+/// TODO(tazjin): `with`-stack
+/// TODO(tazjin): flag "specials" (e.g. note depth if builtins are
+/// overridden)
+struct Locals {
+    locals: Vec<Local>,
+
+    // How many scopes "deep" are these locals?
+    scope_depth: usize,
+}
+
 struct Compiler {
     chunk: Chunk,
     warnings: Vec<EvalWarning>,