From b2ee560145ee15482ac18def8be06cca51dca96e Mon Sep 17 00:00:00 2001 From: Niels Bross Date: Thu, 18 Jul 2024 23:13:01 +0200 Subject: [PATCH] Fix build.bat file. --- Semantic_Analysis.jai | 22 ++++++++++++++++++---- build.bat | 2 +- first.jai | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 first.jai diff --git a/Semantic_Analysis.jai b/Semantic_Analysis.jai index 99d7669..dcfdff5 100644 --- a/Semantic_Analysis.jai +++ b/Semantic_Analysis.jai @@ -8,10 +8,6 @@ // [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. -#import "ncore"; -#import "Hash_Table"; -#import "String"; - VERTEX_MAIN_FUNCTION_PREFIX :: "vertex"; PIXEL_MAIN_FUNCTION_PREFIX :: "pixel"; PROPERTIES_PREFIX :: "properties"; @@ -72,6 +68,7 @@ Type_Variable :: struct { struct_field_parent : *AST_Node; typename : string; + is_array : bool; MAX_TYPE_VARIABLE_CHILDREN :: 16; children : [MAX_TYPE_VARIABLE_CHILDREN]Type_Variable_Handle; @@ -1256,6 +1253,17 @@ create_field :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable typename : string; 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 { variable.resource_index = checker.current_sampler_index; checker.current_sampler_index += 1; @@ -2187,3 +2195,9 @@ pretty_print_type_constraints :: (checker : *Semantic_Checker, allocator : Alloc return builder_to_string(*builder,, allocator); } + +#scope_module + +#import "ncore"; +#import "Hash_Table"; +#import "String"; diff --git a/build.bat b/build.bat index 9ab76cf..e26f66c 100644 --- a/build.bat +++ b/build.bat @@ -1,3 +1,3 @@ @echo off -jai Test.jai +jai first.jai -natvis diff --git a/first.jai b/first.jai new file mode 100644 index 0000000..aa25295 --- /dev/null +++ b/first.jai @@ -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();