nac3core: format, fix clippy warning

escape-analysis
ychenfo 2022-01-09 01:05:17 +08:00
parent 4a65d82db5
commit 1ee857de6a
5 changed files with 7 additions and 13 deletions

View File

@ -448,7 +448,8 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>(
if let Some(obj) = &obj {
args.insert(0, FuncArg { name: "self".into(), ty: obj.0, default_value: None });
}
let params = args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty).into()).collect_vec();
let params =
args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty).into()).collect_vec();
let fun_ty = if ctx.unifier.unioned(fun.0.ret, ctx.primitives.none) {
ctx.ctx.void_type().fn_type(&params, false)
} else {

View File

@ -1,13 +1,10 @@
use super::CodeGenContext;
use inkwell::{
context::Context,
attributes::AttributeLoc,
memory_buffer::MemoryBuffer,
module::Module,
attributes::AttributeLoc, context::Context, memory_buffer::MemoryBuffer, module::Module,
values::IntValue,
};
pub fn load_irrt<'ctx>(ctx: &'ctx Context) -> Module<'ctx> {
pub fn load_irrt(ctx: &Context) -> Module {
let bitcode_buf = MemoryBuffer::create_from_memory_range(
include_bytes!(concat!(env!("OUT_DIR"), "/irrt.bc")),
"irrt_bitcode_buffer",
@ -19,7 +16,7 @@ pub fn load_irrt<'ctx>(ctx: &'ctx Context) -> Module<'ctx> {
let function = irrt_mod.get_function(symbol).unwrap();
function.add_attribute(AttributeLoc::Function, ctx.create_enum_attribute(1, 0));
}
return irrt_mod;
irrt_mod
}
// repeated squaring method adapted from GNU Scientific Library:

View File

@ -1,10 +1,7 @@
use super::{
super::symbol_resolver::ValueEnum, expr::destructure_range, CodeGenContext, CodeGenerator,
};
use crate::{
codegen::expr::gen_binop_expr,
typecheck::typedef::Type,
};
use crate::{codegen::expr::gen_binop_expr, typecheck::typedef::Type};
use inkwell::{
types::BasicTypeEnum,
values::{BasicValue, BasicValueEnum, PointerValue},

View File

@ -688,7 +688,7 @@ impl<'a> Inferencer<'a> {
location: args[0].location,
custom,
node: ExprKind::Constant {
value: ast::Constant::Int(val.clone()),
value: ast::Constant::Int(*val),
kind: kind.clone(),
},
});

View File

@ -1,5 +1,4 @@
use std::env;
use libloading;
static mut NOW: i64 = 0;