diff options
author | Nadrieril | 2020-04-06 21:33:45 +0100 |
---|---|---|
committer | Nadrieril | 2020-04-06 21:33:45 +0100 |
commit | cd3b11cc8bd7c4397071d1d3b4b9020b7d5ff2ad (patch) | |
tree | a8702e2789d1694390aa1ea460fbe62312ccba5f /dhall/src/semantics/nze/nir.rs | |
parent | 4ed17cb88df732d3ce3d09e2bfd0b7c855309094 (diff) |
Only need to store OpKind in Nir
Diffstat (limited to 'dhall/src/semantics/nze/nir.rs')
-rw-r--r-- | dhall/src/semantics/nze/nir.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/dhall/src/semantics/nze/nir.rs b/dhall/src/semantics/nze/nir.rs index 0dff105..88123d8 100644 --- a/dhall/src/semantics/nze/nir.rs +++ b/dhall/src/semantics/nze/nir.rs @@ -74,25 +74,27 @@ pub enum NirKind { Var(NzVar), Const(Const), + Num(NumKind), // Must be a number type, Bool or Text BuiltinType(Builtin), - Num(NumKind), - OptionalType(Nir), + TextLit(TextLit), EmptyOptionalLit(Nir), NEOptionalLit(Nir), - ListType(Nir), + OptionalType(Nir), // EmptyListLit(t) means `[] : List t`, not `[] : t` EmptyListLit(Nir), NEListLit(Vec<Nir>), - RecordType(HashMap<Label, Nir>), + ListType(Nir), RecordLit(HashMap<Label, Nir>), - UnionType(HashMap<Label, Option<Nir>>), + RecordType(HashMap<Label, Nir>), UnionConstructor(Label, HashMap<Label, Option<Nir>>), UnionLit(Label, Nir, HashMap<Label, Option<Nir>>), - TextLit(TextLit), + UnionType(HashMap<Label, Option<Nir>>), Equivalence(Nir, Nir), - /// Invariant: evaluation must not be able to progress with `normalize_one_layer`. - PartialExpr(ExprKind<Nir>), + Assert(Nir), + /// Invariant: evaluation must not be able to progress with `normalize_operation`. + /// This is used when an operation couldn't proceed further, for example because of variables. + Op(OpKind<Nir>), } impl Nir { @@ -258,7 +260,8 @@ impl Nir { x.to_hir(venv), y.to_hir(venv), )), - NirKind::PartialExpr(e) => e.map_ref(|v| v.to_hir(venv)), + NirKind::Assert(x) => ExprKind::Assert(x.to_hir(venv)), + NirKind::Op(e) => ExprKind::Op(e.map_ref(|v| v.to_hir(venv))), }), }; |