This commit is contained in:
Edgar 2024-02-09 09:19:50 +01:00
parent 3b840937b6
commit 2616132766
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387
4 changed files with 12 additions and 12 deletions

View file

@ -33,13 +33,13 @@ struct ModuleCompileCtx<'ctx, 'm> {
di_builder: DebugInfoBuilder<'ctx>, di_builder: DebugInfoBuilder<'ctx>,
di_unit: DICompileUnit<'ctx>, di_unit: DICompileUnit<'ctx>,
target_data: TargetData, target_data: TargetData,
module_id: DefId, _module_id: DefId,
di_namespace: DIScope<'ctx>, di_namespace: DIScope<'ctx>,
} }
impl<'ctx, 'm> ModuleCompileCtx<'ctx, 'm> { impl<'ctx, 'm> ModuleCompileCtx<'ctx, 'm> {
pub fn get_module_body(&self) -> &ModuleBody { pub fn _get_module_body(&self) -> &ModuleBody {
self.ctx.program.modules.get(&self.module_id).unwrap() self.ctx.program.modules.get(&self._module_id).unwrap()
} }
pub fn set_debug_loc(&self, scope: DIScope<'ctx>, span: Span) -> DILocation<'ctx> { pub fn set_debug_loc(&self, scope: DIScope<'ctx>, span: Span) -> DILocation<'ctx> {
@ -122,7 +122,7 @@ pub fn compile(session: &Session, program: &ProgramBody) -> Result<PathBuf, Box<
di_unit, di_unit,
builder: &builder, builder: &builder,
target_data: machine.get_target_data(), target_data: machine.get_target_data(),
module_id: *module_id, _module_id: *module_id,
di_namespace, di_namespace,
}; };
@ -248,7 +248,7 @@ fn compile_fn(ctx: &ModuleCompileCtx, fn_id: DefId) -> Result<(), BuilderError>
let di_program = fn_value.get_subprogram().unwrap(); let di_program = fn_value.get_subprogram().unwrap();
let mut debug_loc = ctx.set_debug_loc(di_program.as_debug_info_scope(), body.fn_span); let mut debug_loc = ctx.set_debug_loc(di_program.as_debug_info_scope(), body.fn_span);
let mut lexical_block = ctx.di_builder.create_lexical_block( let lexical_block = ctx.di_builder.create_lexical_block(
debug_loc.get_scope(), debug_loc.get_scope(),
ctx.di_unit.get_file(), ctx.di_unit.get_file(),
debug_loc.get_line(), debug_loc.get_line(),
@ -911,7 +911,7 @@ fn compile_value<'ctx>(
}) })
} }
fn compile_type<'a>( fn _compile_type<'a>(
ctx: &'a ModuleCompileCtx, ctx: &'a ModuleCompileCtx,
ty: &ir::TypeInfo, ty: &ir::TypeInfo,
) -> inkwell::types::AnyTypeEnum<'a> { ) -> inkwell::types::AnyTypeEnum<'a> {

View file

@ -70,7 +70,7 @@ impl BodyBuilder {
id id
} }
pub fn add_temp_local(&mut self, ty_kind: TypeKind) -> usize { pub fn _add_temp_local(&mut self, ty_kind: TypeKind) -> usize {
let id = self.body.locals.len(); let id = self.body.locals.len();
self.body.locals.push(Local::temp(TypeInfo { self.body.locals.push(Local::temp(TypeInfo {
span: None, span: None,
@ -79,7 +79,7 @@ impl BodyBuilder {
id id
} }
pub fn get_local(&self, name: &str) -> Option<&Local> { pub fn _get_local(&self, name: &str) -> Option<&Local> {
self.body.locals.get(*(self.name_to_local.get(name)?)) self.body.locals.get(*(self.name_to_local.get(name)?))
} }

View file

@ -1,12 +1,12 @@
use std::collections::HashMap; use std::collections::HashMap;
use ast::ModuleStatement; use ast::ModuleStatement;
use common::{BodyBuilder, BuildCtx, IdGenerator}; use common::{BodyBuilder, BuildCtx};
use edlang_ast as ast; use edlang_ast as ast;
use edlang_ir as ir; use edlang_ir as ir;
use ir::{ use ir::{
BasicBlock, Body, ConstData, ConstKind, DefId, Local, LocalKind, Operand, Place, ProgramBody, BasicBlock, Body, DefId, Local, LocalKind, Operand, Place, ProgramBody, Statement,
RValue, Statement, StatementKind, Terminator, TypeInfo, TypeKind, StatementKind, Terminator, TypeInfo, TypeKind,
}; };
mod common; mod common;

View file

@ -125,6 +125,6 @@ mod test {
#[test] #[test]
fn test_ident() { fn test_ident() {
parse_ast("hello"); parse_ast("hello").unwrap();
} }
} }