diff --git a/lang/src/son.rs b/lang/src/son.rs index faafea4..7f7b267 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 {