about summary refs log tree commit diff
path: root/tvix/eval/src/compiler/scope.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-06T14·12+0300
committertazjin <tazjin@tvl.su>2022-09-11T12·04+0000
commit12acb1e2374ac0f5480cfbb262f2171d6df2918b (patch)
treed8386d3eeff92e2bfb7ff93d19806dfcf7b8f8bb /tvix/eval/src/compiler/scope.rs
parent9da99af86045b59867e6082ca99d602308553006 (diff)
refactor(tvix/eval): add `initialised` arg to declare_phantom r/4795
There are more upcomming uses of declare_phantom where this will come
in handy to avoid some code bloat.

Change-Id: I75cad8caf14511c519ab2f56e87e99bcbf0a082e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6467
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/compiler/scope.rs')
-rw-r--r--tvix/eval/src/compiler/scope.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs
index 7c1e65265e1d..ca8512d409c8 100644
--- a/tvix/eval/src/compiler/scope.rs
+++ b/tvix/eval/src/compiler/scope.rs
@@ -234,13 +234,13 @@ impl Scope {
     /// Declare a local variable that occupies a stack slot and should
     /// be accounted for, but is not directly accessible by users
     /// (e.g. attribute sets used for `with`).
-    pub fn declare_phantom(&mut self, span: codemap::Span) -> LocalIdx {
+    pub fn declare_phantom(&mut self, span: codemap::Span, initialised: bool) -> LocalIdx {
         let idx = self.locals.len();
         self.locals.push(Local {
-            name: LocalName::Phantom,
+            initialised,
             span,
+            name: LocalName::Phantom,
             depth: self.scope_depth,
-            initialised: false,
             needs_finaliser: false,
             used: true,
         });