From 8ffb3baa8d35615172c858cf05e77eb06becd9b2 Mon Sep 17 00:00:00 2001 From: sofia Date: Thu, 17 Jul 2025 00:55:11 +0300 Subject: [PATCH] Add Any-mutability for StackValues --- reid/src/codegen.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reid/src/codegen.rs b/reid/src/codegen.rs index 3d9f8b4..234805d 100644 --- a/reid/src/codegen.rs +++ b/reid/src/codegen.rs @@ -65,6 +65,7 @@ pub struct StackValue(StackValueKind, Type); pub enum StackValueKind { Immutable(InstructionValue), Mutable(InstructionValue), + Any(InstructionValue), } impl StackValueKind { @@ -72,6 +73,7 @@ impl StackValueKind { match self { StackValueKind::Immutable(val) => val, StackValueKind::Mutable(val) => val, + StackValueKind::Any(val) => val, } } @@ -79,6 +81,7 @@ impl StackValueKind { match self { StackValueKind::Immutable(_) => StackValueKind::Immutable(instr), StackValueKind::Mutable(_) => StackValueKind::Mutable(instr), + StackValueKind::Any(_) => StackValueKind::Any(instr), } } } @@ -346,6 +349,7 @@ impl mir::Expression { val } } + _ => panic!("Found an unknown-mutable variable!"), }) } mir::ExprKind::Literal(lit) => Some(lit.as_const(&mut scope.block)),