mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 06:38:47 +00:00
Fix minor constant value declaration bug
This commit is contained in:
+1
-21
@@ -168,18 +168,6 @@ void check_init_constant(CheckerContext *ctx, Entity *e, Operand *operand) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!is_type_constant_type(operand->type)) {
|
|
||||||
gbString type_str = type_to_string(operand->type);
|
|
||||||
error(operand->expr, "Invalid constant type: '%s'", type_str);
|
|
||||||
gb_string_free(type_str);
|
|
||||||
if (e->type == nullptr) {
|
|
||||||
e->type = t_invalid;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (e->type == nullptr) { // NOTE(bill): type inference
|
if (e->type == nullptr) { // NOTE(bill): type inference
|
||||||
e->type = operand->type;
|
e->type = operand->type;
|
||||||
}
|
}
|
||||||
@@ -388,15 +376,7 @@ void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init,
|
|||||||
e->flags |= EntityFlag_Visited;
|
e->flags |= EntityFlag_Visited;
|
||||||
|
|
||||||
if (type_expr) {
|
if (type_expr) {
|
||||||
Type *t = check_type(ctx, type_expr);
|
e->type = check_type(ctx, type_expr);
|
||||||
if (!is_type_constant_type(t) && !is_type_proc(t)) {
|
|
||||||
gbString str = type_to_string(t);
|
|
||||||
error(type_expr, "Invalid constant type '%s'", str);
|
|
||||||
gb_string_free(str);
|
|
||||||
e->type = t_invalid;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e->type = t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Operand operand = {};
|
Operand operand = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user