From 04e0c136df3c5c158e0097027dbf29468fbda697 Mon Sep 17 00:00:00 2001 From: sofia Date: Sat, 12 Jul 2025 14:42:05 +0300 Subject: [PATCH] Fix warnings --- reid-llvm-lib/src/builder.rs | 2 -- reid/src/codegen.rs | 1 - reid/src/mir/pass.rs | 32 ++++++++++++++++++-------------- reid/src/mir/typecheck.rs | 1 - 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/reid-llvm-lib/src/builder.rs b/reid-llvm-lib/src/builder.rs index 62648a1..d08c97b 100644 --- a/reid-llvm-lib/src/builder.rs +++ b/reid-llvm-lib/src/builder.rs @@ -3,8 +3,6 @@ use std::{cell::RefCell, rc::Rc}; -use llvm_sys::core::{LLVMBuildAlloca, LLVMBuildLoad2, LLVMBuildStore}; - use crate::{ BlockData, ConstValue, FunctionData, Instr, InstructionData, ModuleData, TerminatorKind, Type, util::match_types, diff --git a/reid/src/codegen.rs b/reid/src/codegen.rs index a26e748..a56cfb4 100644 --- a/reid/src/codegen.rs +++ b/reid/src/codegen.rs @@ -1,6 +1,5 @@ use std::{collections::HashMap, mem}; -use llvm_sys::core::LLVMBuildStore; use reid_lib::{ builder::InstructionValue, Block, CmpPredicate, ConstValue, Context, Function, Instr, Module, TerminatorKind as Term, Type, diff --git a/reid/src/mir/pass.rs b/reid/src/mir/pass.rs index d89810b..5bbc756 100644 --- a/reid/src/mir/pass.rs +++ b/reid/src/mir/pass.rs @@ -268,10 +268,12 @@ impl Block { impl Statement { fn pass(&mut self, pass: &mut T, state: &mut State, scope: &mut Scope) { match &mut self.0 { - StmtKind::Let(_, mutable, expression) => { + StmtKind::Let(_, _, expression) => { + expression.pass(pass, state, scope); + } + StmtKind::Set(_, expression) => { expression.pass(pass, state, scope); } - StmtKind::Set(variable_reference, expression) => {} // TODO StmtKind::Import(_) => todo!(), StmtKind::Expression(expression) => { expression.pass(pass, state, scope); @@ -281,19 +283,21 @@ impl Statement { pass.stmt(self, PassState::from(state, scope)); match &mut self.0 { - StmtKind::Let(variable_reference, mutable, _) => scope - .variables - .set( - variable_reference.1.clone(), - ScopeVariable { - ty: variable_reference.0, - mutable: *mutable, - }, - ) - .ok(), - StmtKind::Set(variable_reference, expression) => None, // TODO + StmtKind::Let(variable_reference, mutable, _) => { + scope + .variables + .set( + variable_reference.1.clone(), + ScopeVariable { + ty: variable_reference.0, + mutable: *mutable, + }, + ) + .ok(); + } + StmtKind::Set(_, _) => {} StmtKind::Import(_) => todo!(), - StmtKind::Expression(_) => None, + StmtKind::Expression(_) => {} }; } } diff --git a/reid/src/mir/typecheck.rs b/reid/src/mir/typecheck.rs index dab0cba..2cbbaee 100644 --- a/reid/src/mir/typecheck.rs +++ b/reid/src/mir/typecheck.rs @@ -101,7 +101,6 @@ impl Block { for statement in &mut self.statements { let ret = match &mut statement.0 { - // TODO StmtKind::Let(variable_reference, mutable, expression) => { let res = expression.typecheck(&mut state, Some(variable_reference.0));