mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix enumerated array literal check
This commit is contained in:
+4
-15
@@ -8126,25 +8126,14 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (t->kind == Type_Array) {
|
if (t->kind == Type_EnumeratedArray) {
|
||||||
if (is_to_be_determined_array_count) {
|
if (cl->elems.count > 0 && cl->elems[0]->kind != Ast_FieldValue) {
|
||||||
t->Array.count = max;
|
if (0 < max && max < t->EnumeratedArray.count) {
|
||||||
} else if (cl->elems.count > 0 && cl->elems[0]->kind != Ast_FieldValue) {
|
error(node, "Expected %lld values for this enumerated array literal, got %lld", cast(long long)t->EnumeratedArray.count, cast(long long)max);
|
||||||
if (0 < max && max < t->Array.count) {
|
|
||||||
error(node, "Expected %lld values for this array literal, got %lld", cast(long long)t->Array.count, cast(long long)max);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (t->kind == Type_SimdVector) {
|
|
||||||
if (!is_constant) {
|
|
||||||
error(node, "Expected all constant elements for a simd vector");
|
|
||||||
}
|
|
||||||
if (t->SimdVector.is_x86_mmx) {
|
|
||||||
error(node, "Compound literals are not allowed with intrinsics.x86_mmx");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -9401,8 +9401,13 @@ void ir_build_range_tuple(irProcedure *proc, Ast *expr, Type *val0_type, Type *v
|
|||||||
void ir_store_type_case_implicit(irProcedure *proc, Ast *clause, irValue *value) {
|
void ir_store_type_case_implicit(irProcedure *proc, Ast *clause, irValue *value) {
|
||||||
Entity *e = implicit_entity_of_node(clause);
|
Entity *e = implicit_entity_of_node(clause);
|
||||||
GB_ASSERT(e != nullptr);
|
GB_ASSERT(e != nullptr);
|
||||||
|
#if 1
|
||||||
irValue *x = ir_add_local(proc, e, nullptr, false);
|
irValue *x = ir_add_local(proc, e, nullptr, false);
|
||||||
ir_emit_store(proc, x, value);
|
ir_emit_store(proc, x, value);
|
||||||
|
#else
|
||||||
|
irValue *x = ir_address_from_load_or_generate_local(proc, value);
|
||||||
|
ir_module_add_value(proc->module, e, x);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ir_type_case_body(irProcedure *proc, Ast *label, Ast *clause, irBlock *body, irBlock *done) {
|
void ir_type_case_body(irProcedure *proc, Ast *label, Ast *clause, irBlock *body, irBlock *done) {
|
||||||
@@ -10317,9 +10322,9 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
|
|||||||
|
|
||||||
ir_start_block(proc, body);
|
ir_start_block(proc, body);
|
||||||
|
|
||||||
if (cc->list.count == 1) {
|
|
||||||
// bool any_or_not_ptr = is_type_any(type_deref(parent_type)) || !is_parent_ptr;
|
// bool any_or_not_ptr = is_type_any(type_deref(parent_type)) || !is_parent_ptr;
|
||||||
bool any_or_not_ptr = !is_parent_ptr;
|
bool any_or_not_ptr = !is_parent_ptr;
|
||||||
|
if (cc->list.count == 1) {
|
||||||
|
|
||||||
Type *ct = case_entity->type;
|
Type *ct = case_entity->type;
|
||||||
if (any_or_not_ptr) {
|
if (any_or_not_ptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user