mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Fix poly proc determination by cloning the signature node
This commit is contained in:
+3
-3
@@ -278,7 +278,6 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto *found_gen_procs = map_get(&nctx.info->gen_procs, hash_pointer(base_entity->identifier));
|
auto *found_gen_procs = map_get(&nctx.info->gen_procs, hash_pointer(base_entity->identifier));
|
||||||
if (found_gen_procs) {
|
if (found_gen_procs) {
|
||||||
auto procs = *found_gen_procs;
|
auto procs = *found_gen_procs;
|
||||||
@@ -304,13 +303,14 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
|
|||||||
// NOTE(bill): Reset scope from the failed procedure type
|
// NOTE(bill): Reset scope from the failed procedure type
|
||||||
scope_reset(scope);
|
scope_reset(scope);
|
||||||
|
|
||||||
success = check_procedure_type(&nctx, final_proc_type, pt->node, &operands);
|
// LEAK TODO(bill): Cloning this AST may be leaky
|
||||||
|
Ast *cloned_proc_type_node = clone_ast(pt->node);
|
||||||
|
success = check_procedure_type(&nctx, final_proc_type, cloned_proc_type_node, &operands);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (found_gen_procs) {
|
if (found_gen_procs) {
|
||||||
auto procs = *found_gen_procs;
|
auto procs = *found_gen_procs;
|
||||||
for_array(i, procs) {
|
for_array(i, procs) {
|
||||||
|
|||||||
+8
-5
@@ -763,7 +763,7 @@ extern "C++" {
|
|||||||
#ifndef GB_ASSERT_MSG
|
#ifndef GB_ASSERT_MSG
|
||||||
#define GB_ASSERT_MSG(cond, msg, ...) do { \
|
#define GB_ASSERT_MSG(cond, msg, ...) do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
gb_assert_handler(#cond, __FILE__, cast(i64)__LINE__, msg, ##__VA_ARGS__); \
|
gb_assert_handler("Assertion Failure", #cond, __FILE__, cast(i64)__LINE__, msg, ##__VA_ARGS__); \
|
||||||
GB_DEBUG_TRAP(); \
|
GB_DEBUG_TRAP(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -779,10 +779,13 @@ extern "C++" {
|
|||||||
|
|
||||||
// NOTE(bill): Things that shouldn't happen with a message!
|
// NOTE(bill): Things that shouldn't happen with a message!
|
||||||
#ifndef GB_PANIC
|
#ifndef GB_PANIC
|
||||||
#define GB_PANIC(msg, ...) GB_ASSERT_MSG(0, msg, ##__VA_ARGS__)
|
#define GB_PANIC(msg, ...) do { \
|
||||||
|
gb_assert_handler("Panic", NULL, __FILE__, cast(i64)__LINE__, msg, ##__VA_ARGS__); \
|
||||||
|
GB_DEBUG_TRAP(); \
|
||||||
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GB_DEF void gb_assert_handler(char const *condition, char const *file, i32 line, char const *msg, ...);
|
GB_DEF void gb_assert_handler(char const *prefix, char const *condition, char const *file, i32 line, char const *msg, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3613,8 +3616,8 @@ extern "C" {
|
|||||||
#pragma warning(disable:4127) // Conditional expression is constant
|
#pragma warning(disable:4127) // Conditional expression is constant
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gb_assert_handler(char const *condition, char const *file, i32 line, char const *msg, ...) {
|
void gb_assert_handler(char const *prefix, char const *condition, char const *file, i32 line, char const *msg, ...) {
|
||||||
gb_printf_err("%s(%d): Assert Failure: ", file, line);
|
gb_printf_err("%s(%d): %s: ", file, line, prefix);
|
||||||
if (condition)
|
if (condition)
|
||||||
gb_printf_err( "`%s` ", condition);
|
gb_printf_err( "`%s` ", condition);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
|
|||||||
+12
-13
@@ -2593,21 +2593,20 @@ irDebugInfo *ir_add_debug_info_proc(irProcedure *proc) {
|
|||||||
|
|
||||||
irDebugInfo *ir_add_debug_info_location(irModule *m, Ast *node, irDebugInfo *scope, Entity *e) {
|
irDebugInfo *ir_add_debug_info_location(irModule *m, Ast *node, irDebugInfo *scope, Entity *e) {
|
||||||
if (node == nullptr || scope == nullptr) {
|
if (node == nullptr || scope == nullptr) {
|
||||||
if (e == nullptr) {
|
if (e != nullptr && scope != nullptr) {
|
||||||
return nullptr;
|
// irDebugInfo **existing = map_get(&m->debug_info, hash_entity(e));
|
||||||
} else if (scope != nullptr) {
|
// if (existing != nullptr) {
|
||||||
irDebugInfo **existing = map_get(&m->debug_info, hash_entity(e));
|
// return *existing;
|
||||||
if (existing != nullptr) {
|
// }
|
||||||
return *existing;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO HACK(bill): This is a little dirty but it is should do for the weird edge cases
|
// // TODO HACK(bill): This is a little dirty but it is should do for the weird edge cases
|
||||||
irDebugInfo *di = ir_alloc_debug_info(irDebugInfo_Location);
|
// irDebugInfo *di = ir_alloc_debug_info(irDebugInfo_Location);
|
||||||
di->Location.pos = e->token.pos;
|
// di->Location.pos = e->token.pos;
|
||||||
di->Location.scope = scope;
|
// di->Location.scope = scope;
|
||||||
map_set(&m->debug_info, hash_entity(e), di);
|
// map_set(&m->debug_info, hash_entity(e), di);
|
||||||
return di;
|
// return di;
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
// TODO(lachsinc): Should we traverse the node/children until we find one with
|
// TODO(lachsinc): Should we traverse the node/children until we find one with
|
||||||
// valid token/pos and use that instead??
|
// valid token/pos and use that instead??
|
||||||
|
|||||||
Reference in New Issue
Block a user