Fix a bunch of warnings

This commit is contained in:
Sofia 2025-07-27 18:11:18 +03:00
parent ab94bd7df0
commit 46668b7099
11 changed files with 16 additions and 38 deletions

View File

@ -1,7 +1,7 @@
use std::path::PathBuf;
use crate::{
ast::{self, FunctionCallExpression},
ast::{self},
mir::{
self, CustomTypeKey, ModuleMap, NamedVariableRef, ReturnKind, SourceModuleId, StmtKind, StructField,
StructType, WhileStatement,

View File

@ -5,9 +5,7 @@ use reid_lib::{
Block,
};
use mir::{
CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, SourceModuleId, TypeKind, WhileStatement,
};
use mir::{CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
use crate::mir;
@ -18,17 +16,10 @@ pub struct Allocator {
pub struct AllocatorScope<'ctx, 'a> {
pub(super) block: &'a mut Block<'ctx>,
pub(super) module_id: SourceModuleId,
pub(super) type_values: &'a HashMap<CustomTypeKey, TypeValue>,
}
impl Allocator {
pub fn empty() -> Allocator {
Allocator {
allocations: Vec::new(),
}
}
pub fn from(
func: &FunctionDefinitionKind,
params: &Vec<(String, TypeKind)>,
@ -183,7 +174,11 @@ impl mir::Expression {
mir::ExprKind::CastTo(expression, _) => {
allocated.extend(expression.allocate(scope));
}
mir::ExprKind::AssociatedFunctionCall(type_kind, function_call) => todo!(),
mir::ExprKind::AssociatedFunctionCall(_, FunctionCall { parameters, .. }) => {
for param in parameters {
allocated.extend(param.allocate(scope));
}
}
}
allocated

View File

@ -1,5 +1,3 @@
use std::marker::PhantomData;
use reid_lib::{builder::InstructionValue, CmpPredicate, Instr};
use crate::{

View File

@ -227,7 +227,7 @@ impl mir::Module {
parameters: (binop.lhs.clone(), binop.rhs.clone()),
return_ty: binop.return_type.clone(),
kind: match &binop.fn_kind {
FunctionDefinitionKind::Local(block, metadata) => {
FunctionDefinitionKind::Local(..) => {
let ir_function = module.function(
&binop_fn_name,
binop.return_type.get_type(&type_values),
@ -246,7 +246,6 @@ impl mir::Module {
&vec![binop.lhs.clone(), binop.rhs.clone()],
&mut AllocatorScope {
block: &mut entry,
module_id: self.module_id,
type_values: &type_values,
},
);
@ -320,7 +319,6 @@ impl mir::Module {
&mir_function.parameters,
&mut AllocatorScope {
block: &mut entry,
module_id: self.module_id,
type_values: &type_values,
},
);

View File

@ -2,7 +2,7 @@ use std::fmt::{Debug, Display, Write};
use crate::pad_adapter::PadAdapter;
use super::{typecheck::typerefs::TypeRefs, *};
use super::*;
impl Display for Context {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

View File

@ -1,6 +1,6 @@
use crate::util::maybe;
use super::{pass::ScopeBinopDef, typecheck::typerefs::TypeRefs, *};
use super::{typecheck::typerefs::TypeRefs, *};
#[derive(Debug, Clone)]
pub enum ReturnTypeOther {

View File

@ -8,7 +8,6 @@ use std::{
};
use crate::{
codegen::scope,
compile_module,
error_raporting::{ErrorModules, ReidError},
mir::{
@ -254,7 +253,7 @@ impl<'map> Pass for LinkerPass<'map> {
binop.exported = true;
already_imported_binops.insert(binop_key);
match &binop.fn_kind {
FunctionDefinitionKind::Local(block, metadata) => {
FunctionDefinitionKind::Local(..) => {
importer_module.binop_defs.push(BinopDefinition {
lhs: binop.lhs.clone(),
op: binop.op,

View File

@ -170,7 +170,7 @@ impl TypeKind {
return self.clone();
}
match (self, other) {
(TypeKind::Vague(Vague::Unknown), other) | (other, TypeKind::Vague(Vague::Unknown)) => {
(TypeKind::Vague(Vague::Unknown), _) | (_, TypeKind::Vague(Vague::Unknown)) => {
TypeKind::Vague(VagueType::Unknown)
}
(TypeKind::Vague(Vague::Integer), other) | (other, TypeKind::Vague(Vague::Integer)) => match other {

View File

@ -20,7 +20,7 @@ use crate::{
use super::{
super::{
pass::{BinopKey, Pass, PassResult, PassState},
pass::{BinopKey, Pass, PassResult},
TypeKind::*,
VagueType::*,
},

View File

@ -4,15 +4,9 @@ use std::{
rc::Rc,
};
use crate::{
ast::BinopDefinition,
mir::{pass::BinopMap, BinaryOperator, TypeKind, VagueType},
};
use crate::mir::{pass::BinopMap, BinaryOperator, TypeKind, VagueType};
use super::{
super::pass::{BinopKey, ScopeBinopDef, Storage},
ErrorKind,
};
use super::{super::pass::ScopeBinopDef, ErrorKind};
#[derive(Clone)]
pub struct TypeRef<'scope>(pub(super) TypeIdRef, pub(super) &'scope ScopeTypeRefs<'scope>);

View File

@ -1,10 +1,4 @@
use std::{
alloc::System,
path::PathBuf,
process::Command,
thread,
time::{Duration, SystemTime},
};
use std::{path::PathBuf, process::Command, time::SystemTime};
use reid::{
compile_module,