Fix build.bat file.

This commit is contained in:
2024-07-18 23:13:01 +02:00
parent b475357cf9
commit b2ee560145
3 changed files with 61 additions and 5 deletions

View File

@@ -8,10 +8,6 @@
// [x] Improve error reporting on mismatched overloads when types don't match, but arity does // [x] Improve error reporting on mismatched overloads when types don't match, but arity does
// [x] Improve error reporting for type mismatches in general. It seems like the expect node is not always correct. // [x] Improve error reporting for type mismatches in general. It seems like the expect node is not always correct.
#import "ncore";
#import "Hash_Table";
#import "String";
VERTEX_MAIN_FUNCTION_PREFIX :: "vertex"; VERTEX_MAIN_FUNCTION_PREFIX :: "vertex";
PIXEL_MAIN_FUNCTION_PREFIX :: "pixel"; PIXEL_MAIN_FUNCTION_PREFIX :: "pixel";
PROPERTIES_PREFIX :: "properties"; PROPERTIES_PREFIX :: "properties";
@@ -72,6 +68,7 @@ Type_Variable :: struct {
struct_field_parent : *AST_Node; struct_field_parent : *AST_Node;
typename : string; typename : string;
is_array : bool;
MAX_TYPE_VARIABLE_CHILDREN :: 16; MAX_TYPE_VARIABLE_CHILDREN :: 16;
children : [MAX_TYPE_VARIABLE_CHILDREN]Type_Variable_Handle; children : [MAX_TYPE_VARIABLE_CHILDREN]Type_Variable_Handle;
@@ -1256,6 +1253,17 @@ create_field :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable
typename : string; typename : string;
variable.type = get_type_from_identifier(checker, checker.current_scope, node, *typename); variable.type = get_type_from_identifier(checker, checker.current_scope, node, *typename);
variable.is_array = node.array_field;
if variable.is_array {
size_node := node.children[0];
size_var := check_node(checker, size_node);
if h2tv(checker, size_var).type != .Int {
//@Incomplete(niels): Type mismatch here. With integral type required message.
print("Shiet\n");
}
}
if variable.kind == .Declaration && variable.type == .Sampler { if variable.kind == .Declaration && variable.type == .Sampler {
variable.resource_index = checker.current_sampler_index; variable.resource_index = checker.current_sampler_index;
checker.current_sampler_index += 1; checker.current_sampler_index += 1;
@@ -2187,3 +2195,9 @@ pretty_print_type_constraints :: (checker : *Semantic_Checker, allocator : Alloc
return builder_to_string(*builder,, allocator); return builder_to_string(*builder,, allocator);
} }
#scope_module
#import "ncore";
#import "Hash_Table";
#import "String";

View File

@@ -1,3 +1,3 @@
@echo off @echo off
jai Test.jai jai first.jai -natvis

42
first.jai Normal file
View File

@@ -0,0 +1,42 @@
#import "Basic";
#import "File";
#import "Compiler";
build :: () {
w := compiler_create_workspace("Shader Compiler Test Build");
if !w {
print("Workspace creation failed.\n");
return;
}
EXECUTABLE_NAME :: "test";
MAIN_FILE :: "Test.jai";
options := get_build_options(w);
options.write_added_strings = true;
new_path: [..] string;
array_add(*new_path, ..options.import_path);
array_add(*new_path, "modules");
// array_add(*new_path, "modules/shader_parsing");
options.import_path = new_path;
options.output_executable_name = EXECUTABLE_NAME;
wd := get_working_directory();
set_build_options(options, w);
compiler_begin_intercept(w);
add_build_file(MAIN_FILE, w);
compiler_end_intercept(w);
print("\nDone!\n\n");
set_build_options_dc(.{do_output=false});
}
#run build();