Browse Source

Fix typo for some built-in procedures

Ginger Bill 8 years ago
parent
commit
c4081393c1
3 changed files with 18 additions and 8 deletions
  1. 3 3
      src/check_expr.cpp
  2. 11 5
      src/main.cpp
  3. 4 0
      src/types.cpp

+ 3 - 3
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) {
 		if (operand->mode == Addressing_Invalid || operand->mode == Addressing_Builtin) {
 			return false;
 			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`");
 			error(operand->expr, "Invalid argument to `type_of_val`");
 			return false;
 			return false;
 		}
 		}
@@ -4183,8 +4183,8 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
 			return false;
 			return false;
 		}
 		}
 		Type *t = o.type;
 		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;
 			return false;
 		}
 		}
 		t = default_type(t);
 		t = default_type(t);

+ 11 - 5
src/main.cpp

@@ -1,4 +1,5 @@
 #define USE_CUSTOM_BACKEND 0
 #define USE_CUSTOM_BACKEND 0
+// #define PRINT_TIMINGS
 
 
 #include "common.cpp"
 #include "common.cpp"
 #include "timings.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);
 	va_start(va, fmt);
 	cmd_len = gb_snprintf_va(cmd_line, gb_size_of(cmd_line), fmt, va);
 	cmd_len = gb_snprintf_va(cmd_line, gb_size_of(cmd_line), fmt, va);
 	va_end(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);
 	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,
 		exit_code = system_exec_command_line_app("msvc-link", true,
 			"link \"%.*s\".obj -OUT:\"%.*s.%s\" %s "
 			"link \"%.*s\".obj -OUT:\"%.*s.%s\" %s "
 			"/defaultlib:libcmt "
 			"/defaultlib:libcmt "
+			// "/nodefaultlib "
 			"/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
 			"/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
 			" %.*s "
 			" %.*s "
 			" %s "
 			" %s "
@@ -555,7 +556,10 @@ int main(int arg_count, char **arg_ptr) {
 			return exit_code;
 			return exit_code;
 		}
 		}
 
 
-		// timings_print_all(&timings);
+	#if defined(PRINT_TIMINGS)
+		timings_print_all(&timings);
+	#endif
+
 
 
 		if (run_output) {
 		if (run_output) {
 			system_exec_command_line_app("odin run", false, "%.*s.exe", LIT(output_base));
 			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;
 			return exit_code;
 		}
 		}
 
 
-		// timings_print_all(&timings);
+	#if defined(PRINT_TIMINGS)
+		timings_print_all(&timings);
+	#endif
 
 
 		if (run_output) {
 		if (run_output) {
 			system_exec_command_line_app("odin run", false, "%.*s", LIT(output_base));
 			system_exec_command_line_app("odin run", false, "%.*s", LIT(output_base));

+ 4 - 0
src/types.cpp

@@ -821,6 +821,10 @@ bool is_type_proc(Type *t) {
 	t = base_type(t);
 	t = base_type(t);
 	return t->kind == Type_Proc;
 	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) {
 Type *base_vector_type(Type *t) {
 	if (is_type_vector(t)) {
 	if (is_type_vector(t)) {
 		t = base_type(t);
 		t = base_type(t);