mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
Win32 Window Test
This commit is contained in:
@@ -452,7 +452,8 @@ void add_type_and_value(CheckerInfo *i, AstNode *expression, AddressingMode mode
|
||||
|
||||
if (mode == Addressing_Constant) {
|
||||
GB_ASSERT(value.kind != ExactValue_Invalid);
|
||||
GB_ASSERT(type == t_invalid || is_type_constant_type(type));
|
||||
GB_ASSERT_MSG(type != t_invalid || is_type_constant_type(type),
|
||||
"type: %s", type_to_string(type));
|
||||
}
|
||||
|
||||
TypeAndValue tv = {};
|
||||
@@ -473,7 +474,11 @@ void add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
|
||||
if (!are_strings_equal(entity->token.string, make_string("_"))) {
|
||||
Entity *insert_entity = scope_insert_entity(scope, entity);
|
||||
if (insert_entity) {
|
||||
error(&c->error_collector, entity->token, "Redeclared entity in this scope: %.*s", LIT(entity->token.string));
|
||||
error(&c->error_collector, entity->token,
|
||||
"Redeclararation of `%.*s` in this scope\n"
|
||||
"\tat %.*s(%td:%td)",
|
||||
LIT(entity->token.string),
|
||||
LIT(entity->token.pos.file), entity->token.pos.line, entity->token.pos.column);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -843,19 +843,19 @@ b32 check_castable_to(Checker *c, Operand *operand, Type *y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// untyped integers -> pointers
|
||||
if (is_type_untyped(xb) && is_type_integer(xb)) {
|
||||
if (is_type_pointer(yb))
|
||||
return true;
|
||||
}
|
||||
// // untyped integers -> pointers
|
||||
// if (is_type_untyped(xb) && is_type_integer(xb)) {
|
||||
// if (is_type_pointer(yb))
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// (u)int <-> pointer
|
||||
if (is_type_pointer(xb) || is_type_int_or_uint(xb)) {
|
||||
if (is_type_pointer(xb) || (is_type_int_or_uint(xb) && !is_type_untyped(xb))) {
|
||||
if (is_type_pointer(yb))
|
||||
return true;
|
||||
}
|
||||
if (is_type_pointer(xb)) {
|
||||
if (is_type_pointer(yb) || is_type_int_or_uint(yb))
|
||||
if (is_type_pointer(yb) || (is_type_int_or_uint(yb) && !is_type_untyped(yb)))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -888,9 +888,9 @@ void check_binary_expr(Checker *c, Operand *x, AstNode *node) {
|
||||
b32 can_convert = false;
|
||||
|
||||
if (is_const_expr && is_type_constant_type(type)) {
|
||||
Type *t = get_base_type(type);
|
||||
if (t->kind == Type_Basic) {
|
||||
if (check_value_is_expressible(c, x->value, t, &x->value)) {
|
||||
Type *base_type = get_base_type(type);
|
||||
if (base_type->kind == Type_Basic) {
|
||||
if (check_value_is_expressible(c, x->value, base_type, &x->value)) {
|
||||
can_convert = true;
|
||||
}
|
||||
}
|
||||
@@ -1807,7 +1807,7 @@ ExpressionKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *typ
|
||||
case Token_Float: t = t_untyped_float; break;
|
||||
case Token_String: t = t_untyped_string; break;
|
||||
case Token_Rune: t = t_untyped_rune; break;
|
||||
default: GB_PANIC("Unknown literal"); break;
|
||||
default: GB_PANIC("Unknown literal"); break;
|
||||
}
|
||||
o->mode = Addressing_Constant;
|
||||
o->type = t;
|
||||
@@ -1815,16 +1815,16 @@ ExpressionKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *typ
|
||||
case_end;
|
||||
|
||||
case_ast_node(pl, ProcLit, node);
|
||||
auto curr_context = c->context;
|
||||
c->context.scope = c->global_scope;
|
||||
check_open_scope(c, pl->type);
|
||||
c->context.decl = make_declaration_info(c->allocator, c->context.scope);
|
||||
defer ({
|
||||
check_close_scope(c);
|
||||
c->context = curr_context;
|
||||
});
|
||||
Type *proc_type = check_type(c, pl->type);
|
||||
if (proc_type != NULL) {
|
||||
auto context = c->context;
|
||||
c->context.scope = c->global_scope;
|
||||
check_open_scope(c, pl->type);
|
||||
c->context.decl = make_declaration_info(c->allocator, c->context.scope);
|
||||
defer ({
|
||||
c->context = context;
|
||||
check_close_scope(c);
|
||||
});
|
||||
check_proc_body(c, empty_token, c->context.decl, proc_type, pl->body);
|
||||
o->mode = Addressing_Value;
|
||||
o->type = proc_type;
|
||||
|
||||
@@ -351,7 +351,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init_e
|
||||
e->type = t;
|
||||
}
|
||||
|
||||
Operand operand = {Addressing_Invalid};
|
||||
Operand operand = {};
|
||||
if (init_expr)
|
||||
check_expr(c, &operand, init_expr);
|
||||
check_init_constant(c, e, &operand);
|
||||
|
||||
Reference in New Issue
Block a user