diff --git a/base.cpp b/base.cpp index a01cff2..c7a8f3e 100644 --- a/base.cpp +++ b/base.cpp @@ -344,5 +344,5 @@ operator!=(Intern_String a, Intern_String b) { return !result; } -#define For_Linked_List_Named(a, it) for (auto *it = (a); it; it = it->next) // @todo: reference? +#define For_Linked_List_Named(a, it) for (auto *it = (a); it; it = it->next) #define For_Linked_List(a) For_Linked_List_Named(a, it) diff --git a/build/modules/KERNEL32.core b/build/modules/KERNEL32.core index 72060cb..62571d6 100644 --- a/build/modules/KERNEL32.core +++ b/build/modules/KERNEL32.core @@ -22,10 +22,10 @@ LPDWORD :: *DWORD LRESULT :: S64 WPARAM :: U64 LPARAM :: S64 -BYTE :: U8 // @todo? unsigned char -WORD :: S16 // short -LONG :: S32 // @todo long -UINT :: U32 // @todo uint +BYTE :: uchar +WORD :: short +LONG :: long +UINT :: uint ATOM :: WORD LARGE_INTEGER :: S64 PLARGE_INTEGER :: *LARGE_INTEGER diff --git a/core_lexing.cpp b/core_lexing.cpp index 5abd189..90ee5c8 100644 --- a/core_lexing.cpp +++ b/core_lexing.cpp @@ -311,7 +311,6 @@ lex__stream(Core_Ctx *lexer) { else goto indent_loop_break; } break; - // @todo: add [;;] operator which adds new scope // @todo: also need some way to detect indentation so that // first of all we can check for consistency and second of // all because we would know by how much to indent diff --git a/core_main.cpp b/core_main.cpp index 2d186bd..b1d252e 100644 --- a/core_main.cpp +++ b/core_main.cpp @@ -28,18 +28,11 @@ Fix backlog - [ ] String declaration in Language.core this way we can compound create it and access fields and stuff - [ ] This error is valid error case when someone creates a compound out of basic type C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:137 Internal compiler error: Invalid type was passed to the compound expression, should have been an array, struct or slice result := String{data, filesize} -- [ ] Fix tuple being able to colapse into a single variable -- [ ] Fix Found multiple definitions of not showing multiple definitions in the error message - [ ] How to cast from U64 to pointer? ``` Future features -- [ ] Add some directive that passes metadata arguments to compiler, stores them - in array and then those can be searched etc. Then we could add the link thing there -- [ ] The ability for a type to also be a namespace seems like a good idea, a common pattern - emerges. Not sure how to execute it though without complications. Data for sure needs - to be nicely visible in a struct and those functions should be separate - [ ] Other kinds of casts, a cast from structs of same layout, a cast without conversion - [ ] Inject symbols into a declaration / namespace ?? - [ ] Using directive to bring symbols into local scope @@ -102,17 +95,16 @@ static void compile_file(Allocator *allocator, String filename, U32 compile_flag F64 total_compiler_time = os_time() - pctx->time.start; printf("%f - ", total_compiler_time); - Arena *scratch = pctx->scratch; - Scoped_Arena _scope(scratch); + Scoped_Arena scratch(pctx->scratch); F64 begin = os_time(); if (!is_flag_set(compile_flags, DONT_USE_C_COMPILER)) { - String_Builder builder = {scratch}; + String_Builder builder = {scratch.arena}; builder.addf("clang generated_main.c -Wall -Wno-unused-function -Wno-parentheses-equality -g -o a" OS_EXE " "); For(pctx->files_to_link) { builder.addf("-l%Q ", it->intern_val); } - String compiler_call = string_flatten(scratch, &builder); + String compiler_call = string_flatten(scratch.arena, &builder); system((const char *)compiler_call.str); printf("%s\n", compiler_call.str); } @@ -135,9 +127,9 @@ static void compile_file(Allocator *allocator, String filename, U32 compile_flag if (is_flag_set(compile_flags, COMPILE_AND_RUN)) { String testing = compile_flags & COMPILE_TESTING ? "testing"_s : ""_s; #if OS_WINDOWS - String sys = string_fmt(scratch, "a.exe %Q", testing); + String sys = string_fmt(scratch.arena, "a.exe %Q", testing); #else - String sys = string_fmt(scratch, "./a.out %Q", testing); + String sys = string_fmt(scratch.arena, "./a.out %Q", testing); #endif int result = system((char *)sys.str); assert(result != -1); diff --git a/core_typechecking.cpp b/core_typechecking.cpp index 9428056..ee78c1a 100644 --- a/core_typechecking.cpp +++ b/core_typechecking.cpp @@ -1276,9 +1276,6 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str node->resolved_type = pctx->type_u8; } - // @todo: type_architecture? - // we only try to convert the index cause array can't be const - // right now try_propagating_resolved_type_to_untyped_literals(node->index, pctx->type_int); try_propagating_resolved_type_to_untyped_literals(node->expr, left.type); @@ -1607,7 +1604,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str } } - /* @todo: + /* We need an algorithm and other concretes for correct matching of arrays, var args and others. (a: int = 5, b: int) Disallowed, this is not lua where table has indexed and keyed values at the same time @@ -1685,9 +1682,8 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str // Might be wise to revise it later but the approach of starting with // lambda_args seems correct. For2(lambda->args, lambda_arg) { - // assert(lambda_arg->type); // @todo: maybe add this check at the end - - // @todo: Change inside resolve lambda, no default arguments allowed!!!!!! + // Variadic functions cannot have default arguments + // we make sure of that when resolving the lambda if (lambda_arg->kind == AST_VARGS_LAMBDA_PARAM) { For(node->exprs) { if (is_flag_set(it->call_flags, CALL_NAME)) {