mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Update add_type_info_type to ignore polymorphic types
This commit is contained in:
+11
-1
@@ -1073,6 +1073,9 @@ void add_type_info_type(Checker *c, Type *t) {
|
|||||||
if (is_type_untyped(t)) {
|
if (is_type_untyped(t)) {
|
||||||
return; // Could be nil
|
return; // Could be nil
|
||||||
}
|
}
|
||||||
|
if (is_type_polymorphic(base_type(t))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (map_get(&c->info.type_info_map, hash_type(t)) != nullptr) {
|
if (map_get(&c->info.type_info_map, hash_type(t)) != nullptr) {
|
||||||
// Types have already been added
|
// Types have already been added
|
||||||
@@ -1165,12 +1168,19 @@ void add_type_info_type(Checker *c, Type *t) {
|
|||||||
|
|
||||||
case Type_Union:
|
case Type_Union:
|
||||||
add_type_info_type(c, t_int);
|
add_type_info_type(c, t_int);
|
||||||
|
add_type_info_type(c, t_type_info_ptr);
|
||||||
for_array(i, bt->Union.variants) {
|
for_array(i, bt->Union.variants) {
|
||||||
add_type_info_type(c, bt->Union.variants[i]);
|
add_type_info_type(c, bt->Union.variants[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type_Struct: {
|
case Type_Struct: {
|
||||||
|
if (bt->Struct.scope != nullptr) {
|
||||||
|
for_array(i, bt->Struct.scope->elements.entries) {
|
||||||
|
Entity *e = bt->Struct.scope->elements.entries[i].value;
|
||||||
|
add_type_info_type(c, e->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
for_array(i, bt->Struct.fields) {
|
for_array(i, bt->Struct.fields) {
|
||||||
Entity *f = bt->Struct.fields[i];
|
Entity *f = bt->Struct.fields[i];
|
||||||
add_type_info_type(c, f->type);
|
add_type_info_type(c, f->type);
|
||||||
@@ -2391,7 +2401,7 @@ void check_parsed_files(Checker *c) {
|
|||||||
// i64 size = type_size_of(c->sizes, c->allocator, e->type);
|
// i64 size = type_size_of(c->sizes, c->allocator, e->type);
|
||||||
i64 align = type_align_of(c->allocator, e->type);
|
i64 align = type_align_of(c->allocator, e->type);
|
||||||
if (align > 0) {
|
if (align > 0) {
|
||||||
// add_type_info_type(c, e->type);
|
add_type_info_type(c, e->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
/* gb.h - v0.29 - Ginger Bill's C Helper Library - public domain
|
/* gb.h - v0.30 - Ginger Bill's C Helper Library - public domain
|
||||||
- no warranty implied; use at your own risk
|
- no warranty implied; use at your own risk
|
||||||
|
|
||||||
This is a single header file with a bunch of useful stuff
|
This is a single header file with a bunch of useful stuff
|
||||||
@@ -58,6 +58,7 @@ TODOS
|
|||||||
- More date & time functions
|
- More date & time functions
|
||||||
|
|
||||||
VERSION HISTORY
|
VERSION HISTORY
|
||||||
|
0.30 - Changes to gbThread (and gbMutex on Windows)
|
||||||
0.29 - Add extras for gbString
|
0.29 - Add extras for gbString
|
||||||
0.28 - Handle UCS2 correctly in Win32 part
|
0.28 - Handle UCS2 correctly in Win32 part
|
||||||
0.27 - OSX fixes and Linux gbAffinity
|
0.27 - OSX fixes and Linux gbAffinity
|
||||||
|
|||||||
Reference in New Issue
Block a user