This commit is contained in:
gingerBill
2022-11-21 11:01:01 +00:00
parent cb183e968a
commit 83558a1352
+21 -16
View File
@@ -611,6 +611,9 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
} }
return -1; return -1;
} }
if (operand->mode == Addressing_ProcGroup && !is_type_proc(type)) {
return -1;
}
Type *s = operand->type; Type *s = operand->type;
@@ -1003,22 +1006,24 @@ void check_assignment(CheckerContext *c, Operand *operand, Type *type, String co
} }
if (operand->mode == Addressing_ProcGroup) { if (operand->mode == Addressing_ProcGroup) {
Array<Entity *> procs = proc_group_entities(c, *operand);
bool good = false; bool good = false;
// NOTE(bill): These should be done if (type != nullptr && is_type_proc(type)) {
for_array(i, procs) { Array<Entity *> procs = proc_group_entities(c, *operand);
Type *t = base_type(procs[i]->type); // NOTE(bill): These should be done
if (t == t_invalid) { for_array(i, procs) {
continue; Type *t = base_type(procs[i]->type);
} if (t == t_invalid) {
Operand x = {}; continue;
x.mode = Addressing_Value; }
x.type = t; Operand x = {};
if (check_is_assignable_to(c, &x, type)) { x.mode = Addressing_Value;
Entity *e = procs[i]; x.type = t;
add_entity_use(c, operand->expr, e); if (check_is_assignable_to(c, &x, type)) {
good = true; Entity *e = procs[i];
break; add_entity_use(c, operand->expr, e);
good = true;
break;
}
} }
} }
@@ -1507,7 +1512,7 @@ Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *named_type, Typ
Array<Entity *> procs = pge->entities; Array<Entity *> procs = pge->entities;
bool skip = false; bool skip = false;
if (type_hint != nullptr) { if (type_hint != nullptr && is_type_proc(type_hint)) {
// NOTE(bill): These should be done // NOTE(bill): These should be done
for_array(i, procs) { for_array(i, procs) {
Type *t = base_type(procs[i]->type); Type *t = base_type(procs[i]->type);