diff options
| author | gingerBill <bill@gingerbill.org> | 2023-06-21 14:39:23 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-06-21 14:39:23 +0100 |
| commit | c48057081e451c81524c7727ec3ccf434a45726f (patch) | |
| tree | d24f22924e24b92fc4700004c820b02aa83dd36d /src | |
| parent | ea76e09ea741f0bf090d967cf3aaded59079d001 (diff) | |
Fix nullptr entity case
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_expr.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 99017f434..83e44b39f 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -5908,11 +5908,13 @@ gb_internal bool check_call_arguments_single(CheckerContext *c, Ast *call, Opera } if (e == nullptr) { - GB_ASSERT(proc_type == nullptr); e = entity_of_node(ident); - proc_type = e->type; + if (e != nullptr) { + proc_type = e->type; + } } + GB_ASSERT(proc_type != nullptr); proc_type = base_type(proc_type); GB_ASSERT(proc_type->kind == Type_Proc); @@ -5922,12 +5924,10 @@ gb_internal bool check_call_arguments_single(CheckerContext *c, Ast *call, Opera } Entity *entity_to_use = data->gen_entity != nullptr ? data->gen_entity : e; - if (!return_on_failure) { + if (!return_on_failure && entity_to_use != nullptr) { add_entity_use(c, ident, entity_to_use); - if (entity_to_use != nullptr) { - update_untyped_expr_type(c, operand->expr, entity_to_use->type, true); - add_type_and_value(c, operand->expr, operand->mode, entity_to_use->type, operand->value); - } + update_untyped_expr_type(c, operand->expr, entity_to_use->type, true); + add_type_and_value(c, operand->expr, operand->mode, entity_to_use->type, operand->value); } if (data->gen_entity != nullptr) { @@ -6474,7 +6474,7 @@ gb_internal CallArgumentData check_call_arguments(CheckerContext *c, Operand *op if (!any_failure) { check_call_arguments_single(c, call, operand, - nullptr, nullptr, + nullptr, proc_type, positional_operands, named_operands, CallArgumentErrorMode::ShowErrors, &data); |