Adding len() builtin and TYPE_SLICE

This commit is contained in:
Krzosa Karol
2022-06-14 09:33:46 +02:00
parent 1a6d2598a3
commit f189ca381e
6 changed files with 65 additions and 19 deletions

View File

@@ -5,9 +5,9 @@ test_types(){
parse_init(&ctx, scratch, scratch);
pctx = &ctx;
Ast_Type *array_type1 = type_array(type_s64, 1, 32);
Ast_Type *array_type2 = type_array(type_s64, 1, 32);
Ast_Type *array_type3 = type_array(type_s64, 1, 48);
Ast_Type *array_type1 = type_array(type_s64, 32);
Ast_Type *array_type2 = type_array(type_s64, 32);
Ast_Type *array_type3 = type_array(type_s64, 48);
assert(array_type1 == array_type2);
assert(array_type2 != array_type3);
Ast_Type *pointer_type1 = type_pointer(type_s64);
@@ -19,14 +19,14 @@ test_types(){
assert(pointer_type3 == pointer_type4);
Array<Ast_Type*> types = {scratch};
types.add(type_array(type_s64, 1, 32));
types.add(type_array(type_s64, 32));
Ast_Type *func_type1 = type_lambda(0, types[0], types);
Ast_Type *func_type2 = type_lambda(0, types[0], types);
assert(func_type1 == func_type2);
Array<Ast_Type*> types2 = {scratch};
{
types2.add(type_array(type_s64, 1, 32));
types2.add(type_array(type_s64, 32));
types2.add(type_s64);
}
types.add(type_s64);