aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-30 20:13:23 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-30 20:13:23 +0100
commita0ae02168a5cdd7c1ac8bbb392c3a94cfa4348c6 (patch)
tree8fd3edaa1b984a79a3dbd0791c39b65480a012db
parenta3c1ac203059482f8c8e097a7f4deaa4f365099b (diff)
Update `add_type_info_type` to ignore polymorphic types
-rw-r--r--src/checker.cpp12
-rw-r--r--src/gb/gb.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index f6c20c048..e0ba73875 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -1073,6 +1073,9 @@ void add_type_info_type(Checker *c, Type *t) {
if (is_type_untyped(t)) {
return; // Could be nil
}
+ if (is_type_polymorphic(base_type(t))) {
+ return;
+ }
if (map_get(&c->info.type_info_map, hash_type(t)) != nullptr) {
// Types have already been added
@@ -1165,12 +1168,19 @@ void add_type_info_type(Checker *c, Type *t) {
case Type_Union:
add_type_info_type(c, t_int);
+ add_type_info_type(c, t_type_info_ptr);
for_array(i, bt->Union.variants) {
add_type_info_type(c, bt->Union.variants[i]);
}
break;
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) {
Entity *f = bt->Struct.fields[i];
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 align = type_align_of(c->allocator, e->type);
if (align > 0) {
- // add_type_info_type(c, e->type);
+ add_type_info_type(c, e->type);
}
}
}
diff --git a/src/gb/gb.h b/src/gb/gb.h
index 51d0cd5d5..eeab9d8fa 100644
--- a/src/gb/gb.h
+++ b/src/gb/gb.h
@@ -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
This is a single header file with a bunch of useful stuff
@@ -58,6 +58,7 @@ TODOS
- More date & time functions
VERSION HISTORY
+ 0.30 - Changes to gbThread (and gbMutex on Windows)
0.29 - Add extras for gbString
0.28 - Handle UCS2 correctly in Win32 part
0.27 - OSX fixes and Linux gbAffinity