Fix loads of warnings
This commit is contained in:
parent
67106ea17b
commit
c84954480b
@ -1,8 +1,7 @@
|
|||||||
use std::{collections::HashMap, fmt::format, hash::Hash, path::PathBuf};
|
use std::{collections::HashMap, hash::Hash, path::PathBuf};
|
||||||
|
|
||||||
use reid::{
|
use reid::{
|
||||||
ast::{
|
ast::{
|
||||||
self, FunctionDefinition,
|
|
||||||
lexer::{FullToken, Token},
|
lexer::{FullToken, Token},
|
||||||
token_stream::TokenRange,
|
token_stream::TokenRange,
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! This is the module that contains relevant code to parsing Reid, that is to
|
//! This is the module that contains relevant code to parsing Reid, that is to
|
||||||
//! say transforming a Vec of FullTokens into a loose parsed AST that can be
|
//! say transforming a Vec of FullTokens into a loose parsed AST that can be
|
||||||
//! used for unwrapping syntax sugar, and then be transformed into Reid MIR.
|
//! used for unwrapping syntax sugar, and then be transformed into Reid MIR.
|
||||||
use std::{fs::Metadata, path::PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use token_stream::TokenRange;
|
use token_stream::TokenRange;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use reid_lib::{
|
|||||||
Block, Instr,
|
Block, Instr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use mir::{CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
|
use mir::{CustomTypeKey, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement};
|
||||||
|
|
||||||
use crate::mir::{self, FunctionParam, Metadata, SourceModuleId};
|
use crate::mir::{self, FunctionParam, Metadata, SourceModuleId};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ impl mir::Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for module in &modules_sorted {
|
for module in &modules_sorted {
|
||||||
let codegen = module.codegen(context, modules.clone())?;
|
module.codegen(context, modules.clone())?;
|
||||||
}
|
}
|
||||||
Ok(CodegenContext { context })
|
Ok(CodegenContext { context })
|
||||||
}
|
}
|
||||||
@ -75,7 +75,6 @@ impl mir::Context {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct ModuleCodegen<'ctx> {
|
struct ModuleCodegen<'ctx> {
|
||||||
name: String,
|
|
||||||
module: Module<'ctx>,
|
module: Module<'ctx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,10 +595,7 @@ impl mir::Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ModuleCodegen {
|
Ok(ModuleCodegen { module })
|
||||||
name: self.name.clone(),
|
|
||||||
module,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{allocator::Allocator, ErrorKind, IntrinsicFunction, ModuleCodegen};
|
use super::{allocator::Allocator, ErrorKind, IntrinsicFunction};
|
||||||
|
|
||||||
pub struct Scope<'ctx, 'scope> {
|
pub struct Scope<'ctx, 'scope> {
|
||||||
pub(super) context: &'ctx Context,
|
pub(super) context: &'ctx Context,
|
||||||
|
@ -14,10 +14,7 @@ use crate::{
|
|||||||
mir::{self, CustomTypeKey, Metadata, SourceModuleId, TypeDefinition, TypeDefinitionKind, TypeKind, VagueLiteral},
|
mir::{self, CustomTypeKey, Metadata, SourceModuleId, TypeDefinition, TypeDefinitionKind, TypeKind, VagueLiteral},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::scope::{Debug, Scope};
|
||||||
scope::{Debug, Scope},
|
|
||||||
ModuleCodegen,
|
|
||||||
};
|
|
||||||
|
|
||||||
impl mir::CmpOperator {
|
impl mir::CmpOperator {
|
||||||
pub(super) fn predicate(&self) -> CmpPredicate {
|
pub(super) fn predicate(&self) -> CmpPredicate {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use reid_lib::builder::TypeValue;
|
|
||||||
|
|
||||||
use crate::util::maybe;
|
use crate::util::maybe;
|
||||||
|
|
||||||
use super::{typecheck::typerefs::TypeRefs, *};
|
use super::{typecheck::typerefs::TypeRefs, *};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::{
|
use std::{
|
||||||
cell::{RefCell, RefMut},
|
cell::RefCell,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
fs::{self},
|
fs::{self},
|
||||||
hash::Hash,
|
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
};
|
};
|
||||||
@ -12,8 +11,8 @@ use crate::{
|
|||||||
compile_module,
|
compile_module,
|
||||||
error_raporting::{ErrorModules, ReidError},
|
error_raporting::{ErrorModules, ReidError},
|
||||||
mir::{
|
mir::{
|
||||||
pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, FunctionParam, SourceModuleId,
|
pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, SourceModuleId, StructType,
|
||||||
StructType, TypeDefinition, TypeDefinitionKind, TypeKind,
|
TypeDefinition, TypeDefinitionKind, TypeKind,
|
||||||
},
|
},
|
||||||
parse_module,
|
parse_module,
|
||||||
};
|
};
|
||||||
|
@ -177,12 +177,7 @@ impl mir::Expression {
|
|||||||
globals.extend(expression.gen_macros(data, state, map));
|
globals.extend(expression.gen_macros(data, state, map));
|
||||||
globals.extend(expression1.gen_macros(data, state, map));
|
globals.extend(expression1.gen_macros(data, state, map));
|
||||||
}
|
}
|
||||||
mir::ExprKind::AssociatedFunctionCall(
|
mir::ExprKind::AssociatedFunctionCall(_, FunctionCall { parameters, .. }) => {
|
||||||
_,
|
|
||||||
FunctionCall {
|
|
||||||
parameters, is_macro, ..
|
|
||||||
},
|
|
||||||
) => {
|
|
||||||
for expression in parameters {
|
for expression in parameters {
|
||||||
globals.extend(expression.gen_macros(data, state, map));
|
globals.extend(expression.gen_macros(data, state, map));
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ impl<'t> Pass for TypeCheck<'t> {
|
|||||||
fn check_typedefs_for_recursion<'a, 'b>(
|
fn check_typedefs_for_recursion<'a, 'b>(
|
||||||
defmap: &'b HashMap<&'a String, &'b TypeDefinition>,
|
defmap: &'b HashMap<&'a String, &'b TypeDefinition>,
|
||||||
typedef: &'b TypeDefinition,
|
typedef: &'b TypeDefinition,
|
||||||
mut seen: HashSet<String>,
|
seen: HashSet<String>,
|
||||||
state: &mut TypecheckPassState,
|
state: &mut TypecheckPassState,
|
||||||
) {
|
) {
|
||||||
match &typedef.kind {
|
match &typedef.kind {
|
||||||
@ -194,7 +194,7 @@ impl FunctionDefinitionKind {
|
|||||||
block.typecheck(&mut state.inner(), &typerefs, hint.into())
|
block.typecheck(&mut state.inner(), &typerefs, hint.into())
|
||||||
}
|
}
|
||||||
FunctionDefinitionKind::Extern(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
|
FunctionDefinitionKind::Extern(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
|
||||||
FunctionDefinitionKind::Intrinsic(intrinsic) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
|
FunctionDefinitionKind::Intrinsic(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -771,7 +771,7 @@ impl Expression {
|
|||||||
Ok(function_call.return_type.clone().resolve_ref(typerefs))
|
Ok(function_call.return_type.clone().resolve_ref(typerefs))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExprKind::GlobalRef(global_value, type_kind) => Ok(self
|
ExprKind::GlobalRef(..) => Ok(self
|
||||||
.return_type(typerefs, state.scope.module_id.unwrap())
|
.return_type(typerefs, state.scope.module_id.unwrap())
|
||||||
.map(|r| r.1)
|
.map(|r| r.1)
|
||||||
.unwrap()),
|
.unwrap()),
|
||||||
|
@ -14,8 +14,8 @@ use crate::{
|
|||||||
mir::{
|
mir::{
|
||||||
implement::TypeCategory,
|
implement::TypeCategory,
|
||||||
pass::{AssociatedFunctionKey, ScopeVariable},
|
pass::{AssociatedFunctionKey, ScopeVariable},
|
||||||
BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind,
|
BinopDefinition, Block, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, IfExpression, Module,
|
||||||
IfExpression, Module, ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement,
|
ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement,
|
||||||
},
|
},
|
||||||
util::try_all,
|
util::try_all,
|
||||||
};
|
};
|
||||||
@ -685,7 +685,7 @@ impl Expression {
|
|||||||
// Provide function return type
|
// Provide function return type
|
||||||
Ok(type_refs.from_type(&fn_call.ret).unwrap())
|
Ok(type_refs.from_type(&fn_call.ret).unwrap())
|
||||||
}
|
}
|
||||||
ExprKind::GlobalRef(global_value, type_kind) => Ok(self
|
ExprKind::GlobalRef(..) => Ok(self
|
||||||
.return_type(type_refs.types, state.scope.module_id.unwrap())
|
.return_type(type_refs.types, state.scope.module_id.unwrap())
|
||||||
.map(|r| type_refs.from_type(&r.1).unwrap())
|
.map(|r| type_refs.from_type(&r.1).unwrap())
|
||||||
.unwrap()),
|
.unwrap()),
|
||||||
|
Loading…
Reference in New Issue
Block a user