From bc2dd82eb7b1379f9a5f39a6a6db2170974a2bd6 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 17 Nov 2024 21:25:22 +0100 Subject: [PATCH] welp --- lang/src/son.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index faafea46..7f7b2673 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -3894,7 +3894,8 @@ impl<'a> Codegen<'a> { self.ci.ctrl.get() }; - self.close_if(lcntrl, rcntrl, then_scope) + self.close_if(lcntrl, rcntrl, then_scope)?; + Some(Value::VOID) } Expr::Match { pos, value, branches } => { let value = self.expr(value)?; @@ -3983,9 +3984,9 @@ impl<'a> Codegen<'a> { for (lcntrl, then_scope) in scopes.into_iter().rev() { if let Some(v) = self.close_if(lcntrl, rcntrl, then_scope) - && v.id != VOID + && v != VOID { - rcntrl = v.id; + rcntrl = v; } } @@ -4002,18 +4003,18 @@ impl<'a> Codegen<'a> { } } - fn close_if(&mut self, lcntrl: Nid, rcntrl: Nid, mut then_scope: Scope) -> Option { + fn close_if(&mut self, lcntrl: Nid, rcntrl: Nid, mut then_scope: Scope) -> Option { if lcntrl == Nid::MAX && rcntrl == Nid::MAX { then_scope.clear(&mut self.ci.nodes); return None; } else if lcntrl == Nid::MAX { then_scope.clear(&mut self.ci.nodes); - return Some(Value::VOID); + return Some(VOID); } else if rcntrl == Nid::MAX { self.ci.scope.clear(&mut self.ci.nodes); self.ci.scope = then_scope; self.ci.ctrl.set(lcntrl, &mut self.ci.nodes); - return Some(Value::VOID); + return Some(VOID); } self.ci.ctrl.set( @@ -4029,7 +4030,7 @@ impl<'a> Codegen<'a> { self.tys, ); then_scope.clear(&mut self.ci.nodes); - Some(Value::new(self.ci.ctrl.get()).ty(ty::Id::VOID)) + Some(self.ci.ctrl.get()) } fn gen_enum_variant(&mut self, pos: Pos, e: ty::Enum, intrnd: Option) -> Option {