mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Unify are_types_identical_unique_tuples
This commit is contained in:
+2
-2
@@ -1253,7 +1253,7 @@ isize type_info_index(CheckerInfo *info, Type *type, bool error_on_failure) {
|
|||||||
// TODO(bill): This is O(n) and can be very slow
|
// TODO(bill): This is O(n) and can be very slow
|
||||||
for_array(i, info->type_info_map.entries){
|
for_array(i, info->type_info_map.entries){
|
||||||
auto *e = &info->type_info_map.entries[i];
|
auto *e = &info->type_info_map.entries[i];
|
||||||
if (are_types_identical(e->key, type)) {
|
if (are_types_identical_unique_tuples(e->key, type)) {
|
||||||
entry_index = e->value;
|
entry_index = e->value;
|
||||||
// NOTE(bill): Add it to the search map
|
// NOTE(bill): Add it to the search map
|
||||||
map_set(&info->type_info_map, type, entry_index);
|
map_set(&info->type_info_map, type, entry_index);
|
||||||
@@ -1601,7 +1601,7 @@ void add_type_info_type_internal(CheckerContext *c, Type *t) {
|
|||||||
isize ti_index = -1;
|
isize ti_index = -1;
|
||||||
for_array(i, c->info->type_info_map.entries) {
|
for_array(i, c->info->type_info_map.entries) {
|
||||||
auto *e = &c->info->type_info_map.entries[i];
|
auto *e = &c->info->type_info_map.entries[i];
|
||||||
if (are_types_identical(t, e->key)) {
|
if (are_types_identical_unique_tuples(t, e->key)) {
|
||||||
// Duplicate entry
|
// Duplicate entry
|
||||||
ti_index = e->value;
|
ti_index = e->value;
|
||||||
prev = true;
|
prev = true;
|
||||||
|
|||||||
+1
-1
@@ -483,7 +483,7 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
|
|||||||
for_array(i, w->type_cache.entries) {
|
for_array(i, w->type_cache.entries) {
|
||||||
// NOTE(bill): THIS IS SLOW
|
// NOTE(bill): THIS IS SLOW
|
||||||
Type *other = w->type_cache.entries[i].key;
|
Type *other = w->type_cache.entries[i].key;
|
||||||
if (are_types_identical(type, other, true)) {
|
if (are_types_identical_unique_tuples(type, other)) {
|
||||||
OdinDocTypeIndex index = w->type_cache.entries[i].value;
|
OdinDocTypeIndex index = w->type_cache.entries[i].value;
|
||||||
map_set(&w->type_cache, type, index);
|
map_set(&w->type_cache, type, index);
|
||||||
return index;
|
return index;
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ struct Ast;
|
|||||||
struct HashKey;
|
struct HashKey;
|
||||||
struct Type;
|
struct Type;
|
||||||
struct Entity;
|
struct Entity;
|
||||||
bool are_types_identical(Type *x, Type *y, bool check_tuple_names=false);
|
bool are_types_identical(Type *x, Type *y);
|
||||||
|
|
||||||
struct Complex128 {
|
struct Complex128 {
|
||||||
f64 real, imag;
|
f64 real, imag;
|
||||||
|
|||||||
+12
-2
@@ -694,7 +694,7 @@ gbString type_to_string (Type *type);
|
|||||||
i64 type_size_of_internal(Type *t, TypePath *path);
|
i64 type_size_of_internal(Type *t, TypePath *path);
|
||||||
void init_map_internal_types(Type *type);
|
void init_map_internal_types(Type *type);
|
||||||
Type * bit_set_to_int(Type *t);
|
Type * bit_set_to_int(Type *t);
|
||||||
bool are_types_identical(Type *x, Type *y, bool check_tuple_names/*=false*/);
|
bool are_types_identical(Type *x, Type *y);
|
||||||
|
|
||||||
bool is_type_pointer(Type *t);
|
bool is_type_pointer(Type *t);
|
||||||
bool is_type_proc(Type *t);
|
bool is_type_proc(Type *t);
|
||||||
@@ -2338,7 +2338,17 @@ Type *strip_type_aliasing(Type *x) {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool are_types_identical(Type *x, Type *y, bool check_tuple_names) {
|
bool are_types_identical_internal(Type *x, Type *y, bool check_tuple_names);
|
||||||
|
|
||||||
|
bool are_types_identical(Type *x, Type *y) {
|
||||||
|
return are_types_identical_internal(x, y, false);
|
||||||
|
}
|
||||||
|
bool are_types_identical_unique_tuples(Type *x, Type *y) {
|
||||||
|
return are_types_identical_internal(x, y, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool are_types_identical_internal(Type *x, Type *y, bool check_tuple_names) {
|
||||||
if (x == y) {
|
if (x == y) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user