Fix a bunch of warnings
This commit is contained in:
parent
ab94bd7df0
commit
46668b7099
@ -1,7 +1,7 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::{self, FunctionCallExpression},
|
ast::{self},
|
||||||
mir::{
|
mir::{
|
||||||
self, CustomTypeKey, ModuleMap, NamedVariableRef, ReturnKind, SourceModuleId, StmtKind, StructField,
|
self, CustomTypeKey, ModuleMap, NamedVariableRef, ReturnKind, SourceModuleId, StmtKind, StructField,
|
||||||
StructType, WhileStatement,
|
StructType, WhileStatement,
|
||||||
|
@ -5,9 +5,7 @@ use reid_lib::{
|
|||||||
Block,
|
Block,
|
||||||
};
|
};
|
||||||
|
|
||||||
use mir::{
|
use mir::{CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
|
||||||
CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, SourceModuleId, TypeKind, WhileStatement,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::mir;
|
use crate::mir;
|
||||||
|
|
||||||
@ -18,17 +16,10 @@ pub struct Allocator {
|
|||||||
|
|
||||||
pub struct AllocatorScope<'ctx, 'a> {
|
pub struct AllocatorScope<'ctx, 'a> {
|
||||||
pub(super) block: &'a mut Block<'ctx>,
|
pub(super) block: &'a mut Block<'ctx>,
|
||||||
pub(super) module_id: SourceModuleId,
|
|
||||||
pub(super) type_values: &'a HashMap<CustomTypeKey, TypeValue>,
|
pub(super) type_values: &'a HashMap<CustomTypeKey, TypeValue>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Allocator {
|
impl Allocator {
|
||||||
pub fn empty() -> Allocator {
|
|
||||||
Allocator {
|
|
||||||
allocations: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from(
|
pub fn from(
|
||||||
func: &FunctionDefinitionKind,
|
func: &FunctionDefinitionKind,
|
||||||
params: &Vec<(String, TypeKind)>,
|
params: &Vec<(String, TypeKind)>,
|
||||||
@ -183,7 +174,11 @@ impl mir::Expression {
|
|||||||
mir::ExprKind::CastTo(expression, _) => {
|
mir::ExprKind::CastTo(expression, _) => {
|
||||||
allocated.extend(expression.allocate(scope));
|
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
|
allocated
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use reid_lib::{builder::InstructionValue, CmpPredicate, Instr};
|
use reid_lib::{builder::InstructionValue, CmpPredicate, Instr};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -227,7 +227,7 @@ impl mir::Module {
|
|||||||
parameters: (binop.lhs.clone(), binop.rhs.clone()),
|
parameters: (binop.lhs.clone(), binop.rhs.clone()),
|
||||||
return_ty: binop.return_type.clone(),
|
return_ty: binop.return_type.clone(),
|
||||||
kind: match &binop.fn_kind {
|
kind: match &binop.fn_kind {
|
||||||
FunctionDefinitionKind::Local(block, metadata) => {
|
FunctionDefinitionKind::Local(..) => {
|
||||||
let ir_function = module.function(
|
let ir_function = module.function(
|
||||||
&binop_fn_name,
|
&binop_fn_name,
|
||||||
binop.return_type.get_type(&type_values),
|
binop.return_type.get_type(&type_values),
|
||||||
@ -246,7 +246,6 @@ impl mir::Module {
|
|||||||
&vec![binop.lhs.clone(), binop.rhs.clone()],
|
&vec![binop.lhs.clone(), binop.rhs.clone()],
|
||||||
&mut AllocatorScope {
|
&mut AllocatorScope {
|
||||||
block: &mut entry,
|
block: &mut entry,
|
||||||
module_id: self.module_id,
|
|
||||||
type_values: &type_values,
|
type_values: &type_values,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -320,7 +319,6 @@ impl mir::Module {
|
|||||||
&mir_function.parameters,
|
&mir_function.parameters,
|
||||||
&mut AllocatorScope {
|
&mut AllocatorScope {
|
||||||
block: &mut entry,
|
block: &mut entry,
|
||||||
module_id: self.module_id,
|
|
||||||
type_values: &type_values,
|
type_values: &type_values,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -2,7 +2,7 @@ use std::fmt::{Debug, Display, Write};
|
|||||||
|
|
||||||
use crate::pad_adapter::PadAdapter;
|
use crate::pad_adapter::PadAdapter;
|
||||||
|
|
||||||
use super::{typecheck::typerefs::TypeRefs, *};
|
use super::*;
|
||||||
|
|
||||||
impl Display for Context {
|
impl Display for Context {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::util::maybe;
|
use crate::util::maybe;
|
||||||
|
|
||||||
use super::{pass::ScopeBinopDef, typecheck::typerefs::TypeRefs, *};
|
use super::{typecheck::typerefs::TypeRefs, *};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ReturnTypeOther {
|
pub enum ReturnTypeOther {
|
||||||
|
@ -8,7 +8,6 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
codegen::scope,
|
|
||||||
compile_module,
|
compile_module,
|
||||||
error_raporting::{ErrorModules, ReidError},
|
error_raporting::{ErrorModules, ReidError},
|
||||||
mir::{
|
mir::{
|
||||||
@ -254,7 +253,7 @@ impl<'map> Pass for LinkerPass<'map> {
|
|||||||
binop.exported = true;
|
binop.exported = true;
|
||||||
already_imported_binops.insert(binop_key);
|
already_imported_binops.insert(binop_key);
|
||||||
match &binop.fn_kind {
|
match &binop.fn_kind {
|
||||||
FunctionDefinitionKind::Local(block, metadata) => {
|
FunctionDefinitionKind::Local(..) => {
|
||||||
importer_module.binop_defs.push(BinopDefinition {
|
importer_module.binop_defs.push(BinopDefinition {
|
||||||
lhs: binop.lhs.clone(),
|
lhs: binop.lhs.clone(),
|
||||||
op: binop.op,
|
op: binop.op,
|
||||||
|
@ -170,7 +170,7 @@ impl TypeKind {
|
|||||||
return self.clone();
|
return self.clone();
|
||||||
}
|
}
|
||||||
match (self, other) {
|
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(VagueType::Unknown)
|
||||||
}
|
}
|
||||||
(TypeKind::Vague(Vague::Integer), other) | (other, TypeKind::Vague(Vague::Integer)) => match other {
|
(TypeKind::Vague(Vague::Integer), other) | (other, TypeKind::Vague(Vague::Integer)) => match other {
|
||||||
|
@ -20,7 +20,7 @@ use crate::{
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::{
|
super::{
|
||||||
pass::{BinopKey, Pass, PassResult, PassState},
|
pass::{BinopKey, Pass, PassResult},
|
||||||
TypeKind::*,
|
TypeKind::*,
|
||||||
VagueType::*,
|
VagueType::*,
|
||||||
},
|
},
|
||||||
|
@ -4,15 +4,9 @@ use std::{
|
|||||||
rc::Rc,
|
rc::Rc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::mir::{pass::BinopMap, BinaryOperator, TypeKind, VagueType};
|
||||||
ast::BinopDefinition,
|
|
||||||
mir::{pass::BinopMap, BinaryOperator, TypeKind, VagueType},
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::{
|
use super::{super::pass::ScopeBinopDef, ErrorKind};
|
||||||
super::pass::{BinopKey, ScopeBinopDef, Storage},
|
|
||||||
ErrorKind,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TypeRef<'scope>(pub(super) TypeIdRef, pub(super) &'scope ScopeTypeRefs<'scope>);
|
pub struct TypeRef<'scope>(pub(super) TypeIdRef, pub(super) &'scope ScopeTypeRefs<'scope>);
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
use std::{
|
use std::{path::PathBuf, process::Command, time::SystemTime};
|
||||||
alloc::System,
|
|
||||||
path::PathBuf,
|
|
||||||
process::Command,
|
|
||||||
thread,
|
|
||||||
time::{Duration, SystemTime},
|
|
||||||
};
|
|
||||||
|
|
||||||
use reid::{
|
use reid::{
|
||||||
compile_module,
|
compile_module,
|
||||||
|
Loading…
Reference in New Issue
Block a user