Add experimental atom op tables for llvm-backend

This commit is contained in:
gingerBill
2020-05-02 18:45:57 +01:00
parent ba4363d678
commit e27f5796d6
11 changed files with 552 additions and 14 deletions
+14 -1
View File
@@ -329,12 +329,25 @@ void add_polymorphic_record_entity(CheckerContext *ctx, Ast *node, Type *named_t
auto *found_gen_types = map_get(&ctx->checker->info.gen_types, hash_pointer(original_type));
if (found_gen_types) {
array_add(found_gen_types, e);
array_add(found_gen_types, e);
} else {
auto array = array_make<Entity *>(heap_allocator());
array_add(&array, e);
map_set(&ctx->checker->info.gen_types, hash_pointer(original_type), array);
}
{
Type *dst_bt = base_type(named_type);
Type *src_bt = base_type(original_type);
if ((dst_bt != nullptr && src_bt != nullptr) &&
(dst_bt->kind == src_bt->kind)){
if (dst_bt->kind == Type_Struct) {
if (dst_bt->Struct.atom_op_table == nullptr) {
dst_bt->Struct.atom_op_table = src_bt->Struct.atom_op_table;
}
}
}
}
}
void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *node, Array<Operand> *poly_operands, Type *named_type, Type *original_type_for_poly) {