From c4081393c1ca0b1c259cdba572b32c266bc53c5c Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 25 Jun 2017 17:36:10 +0100 Subject: [PATCH] Fix typo for some built-in procedures --- src/check_expr.cpp | 6 +++--- src/main.cpp | 16 +++++++++++----- src/types.cpp | 4 ++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index af2f2ad4c..4e2dc2e36 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4160,7 +4160,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id if (operand->mode == Addressing_Invalid || operand->mode == Addressing_Builtin) { return false; } - if (operand->type == NULL || operand->type == t_invalid) { + if (operand->type == NULL || operand->type == t_invalid || is_type_gen_proc(operand->type)) { error(operand->expr, "Invalid argument to `type_of_val`"); return false; } @@ -4183,8 +4183,8 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id return false; } Type *t = o.type; - if (t == NULL || t == t_invalid) { - error(ce->args[0], "Invalid argument for `size_of`"); + if (t == NULL || t == t_invalid || is_type_gen_proc(operand->type)) { + error(ce->args[0], "Invalid argument for `type_info`"); return false; } t = default_type(t); diff --git a/src/main.cpp b/src/main.cpp index e8ea79593..c3923b5d0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #define USE_CUSTOM_BACKEND 0 +// #define PRINT_TIMINGS #include "common.cpp" #include "timings.cpp" @@ -33,9 +34,8 @@ i32 system_exec_command_line_app(char *name, bool is_silent, char *fmt, ...) { va_start(va, fmt); cmd_len = gb_snprintf_va(cmd_line, gb_size_of(cmd_line), fmt, va); va_end(va); - if (!is_silent) { - // gb_printf("%.*s\n", cast(int)cmd_len, cmd_line); - } + + // gb_printf_err("%.*s\n", cast(int)cmd_len, cmd_line); tmp = gb_temp_arena_memory_begin(&string_buffer_arena); @@ -543,6 +543,7 @@ int main(int arg_count, char **arg_ptr) { exit_code = system_exec_command_line_app("msvc-link", true, "link \"%.*s\".obj -OUT:\"%.*s.%s\" %s " "/defaultlib:libcmt " + // "/nodefaultlib " "/nologo /incremental:no /opt:ref /subsystem:CONSOLE " " %.*s " " %s " @@ -555,7 +556,10 @@ int main(int arg_count, char **arg_ptr) { return exit_code; } - // timings_print_all(&timings); + #if defined(PRINT_TIMINGS) + timings_print_all(&timings); + #endif + if (run_output) { system_exec_command_line_app("odin run", false, "%.*s.exe", LIT(output_base)); @@ -658,7 +662,9 @@ int main(int arg_count, char **arg_ptr) { return exit_code; } - // timings_print_all(&timings); + #if defined(PRINT_TIMINGS) + timings_print_all(&timings); + #endif if (run_output) { system_exec_command_line_app("odin run", false, "%.*s", LIT(output_base)); diff --git a/src/types.cpp b/src/types.cpp index ce0a57dc9..54224373d 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -821,6 +821,10 @@ bool is_type_proc(Type *t) { t = base_type(t); return t->kind == Type_Proc; } +bool is_type_gen_proc(Type *t) { + t = base_type(t); + return t->kind == Type_Proc && t->Proc.is_generic; +} Type *base_vector_type(Type *t) { if (is_type_vector(t)) { t = base_type(t);