summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/nze
diff options
context:
space:
mode:
authorNadrieril2020-01-24 18:38:30 +0000
committerNadrieril2020-01-24 20:44:53 +0000
commita24f2d1367b2848779014c7bb3ecfe6bfbcff7d7 (patch)
tree6d3c9cdbaaa93a1521198912e97c8878c9681da8 /dhall/src/semantics/nze
parent0d4e033c7ca301f03453210fdef345bdf8018892 (diff)
Fix some variable shifting failures
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/nze/nzexpr.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/dhall/src/semantics/nze/nzexpr.rs b/dhall/src/semantics/nze/nzexpr.rs
index 723c895..49aa704 100644
--- a/dhall/src/semantics/nze/nzexpr.rs
+++ b/dhall/src/semantics/nze/nzexpr.rs
@@ -217,6 +217,9 @@ impl QuoteEnv {
pub fn new() -> Self {
QuoteEnv { size: 0 }
}
+ pub fn construct(size: usize) -> Self {
+ QuoteEnv { size }
+ }
pub fn insert(&self) -> Self {
QuoteEnv {
size: self.size + 1,
@@ -231,6 +234,11 @@ impl NzVar {
pub fn new(idx: usize) -> Self {
NzVar { idx }
}
+ pub fn shift(&self, delta: isize) -> Self {
+ NzVar {
+ idx: (self.idx as isize + delta) as usize,
+ }
+ }
}
impl TyExpr {