Fix typo for some built-in procedures

This commit is contained in:
Ginger Bill
2017-06-25 17:36:10 +01:00
parent 1d81b73df9
commit c4081393c1
3 changed files with 18 additions and 8 deletions
+3 -3
View File
@@ -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);
+11 -5
View File
@@ -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));
+4
View File
@@ -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);