From 142a13ad3f77c0ad1bd321d1a1f864a5117896d1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Sep 2019 14:28:12 +0200 Subject: Fix import func call build --- src/compiler.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/compiler.c') diff --git a/src/compiler.c b/src/compiler.c index 7fd4426..4d43329 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -57,6 +57,7 @@ static CHECK_RESULT int create_default_type_fixed_size(amal_compiler *compiler, } static CHECK_RESULT int init_default_types(amal_compiler *compiler) { + /* POD */ return_if_error(create_default_type_fixed_size(compiler, "i8", 1, &compiler->default_types.i8)); return_if_error(create_default_type_fixed_size(compiler, "i16", 2, &compiler->default_types.i16)); return_if_error(create_default_type_fixed_size(compiler, "i32", 4, &compiler->default_types.i32)); @@ -69,9 +70,19 @@ static CHECK_RESULT int init_default_types(amal_compiler *compiler) { return_if_error(create_default_type_num_pointers(compiler, "usize", 1, &compiler->default_types.usize)); return_if_error(create_default_type_fixed_size(compiler, "f32", 4, &compiler->default_types.f32)); return_if_error(create_default_type_fixed_size(compiler, "f64", 8, &compiler->default_types.f64)); + return_if_error(create_default_type_fixed_size(compiler, "bool", 1, &compiler->default_types.bool)); + /* TODO: str should be a struct with the fields @data (ptr) and @size (usize) */ + /* Types with more than one member */ return_if_error(create_default_type_num_pointers(compiler, "str", 1, &compiler->default_types.str)); + /* C types */ + return_if_error(create_default_type_fixed_size(compiler, "c_char", sizeof(char), &compiler->default_types.c_char)); + return_if_error(create_default_type_fixed_size(compiler, "c_short", sizeof(short), &compiler->default_types.c_short)); + return_if_error(create_default_type_fixed_size(compiler, "c_int", sizeof(int), &compiler->default_types.c_int)); + return_if_error(create_default_type_fixed_size(compiler, "c_long", sizeof(long), &compiler->default_types.c_long)); + return_if_error(create_default_type_num_pointers(compiler, "c_void", 0, &compiler->default_types.c_void)); + compiler->default_types.arithmetic_types[0] = compiler->default_types.i8; compiler->default_types.arithmetic_types[1] = compiler->default_types.u8; compiler->default_types.arithmetic_types[2] = compiler->default_types.i16; -- cgit v1.2.3