diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-06 23:55:48 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-06 23:55:48 +0100 |
| commit | 7044a7d77650e922a66f3bfe99711f3ed370e1ba (patch) | |
| tree | c31f6413c08b69f6598dbe406c6cb1e5efec2642 /src/check_expr.cpp | |
| parent | 08612423b9afffb7499d8db2c69715df1627bd50 (diff) | |
Try to fix a possible race condition with polymorphic record parameters
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index d2d01deda..ad546858c 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7331,14 +7331,9 @@ gb_internal CallArgumentError check_polymorphic_record_type(CheckerContext *c, O gbString s = gb_string_make_reserve(heap_allocator(), e->token.string.len+3); s = gb_string_append_fmt(s, "%.*s(", LIT(e->token.string)); - Type *params = nullptr; - switch (bt->kind) { - case Type_Struct: params = bt->Struct.polymorphic_params; break; - case Type_Union: params = bt->Union.polymorphic_params; break; - } - - if (params != nullptr) for_array(i, params->Tuple.variables) { - Entity *v = params->Tuple.variables[i]; + TypeTuple *tuple = get_record_polymorphic_params(e->type); + if (tuple != nullptr) for_array(i, tuple->variables) { + Entity *v = tuple->variables[i]; String name = v->token.string; if (i > 0) { s = gb_string_append_fmt(s, ", "); |