Fix make error messages

This commit is contained in:
gingerBill
2018-08-08 23:07:51 +01:00
parent 3928614326
commit 877a78d6ba
4 changed files with 8 additions and 7 deletions

View File

@@ -120,7 +120,7 @@ make_dynamic_array :: proc(T: type/[dynamic]$E, len, cap: int, loc := #caller_lo
return transmute(T)s;
}
make_map :: proc(T: type/map[$K]$E, cap: int = 16, loc := #caller_location) -> T {
runtime.make_map_array_error_loc(loc, cap);
runtime.make_map_expr_error_loc(loc, cap);
m: T;
reserve_map(&m, cap);
return m;

View File

@@ -273,7 +273,7 @@ _alloc_command_line_arguments :: proc() -> []string {
olen := win32.wide_char_to_multi_byte(win32.CP_UTF8, 0, wc_str, -1,
nil, 0, nil, nil);
buf := make([]byte, olen);
buf := make([]byte, int(olen));
n := win32.wide_char_to_multi_byte(win32.CP_UTF8, 0, wc_str, -1,
cstring(&buf[0]), olen, nil, nil);
if n > 0 {

View File

@@ -325,7 +325,7 @@ dynamic_array_expr_error_loc :: inline proc "contextless" (using loc := #caller_
make_slice_error_loc :: inline proc "contextless" (using loc := #caller_location, len: int) {
if 0 < len do return;
if 0 <= len do return;
fd := os.stderr;
__print_caller_location(fd, loc);
@@ -336,7 +336,7 @@ make_slice_error_loc :: inline proc "contextless" (using loc := #caller_location
}
make_dynamic_array_error_loc :: inline proc "contextless" (using loc := #caller_location, len, cap: int) {
if 0 < len && len < cap do return;
if 0 <= len && len <= cap do return;
fd := os.stderr;
__print_caller_location(fd, loc);
@@ -348,8 +348,8 @@ make_dynamic_array_error_loc :: inline proc "contextless" (using loc := #caller_
debug_trap();
}
map_expr_error_loc :: inline proc "contextless" (using loc := #caller_location, cap: int) {
if 0 < cap do return;
make_map_expr_error_loc :: inline proc "contextless" (using loc := #caller_location, cap: int) {
if 0 <= cap do return;
fd := os.stderr;
__print_caller_location(fd, loc);

View File

@@ -7244,7 +7244,8 @@ void ir_begin_procedure_body(irProcedure *proc) {
e->flags |= EntityFlag_NoAlias;
irValue *param = ir_value_param(proc, e, e->type);
ir_module_add_value(proc->module, e, param);
array_add(&proc->context_stack, {param, proc->scope_index});
irContextData ctx = {param, proc->scope_index};
array_add(&proc->context_stack, ctx);
}
}