nac3core: format, fix clippy warning

This commit is contained in:
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 { if let Some(obj) = &obj {
args.insert(0, FuncArg { name: "self".into(), ty: obj.0, default_value: None }); 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) { let fun_ty = if ctx.unifier.unioned(fun.0.ret, ctx.primitives.none) {
ctx.ctx.void_type().fn_type(&params, false) ctx.ctx.void_type().fn_type(&params, false)
} else { } else {

View File

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

View File

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

View File

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

View File

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