diff --git a/build/rtsgame/main.core b/build/rtsgame/main.core index 61c689a..b400c28 100644 --- a/build/rtsgame/main.core +++ b/build/rtsgame/main.core @@ -52,12 +52,6 @@ Add(&guys, {100, 100}) // This generates: int MAP[256] = (int [256]){[0] = 0, [0] = 1}; it doesn't work because of the (int[256]) is this MSVC being retarded here? not supporting C properly? // Also this ^ ^ -// @reproduction -// map_data: [16*16]int -// map: Map = {data = map_data->*int, 16, 16} -// -// Failed to cast from [[256]int] to [*int] - #import "raylib.core" #load "array.core" @@ -93,6 +87,7 @@ MouseSelectedActors: Array(*MAP.Actor) // @todo: ids main :: (): int MAP.Init() + // InitAudioDevice() // sound := LoadSound("catune - Pass the town, and to the C.mp3") // SetMasterVolume(0.01) diff --git a/core_parsing.cpp b/core_parsing.cpp index 91bdf82..61f5220 100644 --- a/core_parsing.cpp +++ b/core_parsing.cpp @@ -27,10 +27,16 @@ static void core_log_trace(int line, const char *file, const char *str, ...) { String core_stringify_message(Core_Ctx *pctx, Allocator *allocator, Core_Message *msg, int color_codes_enabled = false) { String_Builder &b = pctx->helper_builder; - if (msg->kind == CORE_ERROR) b.addf("Error! "); - else if (msg->kind == CORE_WARNING) b.addf("Warning! "); - else if (msg->kind == CORE_TRACE) b.addf("Trace: "); - else invalid_codepath; + for (S64 i = 0; i < buff_cap(msg->tokens); i += 1) { + Token *it = msg->tokens[i]; + if (it) { + b.addf("\n%s(%d): ", it->file.str, (S64)it->line + 1); + if (msg->kind == CORE_ERROR) b.addf("error "); + else if (msg->kind == CORE_WARNING) b.addf("warning "); + else if (msg->kind == CORE_TRACE) b.addf("trace "); + else invalid_codepath; + } + } for (int i = 0; i < buff_cap(msg->tokens); i += 1) { Token *it = msg->tokens[i]; @@ -67,13 +73,6 @@ String core_stringify_message(Core_Ctx *pctx, Allocator *allocator, Core_Message } } - for (S64 i = 0; i < buff_cap(msg->tokens); i += 1) { - Token *it = msg->tokens[i]; - if (it) { - b.addf("\n%s(%d): error", it->file.str, (S64)it->line + 1); - } - } - String result = string_flatten(allocator, &b); return result; } diff --git a/core_typechecking.cpp b/core_typechecking.cpp index 8843846..371bf2d 100644 --- a/core_typechecking.cpp +++ b/core_typechecking.cpp @@ -975,6 +975,14 @@ resolve_cast(Ast_Binary *node) { expr.type = type; else goto failure; } break; + case TYPE_ARRAY: { + Ast_Type *array_base = expr.type->base; + Ast_Type *pointer_base = type_pointer(array_base); + if (pointer_base == type) { + expr.type = pointer_base; + } + else goto failure; + } break; case TYPE_POINTER: { if (is_pointer(type)) expr = operand_rvalue(type); @@ -1061,8 +1069,7 @@ resolve_compound_array(Ast_Call *node, Ast_Type *type) { CORE_Static void resolve_compound_struct(Ast_Call *node, Ast_Type *type) { - if (node->exprs.len != 1 && is_union(type)) - compiler_error(node->pos, "Too many union initializers. Only 1 named initializer required."); + if (node->exprs.len != 1 && is_union(type)) compiler_error(node->pos, "Too many union initializers. Only 1 named initializer required."); int counter = 0; bool named_field_appeared = false; @@ -1075,7 +1082,7 @@ resolve_compound_struct(Ast_Call *node, Ast_Type *type) { counter += 1; } - S64 default_counter = 0; + int default_counter = 0; For(node->exprs) { Ast_Type *item_type = 0; if (is_flag_set(it->call_flags, CALL_NAME)) {