From 5b45b5ef9191afb2550e1c402c9071950be77210 Mon Sep 17 00:00:00 2001 From: vbot Date: Sun, 5 Jun 2022 09:15:05 +0000 Subject: [PATCH] [v:master] 5b16d5fdf - compress.gzip / deflate: rename gzip module into deflate module (#14682) --- v.c | 5756 +++++++++++++++++++++++++++++++++++++++--------------- v_win.c | 5789 ++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 8434 insertions(+), 3111 deletions(-) diff --git a/v.c b/v.c index 07cba42..65a9591 100644 --- a/v.c +++ b/v.c @@ -1,13 +1,15 @@ -#define V_COMMIT_HASH "3bc50721e" +#define V_COMMIT_HASH "5b16d5fdf" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "585cb9ec2" + #define V_COMMIT_HASH "3bc50721e" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "3bc5072" + #define V_CURRENT_COMMIT_HASH "5b16d5f" #endif +#define V_USE_SIGNAL_H + // V comptime_definitions: #define __VTHREADS__ (1) #define _VAUTOFREE (0) @@ -801,7 +803,9 @@ voidptr memdup(voidptr src, int sz); #include // _waccess #include // _wgetcwd + #ifdef V_USE_SIGNAL_H #include // signal and SIGSEGV for segmentation fault handler + #endif #ifdef _MSC_VER // On MSVC these are the same (as long as /volatile:ms is passed) @@ -2913,6 +2917,7 @@ typedef map Map_string_Array_Array_v__ast__Type; typedef map Map_int_v__ast__InterfaceDecl; typedef map Map_string_v__ast__EnumDecl; typedef map Map_string_time__Time; +typedef map Map_u64_string; typedef array Array_v__ast__Fn; typedef map Map_string_v__ast__StructField; typedef array Array_v__ast__Kind; @@ -3435,20 +3440,20 @@ struct v__ast__AsmArg { // Union sum type v__ast__TypeInfo = -// | 433 = v__ast__Aggregate -// | 435 = v__ast__Alias +// | 434 = v__ast__Aggregate +// | 436 = v__ast__Alias // | 415 = v__ast__Array -// | 443 = v__ast__ArrayFixed -// | 444 = v__ast__Chan -// | 449 = v__ast__Enum -// | 447 = v__ast__FnType -// | 448 = v__ast__GenericInst -// | 438 = v__ast__Interface +// | 444 = v__ast__ArrayFixed +// | 445 = v__ast__Chan +// | 450 = v__ast__Enum +// | 448 = v__ast__FnType +// | 449 = v__ast__GenericInst +// | 439 = v__ast__Interface // | 416 = v__ast__Map -// | 446 = v__ast__MultiReturn +// | 447 = v__ast__MultiReturn // | 420 = v__ast__Struct -// | 439 = v__ast__SumType -// | 445 = v__ast__Thread +// | 440 = v__ast__SumType +// | 446 = v__ast__Thread struct v__ast__TypeInfo { union { v__ast__Aggregate* _v__ast__Aggregate; @@ -3868,6 +3873,7 @@ struct v__ast__Table { Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + Map_u64_string cached_type_to_str; Array_v__ast__TypeSymbol_ptr type_symbols; Array_string imports; Array_string modules; @@ -4300,6 +4306,7 @@ struct v__scanner__Scanner { int nr_lines; int tidx; int eofs; + int inter_cbr_count; u8 quote; u8 inter_quote; v__scanner__CommentsMode comments_mode : 2; @@ -4597,32 +4604,6 @@ struct StrIntpData { -struct os__FileMode { - os__FileType typ; - os__FilePermission owner; - os__FilePermission group; - os__FilePermission others; -}; - - - -struct os__Process { - string filename; - int pid; - int code; - os__ProcessState status; - string err; - Array_string args; - bool env_is_custom; - Array_string env; - bool use_stdio_ctl; - bool use_pgroup; - Array_fixed_int_3 stdio_fd; - voidptr wdata; -}; - - - struct v__pref__Preferences { v__vcache__CacheManager cache_manager; Array_string profile_fns; @@ -4644,6 +4625,7 @@ struct v__pref__Preferences { string third_party_option; string bare_builtin_dir; string custom_prelude; + string cmain; string vroot; string out_name_c; string out_name; @@ -4674,6 +4656,7 @@ struct v__pref__Preferences { bool is_prod : 1; bool is_repl : 1; bool is_run : 1; + bool is_crun : 1; bool is_debug : 1; bool is_vlines : 1; bool is_stats : 1; @@ -4728,6 +4711,32 @@ struct v__pref__Preferences { +struct os__FileMode { + os__FileType typ; + os__FilePermission owner; + os__FilePermission group; + os__FilePermission others; +}; + + + +struct os__Process { + string filename; + int pid; + int code; + os__ProcessState status; + string err; + Array_string args; + bool env_is_custom; + Array_string env; + bool use_stdio_ctl; + bool use_pgroup; + Array_fixed_int_3 stdio_fd; + voidptr wdata; +}; + + + struct v__builder__Builder { string compiled_dir; string module_path; @@ -4749,6 +4758,7 @@ struct v__builder__Builder { Map_string_Array_string mod_invalidates_paths; Map_string_Array_string mod_invalidates_mods; Map_string_Array_string path_invalidates_mods; + Array_string crun_cache_keys; }; @@ -5664,6 +5674,8 @@ struct v__ast__StructField { Array_v__ast__Comment comments; Array_v__ast__Attr attrs; string default_val; + string deprecation_msg; + string deprecated_after; v__ast__Expr default_expr; string name; v__token__Pos pos; @@ -5676,6 +5688,7 @@ struct v__ast__StructField { bool is_mut : 1; bool is_global : 1; bool is_volatile : 1; + bool is_deprecated : 1; }; @@ -5862,15 +5875,15 @@ struct v__parser__Parser { Array_v__ast__Import ast_imports; Array_string used_imports; Array_string auto_imports; - Array_v__errors__Error errors; - Array_v__errors__Warning warnings; - Array_v__errors__Notice notices; - Array_v__vet__Error vet_errors; Array_string label_names; Array_string global_labels; Array_v__ast__Ident defer_vars; Array_v__ast__Type struct_init_generic_types; Array_v__ast__Comment if_cond_comments; + Array_v__errors__Error errors; + Array_v__errors__Warning warnings; + Array_v__errors__Notice notices; + Array_v__vet__Error vet_errors; string file_base; string file_name; string file_name_dir; @@ -5880,9 +5893,9 @@ struct v__parser__Parser { string cur_fn_name; string codegen_text; v__pref__Preferences* pref; - v__scanner__Scanner* scanner; v__ast__Table* table; v__ast__Scope* scope; + v__scanner__Scanner* scanner; int expr_level; int n_asm; v__ast__Language file_backend_mode : 4; @@ -6423,6 +6436,7 @@ struct v__gen__c__Gen { Map_int_bool autofree_methods; Map_int_bool generated_free_methods; Array_string autofree_scope_stmts; + bool use_segfault_handler; }; @@ -6458,12 +6472,12 @@ struct v__checker__Checker { Array_string error_details; Array_v__ast__Type vweb_gen_types; string mod; - string const_decl; string vmod_file_content; string loop_label; v__pref__Preferences* pref; v__ast__Table* table; v__ast__File* file; + v__ast__ConstField* const_var; v__util__Timers* timers; v__ast__Scope* fn_scope; v__token__Pos smartcast_mut_pos; @@ -7245,6 +7259,10 @@ int math__bits__ones_count_8(u8 x); int math__bits__ones_count_16(u16 x); int math__bits__ones_count_32(u32 x); int math__bits__ones_count_64(u64 x); +u8 _const_math__bits__n8 = 8; // precomputed +u16 _const_math__bits__n16 = 16; // precomputed +u32 _const_math__bits__n32 = 32; // precomputed +u64 _const_math__bits__n64 = 64U; // precomputed u8 math__bits__rotate_left_8(u8 x, int k); u16 math__bits__rotate_left_16(u16 x, int k); u32 math__bits__rotate_left_32(u32 x, int k); @@ -7343,7 +7361,7 @@ void strconv__format_str_sb(string s, strconv__BF_param p, strings__Builder* sb) #define _const_strconv__max_size_f64_char 32 string _const_strconv__digit_pairs; // a string literal, inited later void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res); -VV_LOCAL_SYMBOL string strconv__f64_to_str_lnd1(f64 f, int dec_digit); +string strconv__f64_to_str_lnd1(f64 f, int dec_digit); string strconv__format_fl(f64 f, strconv__BF_param p); string strconv__format_es(f64 f, strconv__BF_param p); string strconv__remove_tail_zeros(string s); @@ -8236,6 +8254,7 @@ string _const_os__dot_str; // a string literal, inited later bool os__is_abs_path(string path); string os__abs_path(string path); string os__norm_path(string path); +_option_string os__existing_path(string path); VV_LOCAL_SYMBOL string os__clean_path(string path); VV_LOCAL_SYMBOL int os__win_volume_len(string path); VV_LOCAL_SYMBOL string os__get_volume(string path); @@ -8245,6 +8264,7 @@ VV_LOCAL_SYMBOL bool os__has_drive_letter(string path); VV_LOCAL_SYMBOL bool os__starts_w_slash_slash(string path); VV_LOCAL_SYMBOL bool os__is_drive_rooted(string path); VV_LOCAL_SYMBOL bool os__is_normal_path(string path); +VV_LOCAL_SYMBOL bool os__is_curr_dir_ref(int byte_one, int byte_two, int byte_three); u32 os__FilePermission_bitmask(os__FilePermission p); u32 os__FileMode_bitmask(os__FileMode m); os__FileMode os__inode(string path); @@ -8776,6 +8796,7 @@ _option_v__pref__Backend v__pref__backend_from_string(string s); v__pref__CompilerType v__pref__cc_from_string(string cc_str); v__pref__Arch v__pref__get_host_arch(void); VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define); +VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__Preferences* prefs, Array_string define_parts); Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_); VV_LOCAL_SYMBOL int compare_11540237029762306605_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; @@ -8923,7 +8944,6 @@ Array_string _const_v__util__builtin_module_parts; // inited later Array_string _const_v__util__bundle_modules; // inited later Map_string_Array_string _const_v__util__external_module_dependencies_for_tool; // inited later Array_string _const_v__util__const_tabs; // inited later -Array_string _const_v__util__builtin_module_names; // inited later bool v__util__module_is_builtin(string mod); string v__util__tabs(int n); void v__util__set_vroot_folder(string vroot_path); @@ -8984,7 +9004,7 @@ bool v__ast__Expr_is_blank_ident(v__ast__Expr expr); v__token__Pos v__ast__Expr_pos(v__ast__Expr expr); bool v__ast__Expr_is_lvalue(v__ast__Expr expr); bool v__ast__Expr_is_expr(v__ast__Expr expr); -bool v__ast__Expr_is_lit(v__ast__Expr expr); +bool v__ast__Expr_is_pure_literal(v__ast__Expr expr); bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr); bool v__ast__Expr_is_lockable(v__ast__Expr* e); _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt); @@ -9318,6 +9338,7 @@ bool v__ast__Interface_defines_method(v__ast__Interface* i, string name); void v__checker__Checker_assign_stmt(v__checker__Checker* c, v__ast__AssignStmt* node); bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg); +VV_LOCAL_SYMBOL multi_return_string_string v__checker__Checker_get_string_names_of(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected); VV_LOCAL_SYMBOL bool v__checker__Checker_check_same_module(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym); @@ -9466,6 +9487,8 @@ VV_LOCAL_SYMBOL bool v__checker__has_top_return(Array_v__ast__Stmt stmts); VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Checker* c, v__ast__FnDecl* node); VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts); VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr); +VV_LOCAL_SYMBOL int v__checker__imin(int a, int b); +VV_LOCAL_SYMBOL int v__checker__imax(int a, int b); u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp, v__ast__Type typ); v__ast__Type v__checker__Checker_string_inter_lit(v__checker__Checker* c, v__ast__StringInterLiteral* node); string _const_v__checker__unicode_lit_overflow_message; // a string literal, inited later @@ -9747,6 +9770,7 @@ string _const_v__gen__c__c_bare_headers; // str inited later string _const_v__gen__c__c_wyhash_headers; // a string literal, inited later void v__gen__c__Gen_gen_c_main(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_vlines_reset(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_only_header(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g); void v__gen__c__Gen_gen_c_main_footer(v__gen__c__Gen* g); @@ -9771,7 +9795,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_ctemp_var(v__gen__c__Gen* g, v__ast__CTe VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr(v__gen__c__Gen* g, v__ast__DumpExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g); VV_LOCAL_SYMBOL bool v__gen__c__Gen_writeln_fn_header(v__gen__c__Gen* g, string s, strings__Builder* sb); -VV_LOCAL_SYMBOL bool v__gen__c__Gen_embed_file_is_prod_mode(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL bool v__gen__c__Gen_should_really_embed_file(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL void v__gen__c__Gen_handle_embedded_files_finish(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embed_file_init(v__gen__c__Gen* g, v__ast__ComptimeCall* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_data(v__gen__c__Gen* g); @@ -10032,6 +10057,8 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check(v__parser__Parser* p, v__token__Kin VV_LOCAL_SYMBOL string v__parser__Parser_check_js_name(v__parser__Parser* p); VV_LOCAL_SYMBOL string v__parser__Parser_check_name(v__parser__Parser* p); v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p); +VV_LOCAL_SYMBOL bool v__parser__comptime_if_expr_contains_top_stmt(v__ast__IfExpr if_expr); +VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_other_stmts(v__parser__Parser* p, v__ast__Stmt cur_stmt); v__ast__Comment v__parser__Parser_check_comment(v__parser__Parser* p); v__ast__Comment v__parser__Parser_comment(v__parser__Parser* p); v__ast__ExprStmt v__parser__Parser_comment_stmt(v__parser__Parser* p); @@ -10147,7 +10174,7 @@ VV_LOCAL_SYMBOL Array_string v__builder__error_context_lines(string text, string VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_os_cflags(v__builder__Builder* v); VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_rest_of_module_cflags(v__builder__Builder* v, v__cflag__CFlag* c); void v__builder__compile(string command, v__pref__Preferences* pref, void (*backend_cb)(v__builder__Builder* b)); -string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix); +VV_LOCAL_SYMBOL void v__builder__check_if_output_folder_is_writable(v__pref__Preferences* pref); VV_LOCAL_SYMBOL void v__builder__Builder_myfree(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_exit_on_invalid_syntax(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_run_compiled_executable_and_exit(v__builder__Builder* b); @@ -10180,9 +10207,19 @@ v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r); VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r); void v__builder__Builder_rebuild_modules(v__builder__Builder* b); +Array_string v__builder__Builder_find_invalidated_modules_by_files(v__builder__Builder* b, Array_string all_files); VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL string v__builder__Builder_rebuild_cached_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, string vexe); +bool v__builder__Builder_should_rebuild(v__builder__Builder* b); +VV_LOCAL_SYMBOL int compare_14016397514164073915_string(string* a, string* b) { + if (string__lt(*a, *b)) return -1; + else return 1; +} + +VV_LOCAL_SYMBOL i64 v__builder__most_recent_timestamp(Array_string files); +void v__builder__Builder_rebuild(v__builder__Builder* b, void (*backend_cb)(v__builder__Builder* b)); +string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix); void v__builder__cbuilder__start(void); void v__builder__cbuilder__compile_c(v__builder__Builder* b); string v__builder__cbuilder__gen_c(v__builder__Builder* b, Array_string v_files); @@ -10191,6 +10228,7 @@ Array_string _const_main__external_tools; // inited later Array_string _const_main__list_of_flags_that_allow_duplicates; // inited later VV_LOCAL_SYMBOL void main__main(void); VV_LOCAL_SYMBOL void main__invoke_help_and_exit(Array_string remaining); +VV_LOCAL_SYMBOL void main__rebuild(v__pref__Preferences* prefs); static string time__FormatTime_str(time__FormatTime it); // auto static string time__FormatDate_str(time__FormatDate it); // auto @@ -10206,6 +10244,7 @@ static string v__ast__Fn_str(v__ast__Fn it); // auto static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count); // auto static string v__ast__Language_str(v__ast__Language it); // auto static string v__ast__IdentKind_str(v__ast__IdentKind it); // auto +static string anon_fn_v__ast__constdecl_str(); // auto static string v__token__Pos_str(v__token__Pos it); // auto static string indent_v__token__Pos_str(v__token__Pos it, int indent_count); // auto static string Array_v__ast__Attr_str(Array_v__ast__Attr a); // auto @@ -10291,11 +10330,168 @@ static bool v__ast__Type_alias_eq(v__ast__Type a, v__ast__Type b); // auto static bool Array_string_arr_eq(Array_string a, Array_string b); // auto static bool v__token__Pos_struct_eq(v__token__Pos a, v__token__Pos b); // auto static bool Array_v__ast__Type_arr_eq(Array_v__ast__Type a, Array_v__ast__Type b); // auto -static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b); // auto -static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b); // auto -static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b); // auto +static bool v__ast__Stmt_sumtype_eq(v__ast__Stmt a, v__ast__Stmt b); // auto +static bool v__ast__AsmStmt_struct_eq(v__ast__AsmStmt a, v__ast__AsmStmt b); // auto +static bool Array_v__ast__AsmClobbered_arr_eq(Array_v__ast__AsmClobbered a, Array_v__ast__AsmClobbered b); // auto +static bool v__ast__AsmClobbered_struct_eq(v__ast__AsmClobbered a, v__ast__AsmClobbered b); // auto +static bool v__ast__AsmRegister_struct_eq(v__ast__AsmRegister a, v__ast__AsmRegister b); // auto +static bool Array_v__ast__Comment_arr_eq(Array_v__ast__Comment a, Array_v__ast__Comment b); // auto +static bool v__ast__Comment_struct_eq(v__ast__Comment a, v__ast__Comment b); // auto +static bool Array_v__ast__AsmTemplate_arr_eq(Array_v__ast__AsmTemplate a, Array_v__ast__AsmTemplate b); // auto +static bool v__ast__AsmTemplate_struct_eq(v__ast__AsmTemplate a, v__ast__AsmTemplate b); // auto +static bool Array_v__ast__AsmArg_arr_eq(Array_v__ast__AsmArg a, Array_v__ast__AsmArg b); // auto +static bool v__ast__AsmArg_sumtype_eq(v__ast__AsmArg a, v__ast__AsmArg b); // auto +static bool v__ast__AsmAddressing_struct_eq(v__ast__AsmAddressing a, v__ast__AsmAddressing b); // auto +static bool v__ast__AsmAlias_struct_eq(v__ast__AsmAlias a, v__ast__AsmAlias b); // auto +static bool v__ast__AsmDisp_struct_eq(v__ast__AsmDisp a, v__ast__AsmDisp b); // auto +static bool v__ast__BoolLiteral_struct_eq(v__ast__BoolLiteral a, v__ast__BoolLiteral b); // auto +static bool v__ast__CharLiteral_struct_eq(v__ast__CharLiteral a, v__ast__CharLiteral b); // auto +static bool v__ast__FloatLiteral_struct_eq(v__ast__FloatLiteral a, v__ast__FloatLiteral b); // auto +static bool v__ast__IntegerLiteral_struct_eq(v__ast__IntegerLiteral a, v__ast__IntegerLiteral b); // auto +static bool Array_v__ast__AsmIO_arr_eq(Array_v__ast__AsmIO a, Array_v__ast__AsmIO b); // auto +static bool v__ast__AsmIO_struct_eq(v__ast__AsmIO a, v__ast__AsmIO b); // auto +static bool v__ast__Expr_sumtype_eq(v__ast__Expr a, v__ast__Expr b); // auto +static bool v__ast__AnonFn_struct_eq(v__ast__AnonFn a, v__ast__AnonFn b); // auto +static bool v__ast__FnDecl_struct_eq(v__ast__FnDecl a, v__ast__FnDecl b); // auto +static bool v__ast__StructField_struct_eq(v__ast__StructField a, v__ast__StructField b); // auto +static bool Array_v__ast__Attr_arr_eq(Array_v__ast__Attr a, Array_v__ast__Attr b); // auto +static bool v__ast__Attr_struct_eq(v__ast__Attr a, v__ast__Attr b); // auto +static bool Array_v__ast__Param_arr_eq(Array_v__ast__Param a, Array_v__ast__Param b); // auto +static bool v__ast__Param_struct_eq(v__ast__Param a, v__ast__Param b); // auto +static bool Array_v__ast__Stmt_arr_eq(Array_v__ast__Stmt a, Array_v__ast__Stmt b); // auto +static bool Array_v__ast__DeferStmt_arr_eq(Array_v__ast__DeferStmt a, Array_v__ast__DeferStmt b); // auto +static bool v__ast__DeferStmt_struct_eq(v__ast__DeferStmt a, v__ast__DeferStmt b); // auto +static bool Array_v__ast__Ident_arr_eq(Array_v__ast__Ident a, Array_v__ast__Ident b); // auto +static bool v__ast__Ident_struct_eq(v__ast__Ident a, v__ast__Ident b); // auto +static bool v__ast__ScopeObject_sumtype_eq(v__ast__ScopeObject a, v__ast__ScopeObject b); // auto +static bool v__ast__ConstField_struct_eq(v__ast__ConstField a, v__ast__ConstField b); // auto +static bool v__ast__ComptTimeConstValue_sumtype_eq(v__ast__ComptTimeConstValue a, v__ast__ComptTimeConstValue b); // auto +static bool v__ast__EmptyExpr_struct_eq(v__ast__EmptyExpr a, v__ast__EmptyExpr b); // auto +static bool v__ast__GlobalField_struct_eq(v__ast__GlobalField a, v__ast__GlobalField b); // auto +static bool v__ast__Var_struct_eq(v__ast__Var a, v__ast__Var b); // auto +static bool v__ast__IdentInfo_sumtype_eq(v__ast__IdentInfo a, v__ast__IdentInfo b); // auto +static bool v__ast__IdentFn_struct_eq(v__ast__IdentFn a, v__ast__IdentFn b); // auto +static bool v__ast__IdentVar_struct_eq(v__ast__IdentVar a, v__ast__IdentVar b); // auto +static bool v__ast__ArrayDecompose_struct_eq(v__ast__ArrayDecompose a, v__ast__ArrayDecompose b); // auto +static bool v__ast__ArrayInit_struct_eq(v__ast__ArrayInit a, v__ast__ArrayInit b); // auto +static bool Array_Array_v__ast__Comment_arr_eq(Array_Array_v__ast__Comment a, Array_Array_v__ast__Comment b); // auto +static bool Array_v__ast__Expr_arr_eq(Array_v__ast__Expr a, Array_v__ast__Expr b); // auto +static bool v__ast__AsCast_struct_eq(v__ast__AsCast a, v__ast__AsCast b); // auto +static bool v__ast__Assoc_struct_eq(v__ast__Assoc a, v__ast__Assoc b); // auto +static bool v__ast__AtExpr_struct_eq(v__ast__AtExpr a, v__ast__AtExpr b); // auto +static bool v__ast__CTempVar_struct_eq(v__ast__CTempVar a, v__ast__CTempVar b); // auto +static bool v__ast__CallExpr_struct_eq(v__ast__CallExpr a, v__ast__CallExpr b); // auto +static bool v__ast__OrExpr_struct_eq(v__ast__OrExpr a, v__ast__OrExpr b); // auto +static bool Array_v__ast__CallArg_arr_eq(Array_v__ast__CallArg a, Array_v__ast__CallArg b); // auto +static bool v__ast__CallArg_struct_eq(v__ast__CallArg a, v__ast__CallArg b); // auto +static bool v__ast__CastExpr_struct_eq(v__ast__CastExpr a, v__ast__CastExpr b); // auto +static bool v__ast__ChanInit_struct_eq(v__ast__ChanInit a, v__ast__ChanInit b); // auto +static bool v__ast__ComptimeCall_struct_eq(v__ast__ComptimeCall a, v__ast__ComptimeCall b); // auto +static bool v__ast__File_struct_eq(v__ast__File a, v__ast__File b); // auto +static bool v__ast__Module_struct_eq(v__ast__Module a, v__ast__Module b); // auto +static bool Array_v__ast__Import_arr_eq(Array_v__ast__Import a, Array_v__ast__Import b); // auto +static bool v__ast__Import_struct_eq(v__ast__Import a, v__ast__Import b); // auto +static bool Array_v__ast__ImportSymbol_arr_eq(Array_v__ast__ImportSymbol a, Array_v__ast__ImportSymbol b); // auto +static bool v__ast__ImportSymbol_struct_eq(v__ast__ImportSymbol a, v__ast__ImportSymbol b); // auto +static bool Array_v__ast__EmbeddedFile_arr_eq(Array_v__ast__EmbeddedFile a, Array_v__ast__EmbeddedFile b); // auto static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__EmbeddedFile b); // auto static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b); // auto +static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b); // auto +static bool Array_v__errors__Error_arr_eq(Array_v__errors__Error a, Array_v__errors__Error b); // auto +static bool v__errors__Error_struct_eq(v__errors__Error a, v__errors__Error b); // auto +static bool Array_v__errors__Warning_arr_eq(Array_v__errors__Warning a, Array_v__errors__Warning b); // auto +static bool v__errors__Warning_struct_eq(v__errors__Warning a, v__errors__Warning b); // auto +static bool Array_v__errors__Notice_arr_eq(Array_v__errors__Notice a, Array_v__errors__Notice b); // auto +static bool v__errors__Notice_struct_eq(v__errors__Notice a, v__errors__Notice b); // auto +static bool Array_v__ast__FnDecl_ptr_arr_eq(Array_v__ast__FnDecl_ptr a, Array_v__ast__FnDecl_ptr b); // auto +static bool v__ast__ComptimeSelector_struct_eq(v__ast__ComptimeSelector a, v__ast__ComptimeSelector b); // auto +static bool v__ast__ComptimeType_struct_eq(v__ast__ComptimeType a, v__ast__ComptimeType b); // auto +static bool v__ast__ConcatExpr_struct_eq(v__ast__ConcatExpr a, v__ast__ConcatExpr b); // auto +static bool v__ast__DumpExpr_struct_eq(v__ast__DumpExpr a, v__ast__DumpExpr b); // auto +static bool v__ast__EnumVal_struct_eq(v__ast__EnumVal a, v__ast__EnumVal b); // auto +static bool v__ast__GoExpr_struct_eq(v__ast__GoExpr a, v__ast__GoExpr b); // auto +static bool v__ast__IfExpr_struct_eq(v__ast__IfExpr a, v__ast__IfExpr b); // auto +static bool Array_v__ast__IfBranch_arr_eq(Array_v__ast__IfBranch a, Array_v__ast__IfBranch b); // auto +static bool v__ast__IfBranch_struct_eq(v__ast__IfBranch a, v__ast__IfBranch b); // auto +static bool v__ast__IfGuardExpr_struct_eq(v__ast__IfGuardExpr a, v__ast__IfGuardExpr b); // auto +static bool Array_v__ast__IfGuardVar_arr_eq(Array_v__ast__IfGuardVar a, Array_v__ast__IfGuardVar b); // auto +static bool v__ast__IfGuardVar_struct_eq(v__ast__IfGuardVar a, v__ast__IfGuardVar b); // auto +static bool v__ast__IndexExpr_struct_eq(v__ast__IndexExpr a, v__ast__IndexExpr b); // auto +static bool v__ast__InfixExpr_struct_eq(v__ast__InfixExpr a, v__ast__InfixExpr b); // auto +static bool v__ast__IsRefType_struct_eq(v__ast__IsRefType a, v__ast__IsRefType b); // auto +static bool v__ast__Likely_struct_eq(v__ast__Likely a, v__ast__Likely b); // auto +static bool v__ast__LockExpr_struct_eq(v__ast__LockExpr a, v__ast__LockExpr b); // auto +static bool Array_bool_arr_eq(Array_bool a, Array_bool b); // auto +static bool v__ast__MapInit_struct_eq(v__ast__MapInit a, v__ast__MapInit b); // auto +static bool v__ast__MatchExpr_struct_eq(v__ast__MatchExpr a, v__ast__MatchExpr b); // auto +static bool Array_v__ast__MatchBranch_arr_eq(Array_v__ast__MatchBranch a, Array_v__ast__MatchBranch b); // auto +static bool v__ast__MatchBranch_struct_eq(v__ast__MatchBranch a, v__ast__MatchBranch b); // auto +static bool v__ast__NodeError_struct_eq(v__ast__NodeError a, v__ast__NodeError b); // auto +static bool v__ast__None_struct_eq(v__ast__None a, v__ast__None b); // auto +static bool v__ast__OffsetOf_struct_eq(v__ast__OffsetOf a, v__ast__OffsetOf b); // auto +static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b); // auto +static bool v__ast__PostfixExpr_struct_eq(v__ast__PostfixExpr a, v__ast__PostfixExpr b); // auto +static bool v__ast__PrefixExpr_struct_eq(v__ast__PrefixExpr a, v__ast__PrefixExpr b); // auto +static bool v__ast__RangeExpr_struct_eq(v__ast__RangeExpr a, v__ast__RangeExpr b); // auto +static bool v__ast__SelectExpr_struct_eq(v__ast__SelectExpr a, v__ast__SelectExpr b); // auto +static bool Array_v__ast__SelectBranch_arr_eq(Array_v__ast__SelectBranch a, Array_v__ast__SelectBranch b); // auto +static bool v__ast__SelectBranch_struct_eq(v__ast__SelectBranch a, v__ast__SelectBranch b); // auto +static bool v__ast__SelectorExpr_struct_eq(v__ast__SelectorExpr a, v__ast__SelectorExpr b); // auto +static bool v__ast__SizeOf_struct_eq(v__ast__SizeOf a, v__ast__SizeOf b); // auto +static bool v__ast__SqlExpr_struct_eq(v__ast__SqlExpr a, v__ast__SqlExpr b); // auto +static bool v__ast__TypeNode_struct_eq(v__ast__TypeNode a, v__ast__TypeNode b); // auto +static bool Array_v__ast__StructField_arr_eq(Array_v__ast__StructField a, Array_v__ast__StructField b); // auto +static bool Map_int_v__ast__SqlExpr_map_eq(Map_int_v__ast__SqlExpr a, Map_int_v__ast__SqlExpr b); // auto +static bool v__ast__StringInterLiteral_struct_eq(v__ast__StringInterLiteral a, v__ast__StringInterLiteral b); // auto +static bool Array_int_arr_eq(Array_int a, Array_int b); // auto +static bool Array_v__token__Pos_arr_eq(Array_v__token__Pos a, Array_v__token__Pos b); // auto +static bool v__ast__StringLiteral_struct_eq(v__ast__StringLiteral a, v__ast__StringLiteral b); // auto +static bool v__ast__StructInit_struct_eq(v__ast__StructInit a, v__ast__StructInit b); // auto +static bool Array_v__ast__StructInitField_arr_eq(Array_v__ast__StructInitField a, Array_v__ast__StructInitField b); // auto +static bool v__ast__StructInitField_struct_eq(v__ast__StructInitField a, v__ast__StructInitField b); // auto +static bool Array_v__ast__StructInitEmbed_arr_eq(Array_v__ast__StructInitEmbed a, Array_v__ast__StructInitEmbed b); // auto +static bool v__ast__StructInitEmbed_struct_eq(v__ast__StructInitEmbed a, v__ast__StructInitEmbed b); // auto +static bool v__ast__TypeOf_struct_eq(v__ast__TypeOf a, v__ast__TypeOf b); // auto +static bool v__ast__UnsafeExpr_struct_eq(v__ast__UnsafeExpr a, v__ast__UnsafeExpr b); // auto +static bool v__ast__AssertStmt_struct_eq(v__ast__AssertStmt a, v__ast__AssertStmt b); // auto +static bool v__ast__AssignStmt_struct_eq(v__ast__AssignStmt a, v__ast__AssignStmt b); // auto +static bool v__ast__Block_struct_eq(v__ast__Block a, v__ast__Block b); // auto +static bool v__ast__BranchStmt_struct_eq(v__ast__BranchStmt a, v__ast__BranchStmt b); // auto +static bool v__ast__ComptimeFor_struct_eq(v__ast__ComptimeFor a, v__ast__ComptimeFor b); // auto +static bool v__ast__ConstDecl_struct_eq(v__ast__ConstDecl a, v__ast__ConstDecl b); // auto +static bool Array_v__ast__ConstField_arr_eq(Array_v__ast__ConstField a, Array_v__ast__ConstField b); // auto +static bool v__ast__EmptyStmt_struct_eq(v__ast__EmptyStmt a, v__ast__EmptyStmt b); // auto +static bool v__ast__EnumDecl_struct_eq(v__ast__EnumDecl a, v__ast__EnumDecl b); // auto +static bool Array_v__ast__EnumField_arr_eq(Array_v__ast__EnumField a, Array_v__ast__EnumField b); // auto +static bool v__ast__EnumField_struct_eq(v__ast__EnumField a, v__ast__EnumField b); // auto +static bool v__ast__ExprStmt_struct_eq(v__ast__ExprStmt a, v__ast__ExprStmt b); // auto +static bool v__ast__ForCStmt_struct_eq(v__ast__ForCStmt a, v__ast__ForCStmt b); // auto +static bool v__ast__ForInStmt_struct_eq(v__ast__ForInStmt a, v__ast__ForInStmt b); // auto +static bool v__ast__ForStmt_struct_eq(v__ast__ForStmt a, v__ast__ForStmt b); // auto +static bool v__ast__GlobalDecl_struct_eq(v__ast__GlobalDecl a, v__ast__GlobalDecl b); // auto +static bool Array_v__ast__GlobalField_arr_eq(Array_v__ast__GlobalField a, Array_v__ast__GlobalField b); // auto +static bool v__ast__GotoLabel_struct_eq(v__ast__GotoLabel a, v__ast__GotoLabel b); // auto +static bool v__ast__GotoStmt_struct_eq(v__ast__GotoStmt a, v__ast__GotoStmt b); // auto +static bool v__ast__HashStmt_struct_eq(v__ast__HashStmt a, v__ast__HashStmt b); // auto +static bool v__ast__InterfaceDecl_struct_eq(v__ast__InterfaceDecl a, v__ast__InterfaceDecl b); // auto +static bool Array_v__ast__FnDecl_arr_eq(Array_v__ast__FnDecl a, Array_v__ast__FnDecl b); // auto +static bool Array_v__ast__InterfaceEmbedding_arr_eq(Array_v__ast__InterfaceEmbedding a, Array_v__ast__InterfaceEmbedding b); // auto +static bool v__ast__InterfaceEmbedding_struct_eq(v__ast__InterfaceEmbedding a, v__ast__InterfaceEmbedding b); // auto +static bool v__ast__Return_struct_eq(v__ast__Return a, v__ast__Return b); // auto +static bool v__ast__SqlStmt_struct_eq(v__ast__SqlStmt a, v__ast__SqlStmt b); // auto +static bool Array_v__ast__SqlStmtLine_arr_eq(Array_v__ast__SqlStmtLine a, Array_v__ast__SqlStmtLine b); // auto +static bool v__ast__SqlStmtLine_struct_eq(v__ast__SqlStmtLine a, v__ast__SqlStmtLine b); // auto +static bool Map_int_v__ast__SqlStmtLine_map_eq(Map_int_v__ast__SqlStmtLine a, Map_int_v__ast__SqlStmtLine b); // auto +static bool v__ast__StructDecl_struct_eq(v__ast__StructDecl a, v__ast__StructDecl b); // auto +static bool Array_v__ast__Embed_arr_eq(Array_v__ast__Embed a, Array_v__ast__Embed b); // auto +static bool v__ast__Embed_struct_eq(v__ast__Embed a, v__ast__Embed b); // auto +static bool v__ast__TypeDecl_sumtype_eq(v__ast__TypeDecl a, v__ast__TypeDecl b); // auto +static bool v__ast__AliasTypeDecl_struct_eq(v__ast__AliasTypeDecl a, v__ast__AliasTypeDecl b); // auto +static bool v__ast__FnTypeDecl_struct_eq(v__ast__FnTypeDecl a, v__ast__FnTypeDecl b); // auto +static bool v__ast__SumTypeDecl_struct_eq(v__ast__SumTypeDecl a, v__ast__SumTypeDecl b); // auto +static bool Array_v__ast__TypeNode_arr_eq(Array_v__ast__TypeNode a, Array_v__ast__TypeNode b); // auto +static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b); // auto +static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b); // auto void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it); // auto void Array_v__ast__Fn_free(Array_v__ast__Fn* it); // auto void v__ast__Fn_free(v__ast__Fn* it); // auto @@ -10929,6 +11125,7 @@ static string v__ast__IdentKind_str(v__ast__IdentKind it) { /* gen_str_for_enum default: return _SLIT("unknown enum value"); } } +static string anon_fn_v__ast__constdecl_str() { return _SLIT("fn (mut v.ast.ConstDecl)");} static string v__token__Pos_str(v__token__Pos it) { return indent_v__token__Pos_str(it, 0);} static string Array_v__ast__Attr_str(Array_v__ast__Attr a) { return indent_Array_v__ast__Attr_str(a, 0);} static string indent_Array_v__ast__Attr_str(Array_v__ast__Attr a, int indent_count) { @@ -11306,11 +11503,11 @@ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) { switch(x._typ) { - case 433: return str_intp(2, _MOV((StrIntpData[]){ + case 434: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Aggregate_str(*(v__ast__Aggregate*)x._v__ast__Aggregate, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 435: return str_intp(2, _MOV((StrIntpData[]){ + case 436: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Alias_str(*(v__ast__Alias*)x._v__ast__Alias, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11318,27 +11515,27 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Array_str(*(v__ast__Array*)x._v__ast__Array, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 443: return str_intp(2, _MOV((StrIntpData[]){ + case 444: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__ArrayFixed_str(*(v__ast__ArrayFixed*)x._v__ast__ArrayFixed, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 444: return str_intp(2, _MOV((StrIntpData[]){ + case 445: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Chan_str(*(v__ast__Chan*)x._v__ast__Chan, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 449: return str_intp(2, _MOV((StrIntpData[]){ + case 450: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Enum_str(*(v__ast__Enum*)x._v__ast__Enum, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 447: return str_intp(2, _MOV((StrIntpData[]){ + case 448: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__FnType_str(*(v__ast__FnType*)x._v__ast__FnType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 448: return str_intp(2, _MOV((StrIntpData[]){ + case 449: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__GenericInst_str(*(v__ast__GenericInst*)x._v__ast__GenericInst, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 438: return str_intp(2, _MOV((StrIntpData[]){ + case 439: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Interface_str(*(v__ast__Interface*)x._v__ast__Interface, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11346,7 +11543,7 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Map_str(*(v__ast__Map*)x._v__ast__Map, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 446: return str_intp(2, _MOV((StrIntpData[]){ + case 447: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__MultiReturn_str(*(v__ast__MultiReturn*)x._v__ast__MultiReturn, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11354,11 +11551,11 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Struct_str(*(v__ast__Struct*)x._v__ast__Struct, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 439: return str_intp(2, _MOV((StrIntpData[]){ + case 440: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__SumType_str(*(v__ast__SumType*)x._v__ast__SumType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 445: return str_intp(2, _MOV((StrIntpData[]){ + case 446: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Thread_str(*(v__ast__Thread*)x._v__ast__Thread, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11910,11 +12107,13 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ string _t83 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); string _t84 = v__ast__Type_str(it.default_expr_typ); string _t85 = v__ast__Type_str(it.typ); - string res = str_intp( 63, _MOV((StrIntpData[]){ + string res = str_intp( 75, _MOV((StrIntpData[]){ {_SLIT("v.ast.StructField{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t79}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t80}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_val: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.default_val}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" deprecation_msg: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.deprecation_msg}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" deprecated_after: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.deprecated_after}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t81}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t82}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11927,6 +12126,7 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_mut: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_mut ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_global: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_global ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_volatile: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_volatile ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_deprecated: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_deprecated ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t85); @@ -12062,12 +12262,12 @@ static inline v__ast__Expr v__ast__StructInit_to_sumtype_v__ast__Expr(v__ast__St static inline v__ast__TypeInfo v__ast__SumType_to_sumtype_v__ast__TypeInfo(v__ast__SumType* x) { v__ast__SumType* ptr = memdup(x, sizeof(v__ast__SumType)); - return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 439}; + return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 440}; } static inline v__ast__TypeInfo v__ast__Chan_to_sumtype_v__ast__TypeInfo(v__ast__Chan* x) { v__ast__Chan* ptr = memdup(x, sizeof(v__ast__Chan)); - return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 444}; + return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 445}; } static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__Map* x) { @@ -12077,7 +12277,7 @@ static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__M static inline v__ast__TypeInfo v__ast__Thread_to_sumtype_v__ast__TypeInfo(v__ast__Thread* x) { v__ast__Thread* ptr = memdup(x, sizeof(v__ast__Thread)); - return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 445}; + return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 446}; } static inline v__ast__TypeInfo v__ast__Struct_to_sumtype_v__ast__TypeInfo(v__ast__Struct* x) { @@ -12092,17 +12292,17 @@ static inline v__ast__TypeInfo v__ast__Array_to_sumtype_v__ast__TypeInfo(v__ast_ static inline v__ast__TypeInfo v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(v__ast__ArrayFixed* x) { v__ast__ArrayFixed* ptr = memdup(x, sizeof(v__ast__ArrayFixed)); - return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 443}; + return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 444}; } static inline v__ast__TypeInfo v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(v__ast__MultiReturn* x) { v__ast__MultiReturn* ptr = memdup(x, sizeof(v__ast__MultiReturn)); - return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 446}; + return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 447}; } static inline v__ast__TypeInfo v__ast__FnType_to_sumtype_v__ast__TypeInfo(v__ast__FnType* x) { v__ast__FnType* ptr = memdup(x, sizeof(v__ast__FnType)); - return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 447}; + return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 448}; } static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) { @@ -12112,7 +12312,7 @@ static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) static inline v__ast__TypeInfo v__ast__Interface_to_sumtype_v__ast__TypeInfo(v__ast__Interface* x) { v__ast__Interface* ptr = memdup(x, sizeof(v__ast__Interface)); - return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 438}; + return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 439}; } static inline v__ast__IdentInfo v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(v__ast__IdentVar* x) { @@ -12140,6 +12340,11 @@ static inline v__ast__ScopeObject v__ast__Var_to_sumtype_v__ast__ScopeObject(v__ return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 328, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; } +static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { + v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); + return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 326, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; +} + static inline v__ast__IdentInfo v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(v__ast__IdentFn* x) { v__ast__IdentFn* ptr = memdup(x, sizeof(v__ast__IdentFn)); return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 379}; @@ -12217,7 +12422,7 @@ static inline v__ast__Stmt v__ast__Return_to_sumtype_v__ast__Stmt(v__ast__Return static inline v__ast__TypeInfo v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(v__ast__Aggregate* x) { v__ast__Aggregate* ptr = memdup(x, sizeof(v__ast__Aggregate)); - return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 433}; + return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 434}; } static inline v__ast__Expr v__ast__Ident_to_sumtype_v__ast__Expr(v__ast__Ident* x) { @@ -12442,7 +12647,7 @@ static inline v__ast__Expr v__ast__RangeExpr_to_sumtype_v__ast__Expr(v__ast__Ran static inline v__ast__TypeInfo v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(v__ast__GenericInst* x) { v__ast__GenericInst* ptr = memdup(x, sizeof(v__ast__GenericInst)); - return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 448}; + return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 449}; } static inline v__ast__Stmt v__ast__Module_to_sumtype_v__ast__Stmt(v__ast__Module* x) { @@ -12570,11 +12775,6 @@ static inline v__ast__Expr v__ast__StringInterLiteral_to_sumtype_v__ast__Expr(v_ return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 293}; } -static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { - v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 326, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; -} - static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 327, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; @@ -12582,7 +12782,7 @@ static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeOb static inline v__ast__TypeInfo v__ast__Enum_to_sumtype_v__ast__TypeInfo(v__ast__Enum* x) { v__ast__Enum* ptr = memdup(x, sizeof(v__ast__Enum)); - return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 449}; + return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 450}; } static inline v__ast__TypeDecl v__ast__SumTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__SumTypeDecl* x) { @@ -12602,7 +12802,7 @@ static inline v__ast__TypeDecl v__ast__AliasTypeDecl_to_sumtype_v__ast__TypeDecl static inline v__ast__TypeInfo v__ast__Alias_to_sumtype_v__ast__TypeInfo(v__ast__Alias* x) { v__ast__Alias* ptr = memdup(x, sizeof(v__ast__Alias)); - return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 435}; + return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 436}; } static inline v__ast__Node v__ast__File_to_sumtype_v__ast__Node(v__ast__File* x) { @@ -12762,31 +12962,681 @@ static bool Array_v__ast__Type_arr_eq(Array_v__ast__Type a, Array_v__ast__Type b return true; } -static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b) { +static bool v__ast__AsmRegister_struct_eq(v__ast__AsmRegister a, v__ast__AsmRegister b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.size == b.size; +} + +static bool v__ast__Comment_struct_eq(v__ast__Comment a, v__ast__Comment b) { + return string__eq(a.text, b.text) + && a.is_multi == b.is_multi + && a.is_inline == b.is_inline + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__Comment_arr_eq(Array_v__ast__Comment a, Array_v__ast__Comment b) { if (a.len != b.len) { return false; } - for (int i = 0; i < a.key_values.len; ++i) { - if (!DenseArray_has_index(&a.key_values, i)) continue; - voidptr k = DenseArray_key(&a.key_values, i); - if (!map_exists(&b, k)) return false; - string v = *(string*)map_get(&a, k, &(string[]){ 0 }); - if (!fast_string_eq(*(string*)map_get(&b, k, &(string[]){_SLIT("")}), v)) { + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Comment_struct_eq(((v__ast__Comment*)a.data)[i], ((v__ast__Comment*)b.data)[i])) { return false; } } return true; } -static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b) { - return string__eq(a.styp, b.styp) +static bool v__ast__AsmClobbered_struct_eq(v__ast__AsmClobbered a, v__ast__AsmClobbered b) { + return v__ast__AsmRegister_struct_eq(a.reg, b.reg) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__AsmClobbered_arr_eq(Array_v__ast__AsmClobbered a, Array_v__ast__AsmClobbered b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmClobbered_struct_eq(((v__ast__AsmClobbered*)a.data)[i], ((v__ast__AsmClobbered*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmAddressing_struct_eq(v__ast__AsmAddressing a, v__ast__AsmAddressing b) { + return a.scale == b.scale + && a.mode == b.mode + && v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.segment, b.segment) + && v__ast__AsmArg_sumtype_eq(a.displacement, b.displacement) + && v__ast__AsmArg_sumtype_eq(a.base, b.base) + && v__ast__AsmArg_sumtype_eq(a.index, b.index); +} + +static bool v__ast__AsmAlias_struct_eq(v__ast__AsmAlias a, v__ast__AsmAlias b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.name, b.name); +} + +static bool v__ast__AsmDisp_struct_eq(v__ast__AsmDisp a, v__ast__AsmDisp b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__BoolLiteral_struct_eq(v__ast__BoolLiteral a, v__ast__BoolLiteral b) { + return a.val == b.val + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__CharLiteral_struct_eq(v__ast__CharLiteral a, v__ast__CharLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__FloatLiteral_struct_eq(v__ast__FloatLiteral a, v__ast__FloatLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__IntegerLiteral_struct_eq(v__ast__IntegerLiteral a, v__ast__IntegerLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__AsmArg_sumtype_eq(v__ast__AsmArg a, v__ast__AsmArg b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 400) { + return v__ast__AsmAddressing_struct_eq(*a._v__ast__AsmAddressing, *b._v__ast__AsmAddressing); + } + if (a._typ == 401) { + return v__ast__AsmAlias_struct_eq(*a._v__ast__AsmAlias, *b._v__ast__AsmAlias); + } + if (a._typ == 402) { + return v__ast__AsmDisp_struct_eq(*a._v__ast__AsmDisp, *b._v__ast__AsmDisp); + } + if (a._typ == 325) { + return v__ast__AsmRegister_struct_eq(*a._v__ast__AsmRegister, *b._v__ast__AsmRegister); + } + if (a._typ == 254) { + return v__ast__BoolLiteral_struct_eq(*a._v__ast__BoolLiteral, *b._v__ast__BoolLiteral); + } + if (a._typ == 259) { + return v__ast__CharLiteral_struct_eq(*a._v__ast__CharLiteral, *b._v__ast__CharLiteral); + } + if (a._typ == 268) { + return v__ast__FloatLiteral_struct_eq(*a._v__ast__FloatLiteral, *b._v__ast__FloatLiteral); + } + if (a._typ == 275) { + return v__ast__IntegerLiteral_struct_eq(*a._v__ast__IntegerLiteral, *b._v__ast__IntegerLiteral); + } + if (a._typ == 20) { + return string__eq(*a._string, *b._string); + } + return false; +} + +static bool Array_v__ast__AsmArg_arr_eq(Array_v__ast__AsmArg a, Array_v__ast__AsmArg b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmArg_sumtype_eq(((v__ast__AsmArg*)a.data)[i], ((v__ast__AsmArg*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmTemplate_struct_eq(v__ast__AsmTemplate a, v__ast__AsmTemplate b) { + return Array_v__ast__AsmArg_arr_eq(a.args, b.args) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_label == b.is_label + && a.is_directive == b.is_directive; +} + +static bool Array_v__ast__AsmTemplate_arr_eq(Array_v__ast__AsmTemplate a, Array_v__ast__AsmTemplate b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmTemplate_struct_eq(((v__ast__AsmTemplate*)a.data)[i], ((v__ast__AsmTemplate*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__Attr_struct_eq(v__ast__Attr a, v__ast__Attr b) { + return string__eq(a.name, b.name) + && string__eq(a.arg, b.arg) + && v__ast__Expr_sumtype_eq(a.ct_expr, b.ct_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind + && a.has_arg == b.has_arg + && a.ct_opt == b.ct_opt + && a.ct_evaled == b.ct_evaled + && a.ct_skip == b.ct_skip; +} + +static bool Array_v__ast__Attr_arr_eq(Array_v__ast__Attr a, Array_v__ast__Attr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Attr_struct_eq(((v__ast__Attr*)a.data)[i], ((v__ast__Attr*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructField_struct_eq(v__ast__StructField a, v__ast__StructField b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && string__eq(a.default_val, b.default_val) + && string__eq(a.deprecation_msg, b.deprecation_msg) + && string__eq(a.deprecated_after, b.deprecated_after) + && v__ast__Expr_sumtype_eq(a.default_expr, b.default_expr) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && a.i == b.i + && v__ast__Type_alias_eq(a.default_expr_typ, b.default_expr_typ) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_default_expr == b.has_default_expr + && a.is_pub == b.is_pub + && a.is_mut == b.is_mut + && a.is_global == b.is_global + && a.is_volatile == b.is_volatile + && a.is_deprecated == b.is_deprecated; +} + +static bool v__ast__Param_struct_eq(v__ast__Param a, v__ast__Param b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_mut == b.is_mut + && a.is_auto_rec == b.is_auto_rec + && a.is_hidden == b.is_hidden; +} + +static bool Array_v__ast__Param_arr_eq(Array_v__ast__Param a, Array_v__ast__Param b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Param_struct_eq(((v__ast__Param*)a.data)[i], ((v__ast__Param*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__Stmt_arr_eq(Array_v__ast__Stmt a, Array_v__ast__Stmt b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Stmt_sumtype_eq(((v__ast__Stmt*)a.data)[i], ((v__ast__Stmt*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__EmptyExpr_struct_eq(v__ast__EmptyExpr a, v__ast__EmptyExpr b) { + return a.x == b.x; +} + +static bool v__ast__ComptTimeConstValue_sumtype_eq(v__ast__ComptTimeConstValue a, v__ast__ComptTimeConstValue b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 266) { + return v__ast__EmptyExpr_struct_eq(*a._v__ast__EmptyExpr, *b._v__ast__EmptyExpr); + } + if (a._typ == 15) { + return *a._f32 == *b._f32; + } + if (a._typ == 16) { + return *a._f64 == *b._f64; + } + if (a._typ == 6) { + return *a._i16 == *b._i16; + } + if (a._typ == 8) { + return *a._i64 == *b._i64; + } + if (a._typ == 5) { + return *a._i8 == *b._i8; + } + if (a._typ == 7) { + return *a._int == *b._int; + } + if (a._typ == 21) { + return *a._rune == *b._rune; + } + if (a._typ == 20) { + return string__eq(*a._string, *b._string); + } + if (a._typ == 11) { + return *a._u16 == *b._u16; + } + if (a._typ == 12) { + return *a._u32 == *b._u32; + } + if (a._typ == 13) { + return *a._u64 == *b._u64; + } + if (a._typ == 10) { + return *a._u8 == *b._u8; + } + return false; +} + +static bool v__ast__ConstField_struct_eq(v__ast__ConstField a, v__ast__ConstField b) { + return string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && a.is_markused == b.is_markused + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && v__ast__ComptTimeConstValue_sumtype_eq(a.comptime_expr_value, b.comptime_expr_value); +} + +static bool v__ast__GlobalField_struct_eq(v__ast__GlobalField a, v__ast__GlobalField b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.typ_pos, b.typ_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_expr == b.has_expr + && a.is_markused == b.is_markused + && a.is_volatile == b.is_volatile; +} + +static bool v__ast__Var_struct_eq(v__ast__Var a, v__ast__Var b) { + return Array_v__ast__Type_arr_eq(a.smartcasts, b.smartcasts) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.orig_type, b.orig_type) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_autofree_tmp == b.is_autofree_tmp + && a.is_arg == b.is_arg + && a.is_auto_deref == b.is_auto_deref + && a.is_inherited == b.is_inherited + && a.is_used == b.is_used + && a.is_changed == b.is_changed + && a.is_or == b.is_or + && a.is_tmp == b.is_tmp + && a.is_auto_heap == b.is_auto_heap + && a.is_stack_obj == b.is_stack_obj; +} + +static bool v__ast__ScopeObject_sumtype_eq(v__ast__ScopeObject a, v__ast__ScopeObject b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 325) { + return v__ast__AsmRegister_struct_eq(*a._v__ast__AsmRegister, *b._v__ast__AsmRegister); + } + if (a._typ == 326) { + return v__ast__ConstField_struct_eq(*a._v__ast__ConstField, *b._v__ast__ConstField); + } + if (a._typ == 327) { + return v__ast__GlobalField_struct_eq(*a._v__ast__GlobalField, *b._v__ast__GlobalField); + } + if (a._typ == 328) { + return v__ast__Var_struct_eq(*a._v__ast__Var, *b._v__ast__Var); + } + return false; +} + +static bool v__ast__IdentFn_struct_eq(v__ast__IdentFn a, v__ast__IdentFn b) { + return v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__IdentVar_struct_eq(v__ast__IdentVar a, v__ast__IdentVar b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_static == b.is_static + && a.is_volatile == b.is_volatile + && a.is_optional == b.is_optional; +} + +static bool v__ast__IdentInfo_sumtype_eq(v__ast__IdentInfo a, v__ast__IdentInfo b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 379) { + return v__ast__IdentFn_struct_eq(*a._v__ast__IdentFn, *b._v__ast__IdentFn); + } + if (a._typ == 380) { + return v__ast__IdentVar_struct_eq(*a._v__ast__IdentVar, *b._v__ast__IdentVar); + } + return false; +} + +static bool v__ast__Ident_struct_eq(v__ast__Ident a, v__ast__Ident b) { + return v__ast__ScopeObject_sumtype_eq(a.obj, b.obj) + && string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && v__ast__IdentInfo_sumtype_eq(a.info, b.info) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mut_pos, b.mut_pos) + && a.tok_kind == b.tok_kind + && a.language == b.language + && a.kind == b.kind + && a.comptime == b.comptime + && a.is_mut == b.is_mut; +} + +static bool Array_v__ast__Ident_arr_eq(Array_v__ast__Ident a, Array_v__ast__Ident b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Ident_struct_eq(((v__ast__Ident*)a.data)[i], ((v__ast__Ident*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__DeferStmt_struct_eq(v__ast__DeferStmt a, v__ast__DeferStmt b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Ident_arr_eq(a.defer_vars, b.defer_vars) + && string__eq(a.ifdef, b.ifdef) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.idx_in_fn == b.idx_in_fn; +} + +static bool Array_v__ast__DeferStmt_arr_eq(Array_v__ast__DeferStmt a, Array_v__ast__DeferStmt b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__DeferStmt_struct_eq(((v__ast__DeferStmt*)a.data)[i], ((v__ast__DeferStmt*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__FnDecl_struct_eq(v__ast__FnDecl a, v__ast__FnDecl b) { + return v__ast__StructField_struct_eq(a.receiver, b.receiver) + && Array_string_arr_eq(a.generic_names, b.generic_names) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__Param_arr_eq(a.params, b.params) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__DeferStmt_arr_eq(a.defer_stmts, b.defer_stmts) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && Array_string_arr_eq(a.label_names, b.label_names) + && string__eq(a.name, b.name) + && string__eq(a.short_name, b.short_name) + && string__eq(a.mod, b.mod) + && string__eq(a.file, b.file) + && a.source_file == b.source_file + && a.scope == b.scope + && v__token__Pos_struct_eq(a.receiver_pos, b.receiver_pos) + && v__token__Pos_struct_eq(a.method_type_pos, b.method_type_pos) + && v__token__Pos_struct_eq(a.body_pos, b.body_pos) + && v__token__Pos_struct_eq(a.return_type_pos, b.return_type_pos) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.method_idx == b.method_idx + && a.ctdefine_idx == b.ctdefine_idx + && a.idx == b.idx + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && a.ninstances == b.ninstances + && a.language == b.language + && a.file_mode == b.file_mode + && a.rec_share == b.rec_share + && a.is_deprecated == b.is_deprecated + && a.is_pub == b.is_pub + && a.is_variadic == b.is_variadic + && a.is_anon == b.is_anon + && a.is_noreturn == b.is_noreturn + && a.is_manualfree == b.is_manualfree + && a.is_main == b.is_main + && a.is_test == b.is_test + && a.is_conditional == b.is_conditional + && a.is_exported == b.is_exported + && a.is_keep_alive == b.is_keep_alive + && a.is_unsafe == b.is_unsafe + && a.is_markused == b.is_markused + && a.is_method == b.is_method + && a.rec_mut == b.rec_mut + && a.no_body == b.no_body + && a.is_builtin == b.is_builtin + && a.is_direct_arr == b.is_direct_arr + && a.has_return == b.has_return + && a.should_be_skipped == b.should_be_skipped + && a.has_await == b.has_await; +} + +static bool v__ast__AnonFn_struct_eq(v__ast__AnonFn a, v__ast__AnonFn b) { + return v__ast__FnDecl_struct_eq(a.decl, b.decl) + && Array_v__ast__Param_arr_eq(a.inherited_vars, b.inherited_vars) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_gen == b.has_gen; +} + +static bool v__ast__ArrayDecompose_struct_eq(v__ast__ArrayDecompose a, v__ast__ArrayDecompose b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && v__ast__Type_alias_eq(a.arg_type, b.arg_type); +} + +static bool Array_Array_v__ast__Comment_arr_eq(Array_Array_v__ast__Comment a, Array_Array_v__ast__Comment b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!Array_v__ast__Comment_arr_eq(((Array_v__ast__Comment*)a.data)[i], ((Array_v__ast__Comment*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__Expr_arr_eq(Array_v__ast__Expr a, Array_v__ast__Expr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Expr_sumtype_eq(((v__ast__Expr*)a.data)[i], ((v__ast__Expr*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__ArrayInit_struct_eq(v__ast__ArrayInit a, v__ast__ArrayInit b) { + return Array_Array_v__ast__Comment_arr_eq(a.ecmnts, b.ecmnts) + && Array_v__ast__Comment_arr_eq(a.pre_cmnts, b.pre_cmnts) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.expr_types, b.expr_types) + && string__eq(a.mod, b.mod) + && v__ast__Expr_sumtype_eq(a.len_expr, b.len_expr) + && v__ast__Expr_sumtype_eq(a.cap_expr, b.cap_expr) + && v__ast__Expr_sumtype_eq(a.default_expr, b.default_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.elem_type_pos, b.elem_type_pos) + && v__ast__Type_alias_eq(a.elem_type, b.elem_type) + && v__ast__Type_alias_eq(a.default_type, b.default_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_fixed == b.is_fixed + && a.has_val == b.has_val + && a.has_len == b.has_len + && a.has_cap == b.has_cap + && a.has_default == b.has_default + && a.has_it == b.has_it; +} + +static bool v__ast__AsCast_struct_eq(v__ast__AsCast a, v__ast__AsCast b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__Assoc_struct_eq(v__ast__Assoc a, v__ast__Assoc b) { + return Array_string_arr_eq(a.fields, b.fields) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && string__eq(a.var_name, b.var_name) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) && v__ast__Type_alias_eq(a.typ, b.typ); } -static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b) { - return string__eq(a.fn_name, b.fn_name) - && v__ast__Type_alias_eq(a.got, b.got) - && v__ast__Type_alias_eq(a.exp, b.exp); +static bool v__ast__AtExpr_struct_eq(v__ast__AtExpr a, v__ast__AtExpr b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind + && string__eq(a.val, b.val); +} + +static bool v__ast__CTempVar_struct_eq(v__ast__CTempVar a, v__ast__CTempVar b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_ptr == b.is_ptr + && v__ast__Expr_sumtype_eq(a.orig, b.orig); +} + +static bool v__ast__OrExpr_struct_eq(v__ast__OrExpr a, v__ast__OrExpr b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__CallArg_struct_eq(v__ast__CallArg a, v__ast__CallArg b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_tmp_autofree == b.is_tmp_autofree; +} + +static bool Array_v__ast__CallArg_arr_eq(Array_v__ast__CallArg a, Array_v__ast__CallArg b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__CallArg_struct_eq(((v__ast__CallArg*)a.data)[i], ((v__ast__CallArg*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__CallExpr_struct_eq(v__ast__CallExpr a, v__ast__CallExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && Array_v__ast__CallArg_arr_eq(a.args, b.args) + && Array_v__ast__Type_arr_eq(a.expected_arg_types, b.expected_arg_types) + && Array_v__ast__Type_arr_eq(a.concrete_types, b.concrete_types) + && Array_v__ast__Type_arr_eq(a.raw_concrete_types, b.raw_concrete_types) + && Array_v__ast__Type_arr_eq(a.from_embed_types, b.from_embed_types) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__token__Pos_struct_eq(a.concrete_list_pos, b.concrete_list_pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.receiver_type, b.receiver_type) + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && v__ast__Type_alias_eq(a.fn_var_type, b.fn_var_type) + && a.language == b.language + && a.is_method == b.is_method + && a.is_field == b.is_field + && a.is_fn_var == b.is_fn_var + && a.is_keep_alive == b.is_keep_alive + && a.is_noreturn == b.is_noreturn + && a.is_ctor_new == b.is_ctor_new + && a.should_be_skipped == b.should_be_skipped + && a.free_receiver == b.free_receiver; +} + +static bool v__ast__CastExpr_struct_eq(v__ast__CastExpr a, v__ast__CastExpr b) { + return v__ast__Expr_sumtype_eq(a.arg, b.arg) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.typname, b.typname) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && a.has_arg == b.has_arg; +} + +static bool v__ast__ChanInit_struct_eq(v__ast__ChanInit a, v__ast__ChanInit b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_cap == b.has_cap + && v__ast__Expr_sumtype_eq(a.cap_expr, b.cap_expr) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.elem_type, b.elem_type); +} + +static bool v__ast__Module_struct_eq(v__ast__Module a, v__ast__Module b) { + return string__eq(a.name, b.name) + && string__eq(a.short_name, b.short_name) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && a.is_skipped == b.is_skipped; +} + +static bool v__ast__ImportSymbol_struct_eq(v__ast__ImportSymbol a, v__ast__ImportSymbol b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.name, b.name); +} + +static bool Array_v__ast__ImportSymbol_arr_eq(Array_v__ast__ImportSymbol a, Array_v__ast__ImportSymbol b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__ImportSymbol_struct_eq(((v__ast__ImportSymbol*)a.data)[i], ((v__ast__ImportSymbol*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__Import_struct_eq(v__ast__Import a, v__ast__Import b) { + return string__eq(a.mod, b.mod) + && string__eq(a.alias, b.alias) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mod_pos, b.mod_pos) + && v__token__Pos_struct_eq(a.alias_pos, b.alias_pos) + && v__token__Pos_struct_eq(a.syms_pos, b.syms_pos) + && Array_v__ast__ImportSymbol_arr_eq(a.syms, b.syms) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments); +} + +static bool Array_v__ast__Import_arr_eq(Array_v__ast__Import a, Array_v__ast__Import b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Import_struct_eq(((v__ast__Import*)a.data)[i], ((v__ast__Import*)b.data)[i])) { + return false; + } + } + return true; } static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b) { @@ -12810,6 +13660,1314 @@ static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__Embed && a.is_compressed == b.is_compressed; } +static bool Array_v__ast__EmbeddedFile_arr_eq(Array_v__ast__EmbeddedFile a, Array_v__ast__EmbeddedFile b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__EmbeddedFile_struct_eq(((v__ast__EmbeddedFile*)a.data)[i], ((v__ast__EmbeddedFile*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + string v = *(string*)map_get(&a, k, &(string[]){ 0 }); + if (!fast_string_eq(*(string*)map_get(&b, k, &(string[]){_SLIT("")}), v)) { + return false; + } + } + return true; +} + +static bool v__errors__Error_struct_eq(v__errors__Error a, v__errors__Error b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && string__eq(a.backtrace, b.backtrace) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Error_arr_eq(Array_v__errors__Error a, Array_v__errors__Error b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Error_struct_eq(((v__errors__Error*)a.data)[i], ((v__errors__Error*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__errors__Warning_struct_eq(v__errors__Warning a, v__errors__Warning b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Warning_arr_eq(Array_v__errors__Warning a, Array_v__errors__Warning b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Warning_struct_eq(((v__errors__Warning*)a.data)[i], ((v__errors__Warning*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__errors__Notice_struct_eq(v__errors__Notice a, v__errors__Notice b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Notice_arr_eq(Array_v__errors__Notice a, Array_v__errors__Notice b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Notice_struct_eq(((v__errors__Notice*)a.data)[i], ((v__errors__Notice*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__FnDecl_ptr_arr_eq(Array_v__ast__FnDecl_ptr a, Array_v__ast__FnDecl_ptr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((v__ast__FnDecl**)((byte*)a.data+(i*a.element_size))) != *((v__ast__FnDecl**)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool v__ast__File_struct_eq(v__ast__File a, v__ast__File b) { + return a.nr_lines == b.nr_lines + && a.nr_bytes == b.nr_bytes + && v__ast__Module_struct_eq(a.mod, b.mod) + && a.global_scope == b.global_scope + && a.is_test == b.is_test + && a.is_generated == b.is_generated + && a.is_translated == b.is_translated + && a.idx == b.idx + && string__eq(a.path, b.path) + && string__eq(a.path_base, b.path_base) + && a.scope == b.scope + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Import_arr_eq(a.imports, b.imports) + && Array_string_arr_eq(a.auto_imports, b.auto_imports) + && Array_v__ast__EmbeddedFile_arr_eq(a.embedded_files, b.embedded_files) + && Map_string_string_map_eq(a.imported_symbols, b.imported_symbols) + && Array_v__errors__Error_arr_eq(a.errors, b.errors) + && Array_v__errors__Warning_arr_eq(a.warnings, b.warnings) + && Array_v__errors__Notice_arr_eq(a.notices, b.notices) + && Array_v__ast__FnDecl_ptr_arr_eq(a.generic_fns, b.generic_fns) + && Array_string_arr_eq(a.global_labels, b.global_labels); +} + +static bool v__ast__ComptimeCall_struct_eq(v__ast__ComptimeCall a, v__ast__ComptimeCall b) { + return v__ast__File_struct_eq(a.vweb_tmpl, b.vweb_tmpl) + && v__ast__EmbeddedFile_struct_eq(a.embed_file, b.embed_file) + && Array_v__ast__CallArg_arr_eq(a.args, b.args) + && string__eq(a.method_name, b.method_name) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && string__eq(a.args_var, b.args_var) + && string__eq(a.env_value, b.env_value) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.method_pos, b.method_pos) + && v__token__Pos_struct_eq(a.env_pos, b.env_pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.result_type, b.result_type) + && a.has_parens == b.has_parens + && a.is_vweb == b.is_vweb + && a.is_embed == b.is_embed + && a.is_env == b.is_env + && a.is_pkgconfig == b.is_pkgconfig; +} + +static bool v__ast__ComptimeSelector_struct_eq(v__ast__ComptimeSelector a, v__ast__ComptimeSelector b) { + return v__ast__Expr_sumtype_eq(a.left, b.left) + && v__ast__Expr_sumtype_eq(a.field_expr, b.field_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_parens == b.has_parens; +} + +static bool v__ast__ComptimeType_struct_eq(v__ast__ComptimeType a, v__ast__ComptimeType b) { + return a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__ConcatExpr_struct_eq(v__ast__ConcatExpr a, v__ast__ConcatExpr b) { + return Array_v__ast__Expr_arr_eq(a.vals, b.vals) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.return_type, b.return_type); +} + +static bool v__ast__DumpExpr_struct_eq(v__ast__DumpExpr a, v__ast__DumpExpr b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.cname, b.cname) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__EnumVal_struct_eq(v__ast__EnumVal a, v__ast__EnumVal b) { + return string__eq(a.enum_name, b.enum_name) + && string__eq(a.val, b.val) + && string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__GoExpr_struct_eq(v__ast__GoExpr a, v__ast__GoExpr b) { + return v__ast__CallExpr_struct_eq(a.call_expr, b.call_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_expr == b.is_expr; +} + +static bool v__ast__IfBranch_struct_eq(v__ast__IfBranch a, v__ast__IfBranch b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.body_pos, b.body_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && a.pkg_exist == b.pkg_exist + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.scope == b.scope; +} + +static bool Array_v__ast__IfBranch_arr_eq(Array_v__ast__IfBranch a, Array_v__ast__IfBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__IfBranch_struct_eq(((v__ast__IfBranch*)a.data)[i], ((v__ast__IfBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__IfExpr_struct_eq(v__ast__IfExpr a, v__ast__IfExpr b) { + return Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && Array_v__ast__IfBranch_arr_eq(a.branches, b.branches) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.tok_kind == b.tok_kind + && a.is_comptime == b.is_comptime + && a.is_expr == b.is_expr + && a.has_else == b.has_else; +} + +static bool v__ast__IfGuardVar_struct_eq(v__ast__IfGuardVar a, v__ast__IfGuardVar b) { + return string__eq(a.name, b.name) + && a.is_mut == b.is_mut + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__IfGuardVar_arr_eq(Array_v__ast__IfGuardVar a, Array_v__ast__IfGuardVar b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__IfGuardVar_struct_eq(((v__ast__IfGuardVar*)a.data)[i], ((v__ast__IfGuardVar*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__IfGuardExpr_struct_eq(v__ast__IfGuardExpr a, v__ast__IfGuardExpr b) { + return Array_v__ast__IfGuardVar_arr_eq(a.vars, b.vars) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__IndexExpr_struct_eq(v__ast__IndexExpr a, v__ast__IndexExpr b) { + return v__ast__OrExpr_struct_eq(a.or_expr, b.or_expr) + && v__ast__Expr_sumtype_eq(a.index, b.index) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && a.is_setter == b.is_setter + && a.is_map == b.is_map + && a.is_array == b.is_array + && a.is_farray == b.is_farray + && a.is_option == b.is_option + && a.is_direct == b.is_direct + && a.is_gated == b.is_gated; +} + +static bool v__ast__InfixExpr_struct_eq(v__ast__InfixExpr a, v__ast__InfixExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__ast__Expr_sumtype_eq(a.right, b.right) + && string__eq(a.auto_locked, b.auto_locked) + && v__ast__ComptTimeConstValue_sumtype_eq(a.ct_left_value, b.ct_left_value) + && v__ast__ComptTimeConstValue_sumtype_eq(a.ct_right_value, b.ct_right_value) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.right_type, b.right_type) + && a.op == b.op + && a.is_stmt == b.is_stmt + && a.ct_left_value_evaled == b.ct_left_value_evaled + && a.ct_right_value_evaled == b.ct_right_value_evaled; +} + +static bool v__ast__IsRefType_struct_eq(v__ast__IsRefType a, v__ast__IsRefType b) { + return a.is_type == b.is_type + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__Likely_struct_eq(v__ast__Likely a, v__ast__Likely b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_likely == b.is_likely + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool Array_bool_arr_eq(Array_bool a, Array_bool b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((bool*)((byte*)a.data+(i*a.element_size))) != *((bool*)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool v__ast__LockExpr_struct_eq(v__ast__LockExpr a, v__ast__LockExpr b) { + return Array_bool_arr_eq(a.is_rlock, b.is_rlock) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Expr_arr_eq(a.lockeds, b.lockeds) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.scope == b.scope; +} + +static bool v__ast__MapInit_struct_eq(v__ast__MapInit a, v__ast__MapInit b) { + return Array_Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.pre_cmnts, b.pre_cmnts) + && Array_v__ast__Expr_arr_eq(a.keys, b.keys) + && Array_v__ast__Expr_arr_eq(a.vals, b.vals) + && Array_v__ast__Type_arr_eq(a.val_types, b.val_types) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.key_type, b.key_type) + && v__ast__Type_alias_eq(a.value_type, b.value_type); +} + +static bool v__ast__MatchBranch_struct_eq(v__ast__MatchBranch a, v__ast__MatchBranch b) { + return Array_Array_v__ast__Comment_arr_eq(a.ecmnts, b.ecmnts) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_else == b.is_else + && Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && v__token__Pos_struct_eq(a.branch_pos, b.branch_pos) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && a.scope == b.scope; +} + +static bool Array_v__ast__MatchBranch_arr_eq(Array_v__ast__MatchBranch a, Array_v__ast__MatchBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__MatchBranch_struct_eq(((v__ast__MatchBranch*)a.data)[i], ((v__ast__MatchBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__MatchExpr_struct_eq(v__ast__MatchExpr a, v__ast__MatchExpr b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__MatchBranch_arr_eq(a.branches, b.branches) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && v__ast__Type_alias_eq(a.cond_type, b.cond_type) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type) + && a.tok_kind == b.tok_kind + && a.is_expr == b.is_expr + && a.is_sum_type == b.is_sum_type; +} + +static bool v__ast__NodeError_struct_eq(v__ast__NodeError a, v__ast__NodeError b) { + return a.idx == b.idx + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__None_struct_eq(v__ast__None a, v__ast__None b) { + return v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__OffsetOf_struct_eq(v__ast__OffsetOf a, v__ast__OffsetOf b) { + return string__eq(a.field, b.field) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.struct_type, b.struct_type); +} + +static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool v__ast__PostfixExpr_struct_eq(v__ast__PostfixExpr a, v__ast__PostfixExpr b) { + return a.op == b.op + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.auto_locked, b.auto_locked); +} + +static bool v__ast__PrefixExpr_struct_eq(v__ast__PrefixExpr a, v__ast__PrefixExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && v__ast__Expr_sumtype_eq(a.right, b.right) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.right_type, b.right_type) + && a.op == b.op + && a.is_option == b.is_option; +} + +static bool v__ast__RangeExpr_struct_eq(v__ast__RangeExpr a, v__ast__RangeExpr b) { + return v__ast__Expr_sumtype_eq(a.low, b.low) + && v__ast__Expr_sumtype_eq(a.high, b.high) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_high == b.has_high + && a.has_low == b.has_low + && a.is_gated == b.is_gated; +} + +static bool v__ast__SelectBranch_struct_eq(v__ast__SelectBranch a, v__ast__SelectBranch b) { + return v__ast__Comment_struct_eq(a.comment, b.comment) + && Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && v__ast__Stmt_sumtype_eq(a.stmt, b.stmt) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_else == b.is_else + && a.is_timeout == b.is_timeout; +} + +static bool Array_v__ast__SelectBranch_arr_eq(Array_v__ast__SelectBranch a, Array_v__ast__SelectBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__SelectBranch_struct_eq(((v__ast__SelectBranch*)a.data)[i], ((v__ast__SelectBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SelectExpr_struct_eq(v__ast__SelectExpr a, v__ast__SelectExpr b) { + return Array_v__ast__SelectBranch_arr_eq(a.branches, b.branches) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_exception == b.has_exception + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.expected_type, b.expected_type); +} + +static bool v__ast__SelectorExpr_struct_eq(v__ast__SelectorExpr a, v__ast__SelectorExpr b) { + return Array_v__ast__Type_arr_eq(a.from_embed_types, b.from_embed_types) + && string__eq(a.field_name, b.field_name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mut_pos, b.mut_pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.name_type, b.name_type) + && a.next_token == b.next_token + && a.gkind_field == b.gkind_field + && a.is_mut == b.is_mut + && a.has_hidden_receiver == b.has_hidden_receiver; +} + +static bool v__ast__SizeOf_struct_eq(v__ast__SizeOf a, v__ast__SizeOf b) { + return a.is_type == b.is_type + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__TypeNode_struct_eq(v__ast__TypeNode a, v__ast__TypeNode b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__StructField_arr_eq(Array_v__ast__StructField a, Array_v__ast__StructField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructField_struct_eq(((v__ast__StructField*)a.data)[i], ((v__ast__StructField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Map_int_v__ast__SqlExpr_map_eq(Map_int_v__ast__SqlExpr a, Map_int_v__ast__SqlExpr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + v__ast__SqlExpr v = *(v__ast__SqlExpr*)map_get(&a, k, &(v__ast__SqlExpr[]){ 0 }); + if (!v__ast__SqlExpr_struct_eq(*(v__ast__SqlExpr*)map_get(&b, k, &(v__ast__SqlExpr[]){ 0 }), v)) { + return false; + } + } + return true; +} + +static bool v__ast__SqlExpr_struct_eq(v__ast__SqlExpr a, v__ast__SqlExpr b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_count == b.is_count + && a.has_where == b.has_where + && a.has_order == b.has_order + && a.has_limit == b.has_limit + && a.has_offset == b.has_offset + && a.has_desc == b.has_desc + && a.is_array == b.is_array + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.db_expr, b.db_expr) + && v__ast__Expr_sumtype_eq(a.where_expr, b.where_expr) + && v__ast__Expr_sumtype_eq(a.order_expr, b.order_expr) + && v__ast__Expr_sumtype_eq(a.limit_expr, b.limit_expr) + && v__ast__Expr_sumtype_eq(a.offset_expr, b.offset_expr) + && v__ast__TypeNode_struct_eq(a.table_expr, b.table_expr) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Map_int_v__ast__SqlExpr_map_eq(a.sub_structs, b.sub_structs); +} + +static bool Array_int_arr_eq(Array_int a, Array_int b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((int*)((byte*)a.data+(i*a.element_size))) != *((int*)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool Array_v__token__Pos_arr_eq(Array_v__token__Pos a, Array_v__token__Pos b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__token__Pos_struct_eq(((v__token__Pos*)a.data)[i], ((v__token__Pos*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StringInterLiteral_struct_eq(v__ast__StringInterLiteral a, v__ast__StringInterLiteral b) { + return Array_string_arr_eq(a.vals, b.vals) + && Array_int_arr_eq(a.fwidths, b.fwidths) + && Array_int_arr_eq(a.precisions, b.precisions) + && Array_bool_arr_eq(a.pluss, b.pluss) + && Array_bool_arr_eq(a.fills, b.fills) + && Array_v__token__Pos_arr_eq(a.fmt_poss, b.fmt_poss) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.expr_types, b.expr_types) + && Array_u8_arr_eq(a.fmts, b.fmts) + && Array_bool_arr_eq(a.need_fmts, b.need_fmts); +} + +static bool v__ast__StringLiteral_struct_eq(v__ast__StringLiteral a, v__ast__StringLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.language == b.language + && a.is_raw == b.is_raw; +} + +static bool v__ast__StructInitField_struct_eq(v__ast__StructInitField a, v__ast__StructInitField b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type) + && v__ast__Type_alias_eq(a.parent_type, b.parent_type); +} + +static bool Array_v__ast__StructInitField_arr_eq(Array_v__ast__StructInitField a, Array_v__ast__StructInitField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructInitField_struct_eq(((v__ast__StructInitField*)a.data)[i], ((v__ast__StructInitField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructInitEmbed_struct_eq(v__ast__StructInitEmbed a, v__ast__StructInitEmbed b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type); +} + +static bool Array_v__ast__StructInitEmbed_arr_eq(Array_v__ast__StructInitEmbed a, Array_v__ast__StructInitEmbed b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructInitEmbed_struct_eq(((v__ast__StructInitEmbed*)a.data)[i], ((v__ast__StructInitEmbed*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructInit_struct_eq(v__ast__StructInit a, v__ast__StructInit b) { + return Array_v__ast__Comment_arr_eq(a.pre_comments, b.pre_comments) + && Array_v__ast__Comment_arr_eq(a.update_expr_comments, b.update_expr_comments) + && Array_v__ast__StructInitField_arr_eq(a.fields, b.fields) + && Array_v__ast__StructInitEmbed_arr_eq(a.embeds, b.embeds) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && string__eq(a.typ_str, b.typ_str) + && v__ast__Expr_sumtype_eq(a.update_expr, b.update_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.update_expr_type, b.update_expr_type) + && a.is_short == b.is_short + && a.is_short_syntax == b.is_short_syntax + && a.unresolved == b.unresolved + && a.is_update_embed == b.is_update_embed + && a.has_update_expr == b.has_update_expr; +} + +static bool v__ast__TypeOf_struct_eq(v__ast__TypeOf a, v__ast__TypeOf b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__UnsafeExpr_struct_eq(v__ast__UnsafeExpr a, v__ast__UnsafeExpr b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool v__ast__Expr_sumtype_eq(v__ast__Expr a, v__ast__Expr b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 248) { + return v__ast__AnonFn_struct_eq(*a._v__ast__AnonFn, *b._v__ast__AnonFn); + } + if (a._typ == 249) { + return v__ast__ArrayDecompose_struct_eq(*a._v__ast__ArrayDecompose, *b._v__ast__ArrayDecompose); + } + if (a._typ == 250) { + return v__ast__ArrayInit_struct_eq(*a._v__ast__ArrayInit, *b._v__ast__ArrayInit); + } + if (a._typ == 251) { + return v__ast__AsCast_struct_eq(*a._v__ast__AsCast, *b._v__ast__AsCast); + } + if (a._typ == 252) { + return v__ast__Assoc_struct_eq(*a._v__ast__Assoc, *b._v__ast__Assoc); + } + if (a._typ == 253) { + return v__ast__AtExpr_struct_eq(*a._v__ast__AtExpr, *b._v__ast__AtExpr); + } + if (a._typ == 254) { + return v__ast__BoolLiteral_struct_eq(*a._v__ast__BoolLiteral, *b._v__ast__BoolLiteral); + } + if (a._typ == 255) { + return v__ast__CTempVar_struct_eq(*a._v__ast__CTempVar, *b._v__ast__CTempVar); + } + if (a._typ == 256) { + return v__ast__CallExpr_struct_eq(*a._v__ast__CallExpr, *b._v__ast__CallExpr); + } + if (a._typ == 257) { + return v__ast__CastExpr_struct_eq(*a._v__ast__CastExpr, *b._v__ast__CastExpr); + } + if (a._typ == 258) { + return v__ast__ChanInit_struct_eq(*a._v__ast__ChanInit, *b._v__ast__ChanInit); + } + if (a._typ == 259) { + return v__ast__CharLiteral_struct_eq(*a._v__ast__CharLiteral, *b._v__ast__CharLiteral); + } + if (a._typ == 260) { + return v__ast__Comment_struct_eq(*a._v__ast__Comment, *b._v__ast__Comment); + } + if (a._typ == 261) { + return v__ast__ComptimeCall_struct_eq(*a._v__ast__ComptimeCall, *b._v__ast__ComptimeCall); + } + if (a._typ == 262) { + return v__ast__ComptimeSelector_struct_eq(*a._v__ast__ComptimeSelector, *b._v__ast__ComptimeSelector); + } + if (a._typ == 263) { + return v__ast__ComptimeType_struct_eq(*a._v__ast__ComptimeType, *b._v__ast__ComptimeType); + } + if (a._typ == 264) { + return v__ast__ConcatExpr_struct_eq(*a._v__ast__ConcatExpr, *b._v__ast__ConcatExpr); + } + if (a._typ == 265) { + return v__ast__DumpExpr_struct_eq(*a._v__ast__DumpExpr, *b._v__ast__DumpExpr); + } + if (a._typ == 266) { + return v__ast__EmptyExpr_struct_eq(*a._v__ast__EmptyExpr, *b._v__ast__EmptyExpr); + } + if (a._typ == 267) { + return v__ast__EnumVal_struct_eq(*a._v__ast__EnumVal, *b._v__ast__EnumVal); + } + if (a._typ == 268) { + return v__ast__FloatLiteral_struct_eq(*a._v__ast__FloatLiteral, *b._v__ast__FloatLiteral); + } + if (a._typ == 269) { + return v__ast__GoExpr_struct_eq(*a._v__ast__GoExpr, *b._v__ast__GoExpr); + } + if (a._typ == 270) { + return v__ast__Ident_struct_eq(*a._v__ast__Ident, *b._v__ast__Ident); + } + if (a._typ == 271) { + return v__ast__IfExpr_struct_eq(*a._v__ast__IfExpr, *b._v__ast__IfExpr); + } + if (a._typ == 272) { + return v__ast__IfGuardExpr_struct_eq(*a._v__ast__IfGuardExpr, *b._v__ast__IfGuardExpr); + } + if (a._typ == 273) { + return v__ast__IndexExpr_struct_eq(*a._v__ast__IndexExpr, *b._v__ast__IndexExpr); + } + if (a._typ == 274) { + return v__ast__InfixExpr_struct_eq(*a._v__ast__InfixExpr, *b._v__ast__InfixExpr); + } + if (a._typ == 275) { + return v__ast__IntegerLiteral_struct_eq(*a._v__ast__IntegerLiteral, *b._v__ast__IntegerLiteral); + } + if (a._typ == 276) { + return v__ast__IsRefType_struct_eq(*a._v__ast__IsRefType, *b._v__ast__IsRefType); + } + if (a._typ == 277) { + return v__ast__Likely_struct_eq(*a._v__ast__Likely, *b._v__ast__Likely); + } + if (a._typ == 278) { + return v__ast__LockExpr_struct_eq(*a._v__ast__LockExpr, *b._v__ast__LockExpr); + } + if (a._typ == 279) { + return v__ast__MapInit_struct_eq(*a._v__ast__MapInit, *b._v__ast__MapInit); + } + if (a._typ == 280) { + return v__ast__MatchExpr_struct_eq(*a._v__ast__MatchExpr, *b._v__ast__MatchExpr); + } + if (a._typ == 281) { + return v__ast__NodeError_struct_eq(*a._v__ast__NodeError, *b._v__ast__NodeError); + } + if (a._typ == 282) { + return v__ast__None_struct_eq(*a._v__ast__None, *b._v__ast__None); + } + if (a._typ == 283) { + return v__ast__OffsetOf_struct_eq(*a._v__ast__OffsetOf, *b._v__ast__OffsetOf); + } + if (a._typ == 284) { + return v__ast__OrExpr_struct_eq(*a._v__ast__OrExpr, *b._v__ast__OrExpr); + } + if (a._typ == 285) { + return v__ast__ParExpr_struct_eq(*a._v__ast__ParExpr, *b._v__ast__ParExpr); + } + if (a._typ == 286) { + return v__ast__PostfixExpr_struct_eq(*a._v__ast__PostfixExpr, *b._v__ast__PostfixExpr); + } + if (a._typ == 287) { + return v__ast__PrefixExpr_struct_eq(*a._v__ast__PrefixExpr, *b._v__ast__PrefixExpr); + } + if (a._typ == 288) { + return v__ast__RangeExpr_struct_eq(*a._v__ast__RangeExpr, *b._v__ast__RangeExpr); + } + if (a._typ == 289) { + return v__ast__SelectExpr_struct_eq(*a._v__ast__SelectExpr, *b._v__ast__SelectExpr); + } + if (a._typ == 290) { + return v__ast__SelectorExpr_struct_eq(*a._v__ast__SelectorExpr, *b._v__ast__SelectorExpr); + } + if (a._typ == 291) { + return v__ast__SizeOf_struct_eq(*a._v__ast__SizeOf, *b._v__ast__SizeOf); + } + if (a._typ == 292) { + return v__ast__SqlExpr_struct_eq(*a._v__ast__SqlExpr, *b._v__ast__SqlExpr); + } + if (a._typ == 293) { + return v__ast__StringInterLiteral_struct_eq(*a._v__ast__StringInterLiteral, *b._v__ast__StringInterLiteral); + } + if (a._typ == 294) { + return v__ast__StringLiteral_struct_eq(*a._v__ast__StringLiteral, *b._v__ast__StringLiteral); + } + if (a._typ == 295) { + return v__ast__StructInit_struct_eq(*a._v__ast__StructInit, *b._v__ast__StructInit); + } + if (a._typ == 296) { + return v__ast__TypeNode_struct_eq(*a._v__ast__TypeNode, *b._v__ast__TypeNode); + } + if (a._typ == 297) { + return v__ast__TypeOf_struct_eq(*a._v__ast__TypeOf, *b._v__ast__TypeOf); + } + if (a._typ == 298) { + return v__ast__UnsafeExpr_struct_eq(*a._v__ast__UnsafeExpr, *b._v__ast__UnsafeExpr); + } + return false; +} + +static bool v__ast__AsmIO_struct_eq(v__ast__AsmIO a, v__ast__AsmIO b) { + return string__eq(a.alias, b.alias) + && string__eq(a.constraint, b.constraint) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__AsmIO_arr_eq(Array_v__ast__AsmIO a, Array_v__ast__AsmIO b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmIO_struct_eq(((v__ast__AsmIO*)a.data)[i], ((v__ast__AsmIO*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmStmt_struct_eq(v__ast__AsmStmt a, v__ast__AsmStmt b) { + return Array_v__ast__AsmClobbered_arr_eq(a.clobbered, b.clobbered) + && Array_v__ast__AsmTemplate_arr_eq(a.templates, b.templates) + && Array_v__ast__AsmIO_arr_eq(a.output, b.output) + && Array_v__ast__AsmIO_arr_eq(a.input, b.input) + && Array_string_arr_eq(a.global_labels, b.global_labels) + && Array_string_arr_eq(a.local_labels, b.local_labels) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.arch == b.arch + && a.is_basic == b.is_basic + && a.is_volatile == b.is_volatile + && a.is_goto == b.is_goto; +} + +static bool v__ast__AssertStmt_struct_eq(v__ast__AssertStmt a, v__ast__AssertStmt b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_used == b.is_used; +} + +static bool v__ast__AssignStmt_struct_eq(v__ast__AssignStmt a, v__ast__AssignStmt b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Expr_arr_eq(a.right, b.right) + && Array_v__ast__Expr_arr_eq(a.left, b.left) + && Array_v__ast__Type_arr_eq(a.left_types, b.left_types) + && Array_v__ast__Type_arr_eq(a.right_types, b.right_types) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.op == b.op + && a.is_static == b.is_static + && a.is_volatile == b.is_volatile + && a.is_simple == b.is_simple + && a.has_cross_var == b.has_cross_var; +} + +static bool v__ast__Block_struct_eq(v__ast__Block a, v__ast__Block b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.is_unsafe == b.is_unsafe + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__BranchStmt_struct_eq(v__ast__BranchStmt a, v__ast__BranchStmt b) { + return string__eq(a.label, b.label) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind; +} + +static bool v__ast__ComptimeFor_struct_eq(v__ast__ComptimeFor a, v__ast__ComptimeFor b) { + return string__eq(a.val_var, b.val_var) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.typ_pos, b.typ_pos) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool Array_v__ast__ConstField_arr_eq(Array_v__ast__ConstField a, Array_v__ast__ConstField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__ConstField_struct_eq(((v__ast__ConstField*)a.data)[i], ((v__ast__ConstField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__ConstDecl_struct_eq(v__ast__ConstDecl a, v__ast__ConstDecl b) { + return Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__ConstField_arr_eq(a.fields, b.fields) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_pub == b.is_pub + && a.is_block == b.is_block; +} + +static bool v__ast__EmptyStmt_struct_eq(v__ast__EmptyStmt a, v__ast__EmptyStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__EnumField_struct_eq(v__ast__EnumField a, v__ast__EnumField b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && a.has_expr == b.has_expr + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool Array_v__ast__EnumField_arr_eq(Array_v__ast__EnumField a, Array_v__ast__EnumField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__EnumField_struct_eq(((v__ast__EnumField*)a.data)[i], ((v__ast__EnumField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__EnumDecl_struct_eq(v__ast__EnumDecl a, v__ast__EnumDecl b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__EnumField_arr_eq(a.fields, b.fields) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_pub == b.is_pub + && a.is_flag == b.is_flag + && a.is_multi_allowed == b.is_multi_allowed; +} + +static bool v__ast__ExprStmt_struct_eq(v__ast__ExprStmt a, v__ast__ExprStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__ForCStmt_struct_eq(v__ast__ForCStmt a, v__ast__ForCStmt b) { + return a.has_init == b.has_init + && a.has_cond == b.has_cond + && a.has_inc == b.has_inc + && a.is_multi == b.is_multi + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Stmt_sumtype_eq(a.init, b.init) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && v__ast__Stmt_sumtype_eq(a.inc, b.inc) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.label, b.label) + && a.scope == b.scope; +} + +static bool v__ast__ForInStmt_struct_eq(v__ast__ForInStmt a, v__ast__ForInStmt b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.key_var, b.key_var) + && string__eq(a.val_var, b.val_var) + && v__ast__Expr_sumtype_eq(a.high, b.high) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && string__eq(a.label, b.label) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.key_type, b.key_type) + && v__ast__Type_alias_eq(a.val_type, b.val_type) + && v__ast__Type_alias_eq(a.cond_type, b.cond_type) + && v__ast__Type_alias_eq(a.high_type, b.high_type) + && a.kind == b.kind + && a.is_range == b.is_range + && a.val_is_mut == b.val_is_mut; +} + +static bool v__ast__ForStmt_struct_eq(v__ast__ForStmt a, v__ast__ForStmt b) { + return a.is_inf == b.is_inf + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.label, b.label) + && a.scope == b.scope; +} + +static bool Array_v__ast__GlobalField_arr_eq(Array_v__ast__GlobalField a, Array_v__ast__GlobalField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__GlobalField_struct_eq(((v__ast__GlobalField*)a.data)[i], ((v__ast__GlobalField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__GlobalDecl_struct_eq(v__ast__GlobalDecl a, v__ast__GlobalDecl b) { + return string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_block == b.is_block + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__GlobalField_arr_eq(a.fields, b.fields) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments); +} + +static bool v__ast__GotoLabel_struct_eq(v__ast__GotoLabel a, v__ast__GotoLabel b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__GotoStmt_struct_eq(v__ast__GotoStmt a, v__ast__GotoStmt b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__HashStmt_struct_eq(v__ast__HashStmt a, v__ast__HashStmt b) { + return string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.source_file, b.source_file) + && string__eq(a.val, b.val) + && string__eq(a.kind, b.kind) + && string__eq(a.main, b.main) + && string__eq(a.msg, b.msg) + && Array_v__ast__Expr_arr_eq(a.ct_conds, b.ct_conds); +} + +static bool Array_v__ast__FnDecl_arr_eq(Array_v__ast__FnDecl a, Array_v__ast__FnDecl b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__FnDecl_struct_eq(((v__ast__FnDecl*)a.data)[i], ((v__ast__FnDecl*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__InterfaceEmbedding_struct_eq(v__ast__InterfaceEmbedding a, v__ast__InterfaceEmbedding b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__InterfaceEmbedding_arr_eq(Array_v__ast__InterfaceEmbedding a, Array_v__ast__InterfaceEmbedding b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__InterfaceEmbedding_struct_eq(((v__ast__InterfaceEmbedding*)a.data)[i], ((v__ast__InterfaceEmbedding*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__InterfaceDecl_struct_eq(v__ast__InterfaceDecl a, v__ast__InterfaceDecl b) { + return Array_string_arr_eq(a.field_names, b.field_names) + && Array_v__ast__Comment_arr_eq(a.pre_comments, b.pre_comments) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__FnDecl_arr_eq(a.methods, b.methods) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Array_v__ast__InterfaceEmbedding_arr_eq(a.embeds, b.embeds) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.mut_pos == b.mut_pos + && a.language == b.language + && a.is_pub == b.is_pub + && a.are_embeds_expanded == b.are_embeds_expanded; +} + +static bool v__ast__Return_struct_eq(v__ast__Return a, v__ast__Return b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.types, b.types); +} + +static bool Map_int_v__ast__SqlStmtLine_map_eq(Map_int_v__ast__SqlStmtLine a, Map_int_v__ast__SqlStmtLine b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + v__ast__SqlStmtLine v = *(v__ast__SqlStmtLine*)map_get(&a, k, &(v__ast__SqlStmtLine[]){ 0 }); + if (!v__ast__SqlStmtLine_struct_eq(*(v__ast__SqlStmtLine*)map_get(&b, k, &(v__ast__SqlStmtLine[]){ 0 }), v)) { + return false; + } + } + return true; +} + +static bool v__ast__SqlStmtLine_struct_eq(v__ast__SqlStmtLine a, v__ast__SqlStmtLine b) { + return a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.where_expr, b.where_expr) + && Array_v__ast__Expr_arr_eq(a.update_exprs, b.update_exprs) + && string__eq(a.object_var_name, b.object_var_name) + && Array_string_arr_eq(a.updated_columns, b.updated_columns) + && v__ast__TypeNode_struct_eq(a.table_expr, b.table_expr) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Map_int_v__ast__SqlStmtLine_map_eq(a.sub_structs, b.sub_structs); +} + +static bool Array_v__ast__SqlStmtLine_arr_eq(Array_v__ast__SqlStmtLine a, Array_v__ast__SqlStmtLine b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__SqlStmtLine_struct_eq(((v__ast__SqlStmtLine*)a.data)[i], ((v__ast__SqlStmtLine*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SqlStmt_struct_eq(v__ast__SqlStmt a, v__ast__SqlStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.db_expr, b.db_expr) + && Array_v__ast__SqlStmtLine_arr_eq(a.lines, b.lines); +} + +static bool v__ast__Embed_struct_eq(v__ast__Embed a, v__ast__Embed b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__Embed_arr_eq(Array_v__ast__Embed a, Array_v__ast__Embed b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Embed_struct_eq(((v__ast__Embed*)a.data)[i], ((v__ast__Embed*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructDecl_struct_eq(v__ast__StructDecl a, v__ast__StructDecl b) { + return Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Embed_arr_eq(a.embeds, b.embeds) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.mut_pos == b.mut_pos + && a.pub_pos == b.pub_pos + && a.pub_mut_pos == b.pub_mut_pos + && a.global_pos == b.global_pos + && a.module_pos == b.module_pos + && a.language == b.language + && a.is_pub == b.is_pub + && a.is_union == b.is_union; +} + +static bool v__ast__AliasTypeDecl_struct_eq(v__ast__AliasTypeDecl a, v__ast__AliasTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__ast__Type_alias_eq(a.parent_type, b.parent_type) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool v__ast__FnTypeDecl_struct_eq(v__ast__FnTypeDecl a, v__ast__FnTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs); +} + +static bool Array_v__ast__TypeNode_arr_eq(Array_v__ast__TypeNode a, Array_v__ast__TypeNode b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__TypeNode_struct_eq(((v__ast__TypeNode*)a.data)[i], ((v__ast__TypeNode*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SumTypeDecl_struct_eq(v__ast__SumTypeDecl a, v__ast__SumTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Type_alias_eq(a.typ, b.typ) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__TypeNode_arr_eq(a.variants, b.variants); +} + +static bool v__ast__TypeDecl_sumtype_eq(v__ast__TypeDecl a, v__ast__TypeDecl b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 244) { + return v__ast__AliasTypeDecl_struct_eq(*a._v__ast__AliasTypeDecl, *b._v__ast__AliasTypeDecl); + } + if (a._typ == 245) { + return v__ast__FnTypeDecl_struct_eq(*a._v__ast__FnTypeDecl, *b._v__ast__FnTypeDecl); + } + if (a._typ == 246) { + return v__ast__SumTypeDecl_struct_eq(*a._v__ast__SumTypeDecl, *b._v__ast__SumTypeDecl); + } + return false; +} + +static bool v__ast__Stmt_sumtype_eq(v__ast__Stmt a, v__ast__Stmt b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 300) { + return v__ast__AsmStmt_struct_eq(*a._v__ast__AsmStmt, *b._v__ast__AsmStmt); + } + if (a._typ == 301) { + return v__ast__AssertStmt_struct_eq(*a._v__ast__AssertStmt, *b._v__ast__AssertStmt); + } + if (a._typ == 302) { + return v__ast__AssignStmt_struct_eq(*a._v__ast__AssignStmt, *b._v__ast__AssignStmt); + } + if (a._typ == 303) { + return v__ast__Block_struct_eq(*a._v__ast__Block, *b._v__ast__Block); + } + if (a._typ == 304) { + return v__ast__BranchStmt_struct_eq(*a._v__ast__BranchStmt, *b._v__ast__BranchStmt); + } + if (a._typ == 305) { + return v__ast__ComptimeFor_struct_eq(*a._v__ast__ComptimeFor, *b._v__ast__ComptimeFor); + } + if (a._typ == 306) { + return v__ast__ConstDecl_struct_eq(*a._v__ast__ConstDecl, *b._v__ast__ConstDecl); + } + if (a._typ == 307) { + return v__ast__DeferStmt_struct_eq(*a._v__ast__DeferStmt, *b._v__ast__DeferStmt); + } + if (a._typ == 308) { + return v__ast__EmptyStmt_struct_eq(*a._v__ast__EmptyStmt, *b._v__ast__EmptyStmt); + } + if (a._typ == 309) { + return v__ast__EnumDecl_struct_eq(*a._v__ast__EnumDecl, *b._v__ast__EnumDecl); + } + if (a._typ == 310) { + return v__ast__ExprStmt_struct_eq(*a._v__ast__ExprStmt, *b._v__ast__ExprStmt); + } + if (a._typ == 185) { + return v__ast__FnDecl_struct_eq(*a._v__ast__FnDecl, *b._v__ast__FnDecl); + } + if (a._typ == 311) { + return v__ast__ForCStmt_struct_eq(*a._v__ast__ForCStmt, *b._v__ast__ForCStmt); + } + if (a._typ == 312) { + return v__ast__ForInStmt_struct_eq(*a._v__ast__ForInStmt, *b._v__ast__ForInStmt); + } + if (a._typ == 313) { + return v__ast__ForStmt_struct_eq(*a._v__ast__ForStmt, *b._v__ast__ForStmt); + } + if (a._typ == 314) { + return v__ast__GlobalDecl_struct_eq(*a._v__ast__GlobalDecl, *b._v__ast__GlobalDecl); + } + if (a._typ == 315) { + return v__ast__GotoLabel_struct_eq(*a._v__ast__GotoLabel, *b._v__ast__GotoLabel); + } + if (a._typ == 316) { + return v__ast__GotoStmt_struct_eq(*a._v__ast__GotoStmt, *b._v__ast__GotoStmt); + } + if (a._typ == 317) { + return v__ast__HashStmt_struct_eq(*a._v__ast__HashStmt, *b._v__ast__HashStmt); + } + if (a._typ == 318) { + return v__ast__Import_struct_eq(*a._v__ast__Import, *b._v__ast__Import); + } + if (a._typ == 319) { + return v__ast__InterfaceDecl_struct_eq(*a._v__ast__InterfaceDecl, *b._v__ast__InterfaceDecl); + } + if (a._typ == 320) { + return v__ast__Module_struct_eq(*a._v__ast__Module, *b._v__ast__Module); + } + if (a._typ == 281) { + return v__ast__NodeError_struct_eq(*a._v__ast__NodeError, *b._v__ast__NodeError); + } + if (a._typ == 321) { + return v__ast__Return_struct_eq(*a._v__ast__Return, *b._v__ast__Return); + } + if (a._typ == 322) { + return v__ast__SqlStmt_struct_eq(*a._v__ast__SqlStmt, *b._v__ast__SqlStmt); + } + if (a._typ == 323) { + return v__ast__StructDecl_struct_eq(*a._v__ast__StructDecl, *b._v__ast__StructDecl); + } + if (a._typ == 247) { + return v__ast__TypeDecl_sumtype_eq(*a._v__ast__TypeDecl, *b._v__ast__TypeDecl); + } + return false; +} + +static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b) { + return string__eq(a.styp, b.styp) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b) { + return string__eq(a.fn_name, b.fn_name) + && v__ast__Type_alias_eq(a.got, b.got) + && v__ast__Type_alias_eq(a.exp, b.exp); +} + void v__ast__Param_free(v__ast__Param* it) { string_free(&(it->name)); v__token__Pos_free(&(it->pos)); @@ -12892,15 +15050,15 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_Error_index) return 75; if (sidx == _IError_MessageError_index) return 76; if (sidx == _IError_time__TimeParseError_index) return 224; - if (sidx == _IError_flag__UnkownFlagError_index) return 66095; - if (sidx == _IError_flag__ArgsCountError_index) return 66096; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66107; - if (sidx == _IError_semver__EmptyInputError_index) return 66109; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66110; - if (sidx == _IError_os__FileNotOpenedError_index) return 65649; - if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65650; - if (sidx == _IError_os__ExecutableNotFoundError_index) return 65663; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 503; + if (sidx == _IError_flag__UnkownFlagError_index) return 66096; + if (sidx == _IError_flag__ArgsCountError_index) return 66097; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66108; + if (sidx == _IError_semver__EmptyInputError_index) return 66110; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66111; + if (sidx == _IError_os__FileNotOpenedError_index) return 65650; + if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65651; + if (sidx == _IError_os__ExecutableNotFoundError_index) return 65664; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 504; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -13268,43 +15426,43 @@ static int v_typeof_sumtype_idx_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ } static char * v_typeof_sumtype_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 450: return "v.ast.TypeInfo"; - case 433: return "v.ast.Aggregate"; - case 435: return "v.ast.Alias"; + case 451: return "v.ast.TypeInfo"; + case 434: return "v.ast.Aggregate"; + case 436: return "v.ast.Alias"; case 415: return "v.ast.Array"; - case 443: return "v.ast.ArrayFixed"; - case 444: return "v.ast.Chan"; - case 449: return "v.ast.Enum"; - case 447: return "v.ast.FnType"; - case 448: return "v.ast.GenericInst"; - case 438: return "v.ast.Interface"; + case 444: return "v.ast.ArrayFixed"; + case 445: return "v.ast.Chan"; + case 450: return "v.ast.Enum"; + case 448: return "v.ast.FnType"; + case 449: return "v.ast.GenericInst"; + case 439: return "v.ast.Interface"; case 416: return "v.ast.Map"; - case 446: return "v.ast.MultiReturn"; + case 447: return "v.ast.MultiReturn"; case 420: return "v.ast.Struct"; - case 439: return "v.ast.SumType"; - case 445: return "v.ast.Thread"; + case 440: return "v.ast.SumType"; + case 446: return "v.ast.Thread"; default: return "unknown v.ast.TypeInfo"; } } static int v_typeof_sumtype_idx_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 450: return 450; - case 433: return 433; - case 435: return 435; + case 451: return 451; + case 434: return 434; + case 436: return 436; case 415: return 415; - case 443: return 443; case 444: return 444; - case 449: return 449; - case 447: return 447; - case 448: return 448; - case 438: return 438; - case 416: return 416; - case 446: return 446; - case 420: return 420; - case 439: return 439; case 445: return 445; - default: return 450; + case 450: return 450; + case 448: return 448; + case 449: return 449; + case 439: return 439; + case 416: return 416; + case 447: return 447; + case 420: return 420; + case 440: return 440; + case 446: return 446; + default: return 451; } } static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ @@ -13312,21 +15470,21 @@ static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ } static int v_typeof_interface_idx_hash__Hasher(int sidx) { /* hash.Hasher */ - return 498; + return 499; } static char * v_typeof_interface_hash__Hash32er(int sidx) { /* hash.Hash32er */ return "unknown hash.Hash32er"; } static int v_typeof_interface_idx_hash__Hash32er(int sidx) { /* hash.Hash32er */ - return 499; + return 500; } static char * v_typeof_interface_hash__Hash64er(int sidx) { /* hash.Hash64er */ return "unknown hash.Hash64er"; } static int v_typeof_interface_idx_hash__Hash64er(int sidx) { /* hash.Hash64er */ - return 500; + return 501; } static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return "v.ast.walker.Inspector"; @@ -13335,9 +15493,9 @@ static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.wa } static int v_typeof_interface_idx_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ - if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 533; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66027; - return 531; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 534; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66028; + return 532; } // << typeof() support for sum types @@ -13702,70 +15860,56 @@ string strings__find_between_pair_string(string input, string start, string end) } int math__bits__leading_zeros_8(u8 x) { - int _t1 = 8 - math__bits__len_8(x); - return _t1; + return 8 - math__bits__len_8(x); } int math__bits__leading_zeros_16(u16 x) { - int _t1 = 16 - math__bits__len_16(x); - return _t1; + return 16 - math__bits__len_16(x); } int math__bits__leading_zeros_32(u32 x) { - int _t1 = 32 - math__bits__len_32(x); - return _t1; + return 32 - math__bits__len_32(x); } int math__bits__leading_zeros_64(u64 x) { - int _t1 = 64 - math__bits__len_64(x); - return _t1; + return 64 - math__bits__len_64(x); } int math__bits__trailing_zeros_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__ntz_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__ntz_8_tab, x)))); } int math__bits__trailing_zeros_16(u16 x) { if (x == 0U) { - int _t1 = 16; - return _t1; + return 16; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((u32)((x & -x))) * _const_math__bits__de_bruijn32 >> (27))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((u32)((x & -x))) * _const_math__bits__de_bruijn32 >> (27))))); } int math__bits__trailing_zeros_32(u32 x) { if (x == 0U) { - int _t1 = 32; - return _t1; + return 32; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((x & -x)) * _const_math__bits__de_bruijn32 >> (27))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((x & -x)) * _const_math__bits__de_bruijn32 >> (27))))); } int math__bits__trailing_zeros_64(u64 x) { if (x == 0U) { - int _t1 = 64; - return _t1; + return 64; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn64tab, ((x & -x)) * _const_math__bits__de_bruijn64 >> (58))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn64tab, ((x & -x)) * _const_math__bits__de_bruijn64 >> (58))))); } int math__bits__ones_count_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x)))); } int math__bits__ones_count_16(u16 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 8U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u16)(0xffU))))))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 8U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u16)(0xffU))))))); } int math__bits__ones_count_32(u32 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 24U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 16U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 8U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u32)(0xffU))))))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 24U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 16U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 8U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u32)(0xffU))))))); } int math__bits__ones_count_64(u64 x) { @@ -13775,52 +15919,41 @@ int math__bits__ones_count_64(u64 x) { y += y >> 8U; y += y >> 16U; y += y >> 32U; - int _t1 = (((int)(y)) & ((128) - 1)); - return _t1; + return (((int)(y)) & ((128) - 1)); } // Attr: [inline] inline u8 math__bits__rotate_left_8(u8 x, int k) { - u8 n = ((u8)(8)); - u8 s = (((u8)(k)) & (n - ((u8)(1)))); - u8 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u8 s = (((u8)(k)) & (_const_math__bits__n8 - ((u8)(1)))); + return ((x << s) | (x >> (_const_math__bits__n8 - s))); } // Attr: [inline] inline u16 math__bits__rotate_left_16(u16 x, int k) { - u16 n = ((u16)(16U)); - u16 s = (((u16)(k)) & (n - ((u16)(1U)))); - u16 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u16 s = (((u16)(k)) & (_const_math__bits__n16 - ((u16)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n16 - s))); } // Attr: [inline] inline u32 math__bits__rotate_left_32(u32 x, int k) { - u32 n = ((u32)(32U)); - u32 s = (((u32)(k)) & (n - ((u32)(1U)))); - u32 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u32 s = (((u32)(k)) & (_const_math__bits__n32 - ((u32)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n32 - s))); } // Attr: [inline] inline u64 math__bits__rotate_left_64(u64 x, int k) { - u64 n = ((u64)(64U)); - u64 s = (((u64)(k)) & (n - ((u64)(1U)))); - u64 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u64 s = (((u64)(k)) & (_const_math__bits__n64 - ((u64)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n64 - s))); } // Attr: [inline] inline u8 math__bits__reverse_8(u8 x) { - u8 _t1 = (*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x)); - return _t1; + return (*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x)); } // Attr: [inline] inline u16 math__bits__reverse_16(u16 x) { - u16 _t1 = (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x >> 8U)))) | (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, (x & ((u16)(0xffU))))))) << 8U)); - return _t1; + return (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x >> 8U)))) | (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, (x & ((u16)(0xffU))))))) << 8U)); } // Attr: [inline] @@ -13828,8 +15961,7 @@ inline u32 math__bits__reverse_32(u32 x) { u64 y = ((((x >> ((u32)(1U)) & ((_const_math__bits__m0 & _const_math__bits__max_u32)))) | (((x & ((_const_math__bits__m0 & _const_math__bits__max_u32)))) << 1U))); y = ((((y >> ((u32)(2U)) & ((_const_math__bits__m1 & _const_math__bits__max_u32)))) | (((y & ((_const_math__bits__m1 & _const_math__bits__max_u32)))) << ((u32)(2U))))); y = ((((y >> ((u32)(4U)) & ((_const_math__bits__m2 & _const_math__bits__max_u32)))) | (((y & ((_const_math__bits__m2 & _const_math__bits__max_u32)))) << ((u32)(4U))))); - u32 _t1 = math__bits__reverse_bytes_32(((u32)(y))); - return _t1; + return math__bits__reverse_bytes_32(((u32)(y))); } // Attr: [inline] @@ -13837,34 +15969,29 @@ inline u64 math__bits__reverse_64(u64 x) { u64 y = ((((x >> ((u64)(1U)) & ((_const_math__bits__m0 & _const_math__bits__max_u64)))) | (((x & ((_const_math__bits__m0 & _const_math__bits__max_u64)))) << 1U))); y = ((((y >> ((u64)(2U)) & ((_const_math__bits__m1 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m1 & _const_math__bits__max_u64)))) << 2U))); y = ((((y >> ((u64)(4U)) & ((_const_math__bits__m2 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m2 & _const_math__bits__max_u64)))) << 4U))); - u64 _t1 = math__bits__reverse_bytes_64(y); - return _t1; + return math__bits__reverse_bytes_64(y); } // Attr: [inline] inline u16 math__bits__reverse_bytes_16(u16 x) { - u16 _t1 = ((x >> 8U) | (x << 8U)); - return _t1; + return ((x >> 8U) | (x << 8U)); } // Attr: [inline] inline u32 math__bits__reverse_bytes_32(u32 x) { u64 y = ((((x >> ((u32)(8U)) & ((_const_math__bits__m3 & _const_math__bits__max_u32)))) | (((x & ((_const_math__bits__m3 & _const_math__bits__max_u32)))) << ((u32)(8U))))); - u32 _t1 = ((u32)(((y >> 16U) | (y << 16U)))); - return _t1; + return ((u32)(((y >> 16U) | (y << 16U)))); } // Attr: [inline] inline u64 math__bits__reverse_bytes_64(u64 x) { u64 y = ((((x >> ((u64)(8U)) & ((_const_math__bits__m3 & _const_math__bits__max_u64)))) | (((x & ((_const_math__bits__m3 & _const_math__bits__max_u64)))) << ((u64)(8U))))); y = ((((y >> ((u64)(16U)) & ((_const_math__bits__m4 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m4 & _const_math__bits__max_u64)))) << ((u64)(16U))))); - u64 _t1 = ((y >> 32U) | (y << 32U)); - return _t1; + return ((y >> 32U) | (y << 32U)); } int math__bits__len_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, x)))); } int math__bits__len_16(u16 x) { @@ -13874,8 +16001,7 @@ int math__bits__len_16(u16 x) { y >>= 8U; n = 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } int math__bits__len_32(u32 x) { @@ -13889,8 +16015,7 @@ int math__bits__len_32(u32 x) { y >>= 8U; n += 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } int math__bits__len_64(u64 x) { @@ -13908,8 +16033,7 @@ int math__bits__len_64(u64 x) { y >>= 8U; n += 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry) { @@ -14021,15 +16145,13 @@ multi_return_u64_u64 math__bits__div_64(u64 hi, u64 lo, u64 y1) { } u32 math__bits__rem_32(u32 hi, u32 lo, u32 y) { - u32 _t1 = ((u32)((((((u64)(hi)) << 32U) | ((u64)(lo)))) % ((u64)(y)))); - return _t1; + return ((u32)((((((u64)(hi)) << 32U) | ((u64)(lo)))) % ((u64)(y)))); } u64 math__bits__rem_64(u64 hi, u64 lo, u64 y) { - multi_return_u64_u64 mr_16589 = math__bits__div_64(hi % y, lo, y); - u64 rem = mr_16589.arg1; - u64 _t1 = rem; - return _t1; + multi_return_u64_u64 mr_16658 = math__bits__div_64(hi % y, lo, y); + u64 rem = mr_16658.arg1; + return rem; } multi_return_f64_int math__bits__normalize(f64 x) { @@ -15369,7 +17491,7 @@ void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res) { // Attr: [direct_array_access] // Attr: [manualfree] -VV_LOCAL_SYMBOL string strconv__f64_to_str_lnd1(f64 f, int dec_digit) { +string strconv__f64_to_str_lnd1(f64 f, int dec_digit) { { // Unsafe block string s = strconv__f64_to_str(f + ((f64*)_const_strconv__dec_round.data)[dec_digit], 18); if (s.len > 2 && (s.str[ 0] == 'n' || s.str[ 1] == 'i')) { @@ -17929,16 +20051,36 @@ VV_LOCAL_SYMBOL void _write_buf_to_fd(int fd, u8* buf, int buf_len) { if (buf_len <= 0) { return; } - { // Unsafe block - u8* ptr = buf; - int remaining_bytes = buf_len; - for (;;) { - if (!(remaining_bytes > 0)) break; - int x = write(fd, ptr, remaining_bytes); - ptr += x; - remaining_bytes -= x; + u8* ptr = buf; + isize remaining_bytes = ((isize)(buf_len)); + isize x = ((isize)(0)); + #if defined(_VFREESTANDING) || defined(__vinix__) + { + { // Unsafe block + for (;;) { + if (!(remaining_bytes > 0)) break; + x = write(fd, ptr, remaining_bytes); + ptr += x; + remaining_bytes -= x; + } } } + #else + { + voidptr stream = ((voidptr)(stdout)); + if (fd == 2) { + stream = ((voidptr)(stderr)); + } + { // Unsafe block + for (;;) { + if (!(remaining_bytes > 0)) break; + x = ((isize)(fwrite(ptr, 1, remaining_bytes, stream))); + ptr += x; + remaining_bytes -= x; + } + } + } + #endif } // Attr: [unsafe] @@ -28778,6 +30920,57 @@ string os__norm_path(string path) { return _t8; } +_option_string os__existing_path(string path) { + IError err = _v_error(_SLIT("path does not exist")); + if (path.len == 0) { + return (_option_string){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (os__exists(path)) { + _option_string _t2; + opt_ok2(&(string[]) { path }, (_option*)(&_t2), sizeof(string)); + return _t2; + } + int volume_len = 0; + #if defined(_WIN32) + { + volume_len = os__win_volume_len(path); + } + #endif + if (volume_len > 0 && os__is_slash(string_at(path, volume_len - 1))) { + volume_len++; + } + strings__textscanner__TextScanner sc = strings__textscanner__new(string_substr(path, volume_len, (path).len)); + string recent_path = string_substr(path, 0, volume_len); + for (;;) { + if (!(strings__textscanner__TextScanner_next(&sc) != -1)) break; + u8 curr = ((u8)(strings__textscanner__TextScanner_current(&sc))); + int peek = strings__textscanner__TextScanner_peek(&sc); + int back = strings__textscanner__TextScanner_peek_back(&sc); + if (os__is_curr_dir_ref(back, curr, peek)) { + continue; + } + int range = sc.ilen - strings__textscanner__TextScanner_remaining(&sc) + volume_len; + if (os__is_slash(curr) && !os__is_slash(((u8)(peek)))) { + recent_path = string_substr(path, 0, range); + continue; + } + if (!os__is_slash(curr) && (peek == -1 || os__is_slash(((u8)(peek))))) { + string curr_path = string_substr(path, 0, range); + if (os__exists(curr_path)) { + recent_path = curr_path; + continue; + } + if (recent_path.len == 0) { + break; + } + _option_string _t3; + opt_ok2(&(string[]) { recent_path }, (_option*)(&_t3), sizeof(string)); + return _t3; + } + } + return (_option_string){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; +} + VV_LOCAL_SYMBOL string os__clean_path(string path) { if (path.len == 0) { string _t1 = _const_os__empty_str; @@ -28793,7 +30986,7 @@ VV_LOCAL_SYMBOL string os__clean_path(string path) { if (back != -1 && os__is_slash(((u8)(back))) && os__is_slash(curr)) { continue; } - if ((back == -1 || os__is_slash(((u8)(back)))) && curr == _const_os__dot && (peek == -1 || os__is_slash(((u8)(peek))))) { + if (os__is_curr_dir_ref(back, curr, peek)) { if (peek != -1 && os__is_slash(((u8)(peek)))) { strings__textscanner__TextScanner_skip_n(&sc, 1); } @@ -28911,6 +31104,15 @@ VV_LOCAL_SYMBOL bool os__is_normal_path(string path) { return _t2; } +VV_LOCAL_SYMBOL bool os__is_curr_dir_ref(int byte_one, int byte_two, int byte_three) { + if (((u8)(byte_two)) != _const_os__dot) { + bool _t1 = false; + return _t1; + } + bool _t2 = (byte_one < 0 || os__is_slash(((u8)(byte_one)))) && (byte_three < 0 || os__is_slash(((u8)(byte_three)))); + return _t2; +} + u32 os__FilePermission_bitmask(os__FilePermission p) { u32 mask = ((u32)(0U)); if (p.read) { @@ -30932,16 +33134,24 @@ bool os__is_dir_empty(string path) { } string os__file_ext(string path) { - _option_int _t1 = string_last_index(path, _SLIT(".")); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - string _t2 = _SLIT(""); - return _t2; + if (path.len < 3) { + string _t1 = _const_os__empty_str; + return _t1; + } + _option_int _t2 = string_last_index(path, _const_os__dot_str); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + string _t3 = _const_os__empty_str; + return _t3; } - int pos = (*(int*)_t1.data); - string _t3 = string_substr(path, pos, (path).len); - return _t3; + int pos = (*(int*)_t2.data); + if (pos + 1 >= path.len || pos == 0) { + string _t4 = _const_os__empty_str; + return _t4; + } + string _t5 = string_substr(path, pos, (path).len); + return _t5; } string os__dir(string opath) { @@ -33287,10 +35497,12 @@ string term__highlight_command(string command) { void term__set_cursor_position(term__Coord c) { print(string__plus( str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = c.y}}, {_SLIT(";"), /*100 &int*/0xfe07, {.d_i32 = c.x}}, {_SLIT0, 0, { .d_c = 0 }}})), _SLIT("H"))); + flush_stdout(); } void term__move(int n, string direction) { print( str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = direction}}, {_SLIT0, 0, { .d_c = 0 }}}))); + flush_stdout(); } void term__cursor_up(int n) { @@ -33311,6 +35523,7 @@ void term__cursor_back(int n) { void term__erase_display(string t) { print(string__plus(string__plus(_SLIT("\033["), t), _SLIT("J"))); + flush_stdout(); } void term__erase_toend(void) { @@ -33323,6 +35536,7 @@ void term__erase_tobeg(void) { void term__erase_clear(void) { print(_SLIT("\033[H\033[J")); + flush_stdout(); } void term__erase_del_clear(void) { @@ -33331,6 +35545,7 @@ void term__erase_del_clear(void) { void term__erase_line(string t) { print(string__plus(string__plus(_SLIT("\033["), t), _SLIT("K"))); + flush_stdout(); } void term__erase_line_toend(void) { @@ -33347,14 +35562,17 @@ void term__erase_line_clear(void) { void term__show_cursor(void) { print(_SLIT("\033[?25h")); + flush_stdout(); } void term__hide_cursor(void) { print(_SLIT("\033[?25l")); + flush_stdout(); } void term__clear_previous_line(void) { print(_SLIT("\r\033[1A\033[2K")); + flush_stdout(); } bool term__can_show_color_on_stdout(void) { @@ -33668,6 +35886,7 @@ struct termios old_state; state.c_lflag &= ((int)(~((((u32)(ICANON)) | ((u32)(ECHO)))))); tcsetattr(0, TCSANOW, &state); print(_SLIT("\e[6n")); + flush_stdout(); int x = 0; int y = 0; u8 stage = ((u8)(0)); @@ -33715,6 +35934,7 @@ bool term__set_terminal_title(string title) { print(_SLIT("\033]0")); print(title); print(_SLIT("\007")); + flush_stdout(); bool _t2 = true; return _t2; } @@ -33722,6 +35942,7 @@ bool term__set_terminal_title(string title) { void term__clear(void) { print(_SLIT("\033[2J")); print(_SLIT("\033[H")); + flush_stdout(); } string v__util__version__vhash(void) { @@ -36238,7 +38459,7 @@ f64 rand__exponential(f64 lambda) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -36313,7 +38534,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("585cb9ec2"); + string vhash = _SLIT("3bc50721e"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), /*115 &v.pref.OS*/0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), /*115 &string*/0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -36885,7 +39106,7 @@ VV_LOCAL_SYMBOL void v__pref__detect_musl(v__pref__Preferences* res) { } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); v__pref__detect_musl(res); #if defined(TARGET_IS_64BIT) { @@ -37361,6 +39582,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->custom_prelude = prelude; i++; } + else if (string__eq(arg, _SLIT("-cmain"))) { + res->cmain = os__cmdline__option(current_args, _SLIT("-cmain"), _SLIT("")); + i++; + } else { if (string__eq(command, _SLIT("build")) && v__pref__is_source_file(arg)) { eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Use `v "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT("` instead."), 0, { .d_c = 0 }}}))); @@ -37376,7 +39601,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if ((command).len == 0) { command = arg; command_pos = i; - if (string__eq(command, _SLIT("run"))) { + if (string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("crun"))) { break; } } else if (v__pref__is_source_file(command) && v__pref__is_source_file(arg) && !Array_string_contains(known_external_commands, command)) { @@ -37403,6 +39628,12 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if (res->is_debug) { v__pref__Preferences_parse_define(res, _SLIT("debug")); } + if (string__eq(command, _SLIT("crun"))) { + res->is_crun = true; + } + if (string__eq(command, _SLIT("run"))) { + res->is_run = true; + } if (string__eq(command, _SLIT("run")) && res->is_prod && os__is_atty(1) > 0) { v__pref__eprintln_cond(show_output, _SLIT("Note: building an optimized binary takes much longer. It shouldn't be used with `v run`.")); v__pref__eprintln_cond(show_output, _SLIT("Use `v run` without optimization, or build an optimized binary with -prod first, then run it separately.")); @@ -37412,8 +39643,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors _v_exit(1); VUNREACHABLE(); } - if (string__eq(command, _SLIT("run"))) { - res->is_run = true; + if (res->is_run || res->is_crun) { if (command_pos + 2 > args.len) { eprintln(_SLIT("v run: no v files listed")); _v_exit(1); @@ -37480,7 +39710,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors v__pref__eprintln_cond(show_output, _SLIT("`-bare-builtin-dir` must be used with `-freestanding`")); } if (string_ends_with(command, _SLIT(".vsh"))) { - res->is_run = true; + res->is_crun = true; res->path = command; Array_string _t38; res->run_args = (_t38 = args, array_slice(_t38, command_pos + 1, _t38.len)); @@ -37697,6 +39927,7 @@ v__pref__Arch v__pref__get_host_arch(void) { VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define) { Array_string define_parts = string_split(define, _SLIT("=")); + v__pref__Preferences_diagnose_deprecated_defines(prefs, define_parts); if (!(prefs->is_debug && string__eq(define, _SLIT("debug")))) { array_push((array*)&prefs->build_options, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-d "), /*115 &string*/0xfe10, {.d_s = define}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } @@ -37726,6 +39957,12 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* pre VUNREACHABLE(); } +VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__Preferences* prefs, Array_string define_parts) { + if (string__eq((*(string*)/*ee elem_sym */array_get(define_parts, 0)), _SLIT("force_embed_file"))) { + eprintln(_SLIT("-d force_embed_file was deprecated in 2022/06/01. Now $embed_file(file) always embeds the file, unless you pass `-d embed_only_metadata`.")); + } +} + Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) { Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); Array_string files = array_clone_to_depth(&files_, 0); @@ -39814,7 +42051,7 @@ string v__util__skip_bom(string file_content) { } bool v__util__module_is_builtin(string mod) { - bool _t1 = Array_string_contains(_const_v__util__builtin_module_names, mod); + bool _t1 = Array_string_contains(_const_v__util__builtin_module_parts, mod); return _t1; } @@ -40286,9 +42523,9 @@ void v__util__prepare_tool_when_needed(string source_name) { string vexe = os__getenv(_SLIT("VEXE")); string vroot = os__dir(vexe); string stool = os__join_path(vroot, new_array_from_c_array(3, 3, sizeof(string), _MOV((string[3]){_SLIT("cmd"), _SLIT("tools"), source_name}))); - multi_return_string_string mr_14964 = v__util__tool_source2name_and_exe(stool); - string tool_name = mr_14964.arg0; - string tool_exe = mr_14964.arg1; + multi_return_string_string mr_14763 = v__util__tool_source2name_and_exe(stool); + string tool_name = mr_14763.arg0; + string tool_exe = mr_14763.arg1; if (v__util__should_recompile_tool(vexe, stool, tool_name, tool_exe)) { time__sleep(1001 * _const_time__millisecond); v__util__recompile_file(vexe, stool); @@ -40911,8 +43148,8 @@ bool v__ast__Expr_is_expr(v__ast__Expr expr) { return _t5; } -bool v__ast__Expr_is_lit(v__ast__Expr expr) { - bool _t1 = ((expr._typ == 254 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 259 /* v.ast.CharLiteral */)? (true) : (expr._typ == 294 /* v.ast.StringLiteral */)? (true) : (expr._typ == 275 /* v.ast.IntegerLiteral */)? (true) : (false)); +bool v__ast__Expr_is_pure_literal(v__ast__Expr expr) { + bool _t1 = ((expr._typ == 254 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 259 /* v.ast.CharLiteral */)? (true) : (expr._typ == 268 /* v.ast.FloatLiteral */)? (true) : (expr._typ == 294 /* v.ast.StringLiteral */)? (true) : (expr._typ == 275 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } @@ -43248,7 +45485,7 @@ string v__ast__Expr_str(v__ast__Expr x) { } else if (x._typ == 256 /* v.ast.CallExpr */) { string sargs = v__ast__args2str((*x._v__ast__CallExpr).args); - string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT(" ?")) : (_SLIT(""))); + string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT("?")) : (*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_result ? (_SLIT("!")) : (_SLIT(""))); if ((*x._v__ast__CallExpr).is_method) { string _t14 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__CallExpr).left)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = propagate_suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t14; @@ -43331,24 +45568,26 @@ string v__ast__Expr_str(v__ast__Expr x) { } if (i < (*x._v__ast__IfExpr).branches.len - 1 || !(*x._v__ast__IfExpr).has_else) { array_push((array*)&parts, _MOV((string[]){ string_clone(string__plus(string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT(" "), /*115 &string*/0xfe10, {.d_s = dollar}}, {_SLIT("if "), 0, { .d_c = 0 }}})), v__ast__Expr_str(branch.cond)), _SLIT(" { "))) })); + } else if ((*x._v__ast__IfExpr).has_else && i == (*x._v__ast__IfExpr).branches.len - 1) { + array_push((array*)&parts, _MOV((string[]){ string_clone(_SLIT("{ ")) })); } - for (int _t33 = 0; _t33 < branch.stmts.len; ++_t33) { - v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t33]; + for (int _t34 = 0; _t34 < branch.stmts.len; ++_t34) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t34]; array_push((array*)&parts, _MOV((string[]){ string_clone(v__ast__Stmt_str(stmt)) })); } } array_push((array*)&parts, _MOV((string[]){ string_clone(_SLIT(" }")) })); - string _t36 = Array_string_join(parts, _SLIT("")); - return _t36; - } - else if (x._typ == 273 /* v.ast.IndexExpr */) { - string _t37 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); + string _t37 = Array_string_join(parts, _SLIT("")); return _t37; } - else if (x._typ == 274 /* v.ast.InfixExpr */) { - string _t38 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); + else if (x._typ == 273 /* v.ast.IndexExpr */) { + string _t38 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); return _t38; } + else if (x._typ == 274 /* v.ast.InfixExpr */) { + string _t39 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t39; + } else if (x._typ == 279 /* v.ast.MapInit */) { Array_string pairs = __new_array_with_default(0, 0, sizeof(string), 0); for (int ik = 0; ik < (*x._v__ast__MapInit).keys.len; ++ik) { @@ -43356,24 +45595,24 @@ string v__ast__Expr_str(v__ast__Expr x) { string mv = v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get((*x._v__ast__MapInit).vals, ik))); array_push((array*)&pairs, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(kv)}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = mv}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } - string _t40 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t40; + string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t41; } else if (x._typ == 285 /* v.ast.ParExpr */) { - string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t41; + string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t42; } else if (x._typ == 286 /* v.ast.PostfixExpr */) { if ((*x._v__ast__PostfixExpr).op == v__token__Kind__question) { - string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); - return _t42; + string _t43 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); + return _t43; } - string _t43 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t43; + string _t44 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t44; } else if (x._typ == 287 /* v.ast.PrefixExpr */) { - string _t44 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); - return _t44; + string _t45 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); + return _t45; } else if (x._typ == 288 /* v.ast.RangeExpr */) { string s = _SLIT(".."); @@ -43383,28 +45622,28 @@ string v__ast__Expr_str(v__ast__Expr x) { if ((*x._v__ast__RangeExpr).has_high) { s = string__plus(s, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__RangeExpr).high)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - string _t45 = s; - return _t45; - } - else if (x._typ == 289 /* v.ast.SelectExpr */) { - string _t46 = _SLIT("ast.SelectExpr"); + string _t46 = s; return _t46; } - else if (x._typ == 290 /* v.ast.SelectorExpr */) { - string _t47 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); + else if (x._typ == 289 /* v.ast.SelectExpr */) { + string _t47 = _SLIT("ast.SelectExpr"); return _t47; } + else if (x._typ == 290 /* v.ast.SelectorExpr */) { + string _t48 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t48; + } else if (x._typ == 291 /* v.ast.SizeOf */) { if ((*x._v__ast__SizeOf).is_type) { - string _t48 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t48; + string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t49; } - string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t49; + string _t50 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t50; } else if (x._typ == 283 /* v.ast.OffsetOf */) { - string _t50 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t50; + string _t51 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t51; } else if (x._typ == 293 /* v.ast.StringInterLiteral */) { strings__Builder res = strings__new_builder(50); @@ -43416,9 +45655,9 @@ string v__ast__Expr_str(v__ast__Expr x) { break; } strings__Builder_write_string(&res, _SLIT("$")); - multi_return_string_bool mr_10139 = v__ast__StringInterLiteral_get_fspec_braces(&(*x._v__ast__StringInterLiteral), i); - string fspec_str = mr_10139.arg0; - bool needs_braces = mr_10139.arg1; + multi_return_string_bool mr_10285 = v__ast__StringInterLiteral_get_fspec_braces(&(*x._v__ast__StringInterLiteral), i); + string fspec_str = mr_10285.arg0; + bool needs_braces = mr_10285.arg1; if (needs_braces) { strings__Builder_write_string(&res, _SLIT("{")); strings__Builder_write_string(&res, v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get((*x._v__ast__StringInterLiteral).exprs, i)))); @@ -43429,37 +45668,37 @@ string v__ast__Expr_str(v__ast__Expr x) { } } strings__Builder_write_string(&res, _SLIT("'")); - string _t51 = strings__Builder_str(&res); - return _t51; - } - else if (x._typ == 294 /* v.ast.StringLiteral */) { - string _t52 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); + string _t52 = strings__Builder_str(&res); return _t52; } - else if (x._typ == 296 /* v.ast.TypeNode */) { - string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 294 /* v.ast.StringLiteral */) { + string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); return _t53; } - else if (x._typ == 297 /* v.ast.TypeOf */) { - string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 296 /* v.ast.TypeNode */) { + string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t54; } - else if (x._typ == 277 /* v.ast.Likely */) { - string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 297 /* v.ast.TypeOf */) { + string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t55; } - else if (x._typ == 298 /* v.ast.UnsafeExpr */) { - string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + else if (x._typ == 277 /* v.ast.Likely */) { + string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t56; } - else if (x._typ == 282 /* v.ast.None */) { - string _t57 = _SLIT("none"); + else if (x._typ == 298 /* v.ast.UnsafeExpr */) { + string _t57 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t57; } - else if (x._typ == 276 /* v.ast.IsRefType */) { - string _t58 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); + else if (x._typ == 282 /* v.ast.None */) { + string _t58 = _SLIT("none"); return _t58; } + else if (x._typ == 276 /* v.ast.IsRefType */) { + string _t59 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); + return _t59; + } else if (x._typ == 272 /* v.ast.IfGuardExpr */) { string s = _SLIT(""); for (int i = 0; i < (*x._v__ast__IfGuardExpr).vars.len; ++i) { @@ -43469,57 +45708,57 @@ string v__ast__Expr_str(v__ast__Expr x) { s = /*f*/string__plus(s, _SLIT(", ")); } } - string _t59 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); - return _t59; + string _t60 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); + return _t60; } else if (x._typ == 295 /* v.ast.StructInit */) { string sname = v__ast__Table_sym(global_table, (*x._v__ast__StructInit).typ)->name; - string _t60 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); - return _t60; - } - else if (x._typ == 249 /* v.ast.ArrayDecompose */) { - string _t61 = _SLIT("ast.ArrayDecompose"); + string _t61 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); return _t61; } - else if (x._typ == 252 /* v.ast.Assoc */) { - string _t62 = _SLIT("ast.Assoc"); + else if (x._typ == 249 /* v.ast.ArrayDecompose */) { + string _t62 = _SLIT("ast.ArrayDecompose"); return _t62; } - else if (x._typ == 258 /* v.ast.ChanInit */) { - string _t63 = _SLIT("ast.ChanInit"); + else if (x._typ == 252 /* v.ast.Assoc */) { + string _t63 = _SLIT("ast.Assoc"); return _t63; } - else if (x._typ == 261 /* v.ast.ComptimeCall */) { - string _t64 = _SLIT("ast.ComptimeCall"); + else if (x._typ == 258 /* v.ast.ChanInit */) { + string _t64 = _SLIT("ast.ChanInit"); return _t64; } - else if (x._typ == 266 /* v.ast.EmptyExpr */) { - string _t65 = _SLIT("ast.EmptyExpr"); + else if (x._typ == 261 /* v.ast.ComptimeCall */) { + string _t65 = _SLIT("ast.ComptimeCall"); return _t65; } - else if (x._typ == 278 /* v.ast.LockExpr */) { - string _t66 = _SLIT("ast.LockExpr"); + else if (x._typ == 266 /* v.ast.EmptyExpr */) { + string _t66 = _SLIT("ast.EmptyExpr"); return _t66; } - else if (x._typ == 280 /* v.ast.MatchExpr */) { - string _t67 = _SLIT("ast.MatchExpr"); + else if (x._typ == 278 /* v.ast.LockExpr */) { + string _t67 = _SLIT("ast.LockExpr"); return _t67; } - else if (x._typ == 281 /* v.ast.NodeError */) { - string _t68 = _SLIT("ast.NodeError"); + else if (x._typ == 280 /* v.ast.MatchExpr */) { + string _t68 = _SLIT("ast.MatchExpr"); return _t68; } - else if (x._typ == 284 /* v.ast.OrExpr */) { - string _t69 = _SLIT("ast.OrExpr"); + else if (x._typ == 281 /* v.ast.NodeError */) { + string _t69 = _SLIT("ast.NodeError"); return _t69; } - else if (x._typ == 292 /* v.ast.SqlExpr */) { - string _t70 = _SLIT("ast.SqlExpr"); + else if (x._typ == 284 /* v.ast.OrExpr */) { + string _t70 = _SLIT("ast.OrExpr"); return _t70; } + else if (x._typ == 292 /* v.ast.SqlExpr */) { + string _t71 = _SLIT("ast.SqlExpr"); + return _t71; + } ; - string _t71 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[unhandled expr type "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (x)._typ ))}}, {_SLIT("]"), 0, { .d_c = 0 }}})); - return _t71; + string _t72 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[unhandled expr type "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (x)._typ ))}}, {_SLIT("]"), 0, { .d_c = 0 }}})); + return _t72; } string v__ast__CallArg_str(v__ast__CallArg a) { @@ -43732,7 +45971,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; + return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -43756,7 +45995,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.cached_type_to_str = new_map(sizeof(u64), sizeof(string), &map_hash_int_8, &map_eq_int_8, &map_clone_int_8, &map_free_nop),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -43936,7 +46175,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__Fn new_fn = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -43999,7 +46238,7 @@ _option_v__ast__Fn v__ast__Table_find_method(v__ast__Table* t, v__ast__TypeSymbo Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, v__ast__GetEmbedsOptions options) { Array_Array_v__ast__Type embeds = __new_array_with_default(0, 0, sizeof(Array_v__ast__Type), 0); - v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 435 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); + v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 436 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); if ((unalias_sym->info)._typ == 420 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*unalias_sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*unalias_sym->info._v__ast__Struct).embeds.data)[_t1]; @@ -44036,9 +46275,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12461 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12461.arg0; - Array_v__ast__Type types = mr_12461.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12536 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12536.arg0; + Array_v__ast__Type types = mr_12536.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t8, Array_v__ast__Type); @@ -44051,7 +46290,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 438 /* v.ast.Interface */) { + } else if ((sym->info)._typ == 439 /* v.ast.Interface */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t11 = 0; _t11 < (*sym->info._v__ast__Interface).embeds.len; ++_t11) { @@ -44070,9 +46309,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13119 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_13119.arg0; - Array_v__ast__Type types = mr_13119.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13194 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13194.arg0; + Array_v__ast__Type types = mr_13194.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t18, Array_v__ast__Type); @@ -44085,7 +46324,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 433 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 434 /* v.ast.Aggregate */) { for (int _t21 = 0; _t21 < (*sym->info._v__ast__Aggregate).types.len; ++_t21) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t21]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -44095,9 +46334,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13582 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13582.arg0; - Array_v__ast__Type embed_types = mr_13582.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13657 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13657.arg0; + Array_v__ast__Type embed_types = mr_13657.arg1; if (embed_types.len != 0) { _option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok2(&(multi_return_v__ast__Fn_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=method, .arg1=embed_types} }, (_option*)(&_t23), sizeof(multi_return_v__ast__Fn_Array_v__ast__Type)); @@ -44124,8 +46363,8 @@ _option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__as return (_option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_14043 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14043.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14118 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14118.arg0; _option_v__ast__Fn _t5; opt_ok2(&(v__ast__Fn[]) { func }, (_option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -44151,9 +46390,9 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { v__ast__Type typ = ((v__ast__Type*)agg_info.types.data)[_t1]; v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); @@ -44166,7 +46405,7 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie } else if (!v__ast__Type_alias_eq(new_field.typ, type_field.typ)) { return (_option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` type is different"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,}); + new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.deprecation_msg,new_field.deprecated_after,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,new_field.is_deprecated,}); } else { IError err = _t2.err; return (_option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("` has no field or method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -44217,7 +46456,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t2; } } - else if (ts->info._typ == 433 /* v.ast.Aggregate */) { + else if (ts->info._typ == 434 /* v.ast.Aggregate */) { _option_v__ast__StructField _t3; if (_t3 = v__ast__Aggregate_find_field(&(*ts->info._v__ast__Aggregate), name), _t3.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t3.data; @@ -44236,7 +46475,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t7), sizeof(v__ast__StructField)); return _t7; } - else if (ts->info._typ == 438 /* v.ast.Interface */) { + else if (ts->info._typ == 439 /* v.ast.Interface */) { _option_v__ast__StructField _t8; if (_t8 = v__ast__Interface_find_field(&(*ts->info._v__ast__Interface), name), _t8.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t8.data; @@ -44245,7 +46484,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t9; } } - else if (ts->info._typ == 439 /* v.ast.SumType */) { + else if (ts->info._typ == 440 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, ts); _option_v__ast__StructField _t10; if (_t10 = v__ast__SumType_find_field(&(*ts->info._v__ast__SumType), name), _t10.state == 0) { @@ -44288,9 +46527,9 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17290 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17290.arg0; - Array_v__ast__Type types = mr_17290.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17365 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17365.arg0; + Array_v__ast__Type types = mr_17365.arg1; array_push((array*)&found_fields, _MOV((v__ast__StructField[]){ field })); array_push((array*)&embeds_of_found_fields, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embeds_of_found_fields, (types), _t8, Array_v__ast__Type); @@ -44303,7 +46542,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f } else if (found_fields.len > 1) { return (_option_multi_return_v__ast__StructField_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 433 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 434 /* v.ast.Aggregate */) { for (int _t11 = 0; _t11 < (*sym->info._v__ast__Aggregate).types.len; ++_t11) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t11]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -44313,16 +46552,16 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17743 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17743.arg0; - Array_v__ast__Type embed_types = mr_17743.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17818 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17818.arg0; + Array_v__ast__Type embed_types = mr_17818.arg1; if (embed_types.len > 0) { _option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok2(&(multi_return_v__ast__StructField_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=field, .arg1=embed_types} }, (_option*)(&_t13), sizeof(multi_return_v__ast__StructField_Array_v__ast__Type)); return _t13; } } - } else if ((sym->info)._typ == 435 /* v.ast.Alias */) { + } else if ((sym->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* unalias_sym = v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type); _option_multi_return_v__ast__StructField_Array_v__ast__Type _t14 = v__ast__Table_find_field_from_embeds(t, unalias_sym, field_name); return _t14; @@ -44346,8 +46585,8 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* return (_option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18341 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18341.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18416 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18416.arg0; _option_v__ast__StructField _t5; opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -44357,7 +46596,7 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeSymbol* sym_) { v__ast__TypeSymbol* sym = sym_; - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; if (info.found_fields) { return; } @@ -44372,7 +46611,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS if (v_sym->info._typ == 420 /* v.ast.Struct */) { _t2 = v__ast__Table_struct_fields(t, v_sym); } - else if (v_sym->info._typ == 439 /* v.ast.SumType */) { + else if (v_sym->info._typ == 440 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, v_sym); _t2 = (*v_sym->info._v__ast__SumType).fields; } @@ -44384,9 +46623,9 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS for (int _t3 = 0; _t3 < fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)fields.data)[_t3]; if (!_IN_MAP(ADDR(string, field.name), ADDR(map, field_map))) { - (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) = field; + (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })) = field; (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; - } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })))) { + } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })))) { (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; } } @@ -44404,7 +46643,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS field = string_clone(field); int nr_definitions = (*(int*)DenseArray_value(&field_usages.key_values, _t4)); if (nr_definitions == info.variants.len) { - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })) })); } } info.found_fields = true; @@ -44460,7 +46699,7 @@ inline v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Typ if (idx > 0) { v__ast__TypeSymbol* current_symbol = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); if (current_symbol->kind == v__ast__Kind__alias) { - idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); } v__ast__TypeSymbol* _t1 = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); return _t1; @@ -44481,7 +46720,7 @@ inline string v__ast__Table_get_type_name(v__ast__Table* t, v__ast__Type typ) { inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; if (pt <= _const_v__ast__char_type && pt >= _const_v__ast__void_type) { v__ast__Type _t1 = pt; return _t1; @@ -44495,7 +46734,7 @@ inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Typ inline v__ast__Type v__ast__Table_unaliased_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; v__ast__Type _t1 = pt; return _t1; } @@ -44624,7 +46863,7 @@ bool v__ast__Table_known_type_idx(v__ast__Table* t, v__ast__Type typ) { return _t3; } else if (sym->kind == (v__ast__Kind__array_fixed)) { - bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type); + bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type); return _t4; } else if (sym->kind == (v__ast__Kind__map)) { @@ -44879,9 +47118,9 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ for (int i = 0; i < mr_typs.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)mr_typs.data)[i]; v__ast__TypeSymbol* mr_type_sym = v__ast__Table_sym(t, v__ast__mktyp(mr_typ)); - multi_return_string_string mr_31400 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); - string ref = mr_31400.arg0; - string cref = mr_31400.arg1; + multi_return_string_string mr_31475 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); + string ref = mr_31475.arg0; + string cref = mr_31475.arg1; name = /*f*/string__plus(name, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = mr_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); cname = /*f*/string__plus(cname, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = cref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = mr_type_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i < mr_typs.len - 1) { @@ -44936,7 +47175,7 @@ inline v__ast__Type v__ast__Table_value_type(v__ast__Table* t, v__ast__Type typ) return _t2; } if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__ast__Type _t3 = info.elem_type; return _t3; } @@ -44994,7 +47233,7 @@ bool v__ast__Table_register_fn_concrete_types(v__ast__Table* t, string fn_name, bool v__ast__Table_sumtype_has_variant(v__ast__Table* t, v__ast__Type parent, v__ast__Type variant, bool is_as) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent); if (parent_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; v__ast__TypeSymbol* var_sym = v__ast__Table_sym(t, variant); if (var_sym->kind == (v__ast__Kind__aggregate)) { @@ -45027,7 +47266,7 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_variant_in_type(v__ast__Table* } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type* aggregate_type, bool is_as) { - v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; + v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ; for (int _t1 = 0; _t1 < aggregate_sym.types.len; ++_t1) { v__ast__Type var_type = ((v__ast__Type*)aggregate_sym.types.data)[_t1]; if (!v__ast__Table_sumtype_has_variant(t, parent_type, var_type, is_as)) { @@ -45040,9 +47279,9 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_alias_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type alias_type, bool is_as) { - v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; if (!v__ast__Table_sumtype_check_variant_in_type(t, parent_sym, alias_type, is_as)) { - v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; bool _t1 = v__ast__Type_alias_eq(parent_type, alias_info.parent_type) || v__ast__Table_sumtype_has_variant(t, parent_type, alias_info.parent_type, is_as); return _t1; } @@ -45195,7 +47434,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t5 = false; return _t5; } - if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 439 /* v.ast.Interface */) { Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; @@ -45311,7 +47550,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 444 /* v.ast.ArrayFixed */) { _option_v__ast__Type _t9; if (_t9 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types), _t9.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t9.data; @@ -45327,7 +47566,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 444 /* v.ast.Chan */) { + else if (sym->info._typ == 445 /* v.ast.Chan */) { _option_v__ast__Type _t12; if (_t12 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__Chan).elem_type, generic_names, concrete_types), _t12.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t12.data; @@ -45343,7 +47582,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 447 /* v.ast.FnType */) { + else if (sym->info._typ == 448 /* v.ast.FnType */) { v__ast__Fn func = (*sym->info._v__ast__FnType).func; bool has_generic = false; if (v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic)) { @@ -45382,7 +47621,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t19; } } - else if (sym->info._typ == 446 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 447 /* v.ast.MultiReturn */) { Array_v__ast__Type types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool type_changed = false; for (int _t20 = 0; _t20 < (*sym->info._v__ast__MultiReturn).types.len; ++_t20) { @@ -45473,7 +47712,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t33; } } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { @@ -45497,7 +47736,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t35; } } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { @@ -45550,13 +47789,13 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t1 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t1; } - else if (ts->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 444 /* v.ast.ArrayFixed */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_array_fixed(t, unwrap_typ, (*ts->info._v__ast__ArrayFixed).size, v__ast__None_to_sumtype_v__ast__Expr(ADDR(v__ast__None, (((v__ast__None){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}))))); v__ast__Type _t2 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t2; } - else if (ts->info._typ == 444 /* v.ast.Chan */) { + else if (ts->info._typ == 445 /* v.ast.Chan */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_chan(t, unwrap_typ, v__ast__Type_nr_muls(unwrap_typ) > 0); v__ast__Type _t3 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); @@ -45637,7 +47876,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 438 /* v.ast.Interface */) { + else if (ts->info._typ == 439 /* v.ast.Interface */) { if (!(*ts->info._v__ast__Interface).is_generic) { v__ast__Type _t14 = typ; return _t14; @@ -45705,7 +47944,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 439 /* v.ast.SumType */) { + else if (ts->info._typ == 440 /* v.ast.SumType */) { if (!(*ts->info._v__ast__SumType).is_generic) { v__ast__Type _t23 = typ; return _t23; @@ -45791,7 +48030,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t33 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t33; } - else if (ts->info._typ == 439 /* v.ast.SumType */) { + else if (ts->info._typ == 440 /* v.ast.SumType */) { Array_v__ast__Type variants = array_clone_to_depth(&(*ts->info._v__ast__SumType).variants, 0); for (int i = 0; i < variants.len; ++i) { if (v__ast__Type_has_flag((*(v__ast__Type*)/*ee elem_sym */array_get(variants, i)), v__ast__TypeFlag__generic)) { @@ -45821,7 +48060,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t36 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t36; } - else if (ts->info._typ == 438 /* v.ast.Interface */) { + else if (ts->info._typ == 439 /* v.ast.Interface */) { Array_v__ast__Fn imethods = array_clone_to_depth(&(*ts->info._v__ast__Interface).methods, 0); for (int _t37 = 0; _t37 < imethods.len; ++_t37) { v__ast__Fn* method = ((v__ast__Fn*)imethods.data) + _t37; @@ -45886,10 +48125,10 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } v__ast__Table_replace_generic_type(t, elem_type, generic_types); } - else if (ts->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 444 /* v.ast.ArrayFixed */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_types); } - else if (ts->info._typ == 444 /* v.ast.Chan */) { + else if (ts->info._typ == 445 /* v.ast.Chan */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_types); } else if (ts->info._typ == 416 /* v.ast.Map */) { @@ -45919,7 +48158,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Struct).generic_types = generic_types; } - else if (ts->info._typ == 438 /* v.ast.Interface */) { + else if (ts->info._typ == 439 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*ts->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -45942,7 +48181,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Interface).generic_types = generic_types; } - else if (ts->info._typ == 439 /* v.ast.SumType */) { + else if (ts->info._typ == 440 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*ts->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -45975,7 +48214,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { for (int _t1 = 0; _t1 < t->type_symbols.len; ++_t1) { v__ast__TypeSymbol** typ = ((v__ast__TypeSymbol**)t->type_symbols.data) + _t1; if ((*typ)->kind == v__ast__Kind__generic_inst) { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 448) /*expected idx: 448, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 449) /*expected idx: 449, name: v.ast.GenericInst */ ; v__ast__TypeSymbol* parent = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, info.parent_idx)); if (parent->kind == v__ast__Kind__placeholder) { (*typ)->kind = v__ast__Kind__placeholder; @@ -46032,7 +48271,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 438 /* v.ast.Interface */) { + else if (parent->info._typ == 439 /* v.ast.Interface */) { v__ast__Interface parent_info = (*parent->info._v__ast__Interface); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -46098,7 +48337,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 439 /* v.ast.SumType */) { + else if (parent->info._typ == 440 /* v.ast.SumType */) { v__ast__SumType parent_info = (*parent->info._v__ast__SumType); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -46656,13 +48895,13 @@ VNORETURN VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymb // Attr: [inline] inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 449 /* v.ast.Enum */) { + if ((t->info)._typ == 450 /* v.ast.Enum */) { v__ast__Enum _t1 = (*t->info._v__ast__Enum); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 449 /* v.ast.Enum */) { + if ((fsym->info)._typ == 450 /* v.ast.Enum */) { v__ast__Enum _t2 = (*fsym->info._v__ast__Enum); return _t2; } @@ -46674,13 +48913,13 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 446 /* v.ast.MultiReturn */) { + if ((t->info)._typ == 447 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t1 = (*t->info._v__ast__MultiReturn); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 446 /* v.ast.MultiReturn */) { + if ((fsym->info)._typ == 447 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t2 = (*fsym->info._v__ast__MultiReturn); return _t2; } @@ -46696,7 +48935,7 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { v__ast__Array _t1 = (*t->info._v__ast__Array); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 415 /* v.ast.Array */) { v__ast__Array _t2 = (*fsym->info._v__ast__Array); @@ -46710,13 +48949,13 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 443 /* v.ast.ArrayFixed */) { + if ((t->info)._typ == 444 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t1 = (*t->info._v__ast__ArrayFixed); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 443 /* v.ast.ArrayFixed */) { + if ((fsym->info)._typ == 444 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t2 = (*fsym->info._v__ast__ArrayFixed); return _t2; } @@ -46728,13 +48967,13 @@ inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol // Attr: [inline] inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 444 /* v.ast.Chan */) { + if ((t->info)._typ == 445 /* v.ast.Chan */) { v__ast__Chan _t1 = (*t->info._v__ast__Chan); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 444 /* v.ast.Chan */) { + if ((fsym->info)._typ == 445 /* v.ast.Chan */) { v__ast__Chan _t2 = (*fsym->info._v__ast__Chan); return _t2; } @@ -46746,13 +48985,13 @@ inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 445 /* v.ast.Thread */) { + if ((t->info)._typ == 446 /* v.ast.Thread */) { v__ast__Thread _t1 = (*t->info._v__ast__Thread); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 445 /* v.ast.Thread */) { + if ((fsym->info)._typ == 446 /* v.ast.Thread */) { v__ast__Thread _t2 = (*fsym->info._v__ast__Thread); return _t2; } @@ -46768,7 +49007,7 @@ inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { v__ast__Map _t1 = (*t->info._v__ast__Map); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 416 /* v.ast.Map */) { v__ast__Map _t2 = (*fsym->info._v__ast__Map); @@ -46786,7 +49025,7 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { v__ast__Struct _t1 = (*t->info._v__ast__Struct); return _t1; } - if ((t->info)._typ == 435 /* v.ast.Alias */) { + if ((t->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 420 /* v.ast.Struct */) { v__ast__Struct _t2 = (*fsym->info._v__ast__Struct); @@ -46800,13 +49039,13 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 439 /* v.ast.SumType */) { + if ((t->info)._typ == 440 /* v.ast.SumType */) { v__ast__SumType _t1 = (*t->info._v__ast__SumType); return _t1; } - if ((t->info)._typ == 439 /* v.ast.SumType */) { + if ((t->info)._typ == 440 /* v.ast.SumType */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__SumType).parent_type); - if ((fsym->info)._typ == 439 /* v.ast.SumType */) { + if ((fsym->info)._typ == 440 /* v.ast.SumType */) { v__ast__SumType _t2 = (*fsym->info._v__ast__SumType); return _t2; } @@ -46872,7 +49111,7 @@ inline bool v__ast__TypeSymbol_is_pointer(v__ast__TypeSymbol* t) { inline bool v__ast__TypeSymbol_is_int(v__ast__TypeSymbol* t) { bool res = (t->kind == v__ast__Kind__i8 || t->kind == v__ast__Kind__i16 || t->kind == v__ast__Kind__int || t->kind == v__ast__Kind__i64 || t->kind == v__ast__Kind__isize || t->kind == v__ast__Kind__u8 || t->kind == v__ast__Kind__u16 || t->kind == v__ast__Kind__u32 || t->kind == v__ast__Kind__u64 || t->kind == v__ast__Kind__usize || t->kind == v__ast__Kind__int_literal || t->kind == v__ast__Kind__rune); if (!res && t->kind == v__ast__Kind__alias) { - bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); return _t1; } bool _t2 = res; @@ -46982,7 +49221,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__alias: { - multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); size = mr_21365.arg0; align = mr_21365.arg1; break; @@ -47007,7 +49246,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } _t4 =_t5; } else { - _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ).types; } Array_v__ast__Type types = _t4; for (int _t7 = 0; _t7 < types.len; ++_t7) { @@ -47028,15 +49267,15 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) case v__ast__Kind__interface_: case v__ast__Kind__aggregate: { - if (sym->info._typ == 439 /* v.ast.SumType */) { + if (sym->info._typ == 440 /* v.ast.SumType */) { size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 433 /* v.ast.Aggregate */) { + else if (sym->info._typ == 434 /* v.ast.Aggregate */) { size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { @@ -47054,7 +49293,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; multi_return_int_int mr_22434 = v__ast__Table_type_size(t, info.elem_type); int elem_size = mr_22434.arg0; int elem_align = mr_22434.arg1; @@ -47330,8 +49569,28 @@ string v__ast__Table_clean_generics_type_str(v__ast__Table* t, v__ast__Type typ) } string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type typ, Map_string_string import_aliases) { +bool v__ast__Table_type_to_str_using_aliases_defer_0 = false; +v__ast__Table* mt; +u64 cache_key; +string res; + cache_key = ((((u64)(import_aliases.len)) << 32U) | ((u64)(typ))); + string* _t2 = (string*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, t->cached_type_to_str), &(u64[]){cache_key})); + _option_string _t1 = {0}; + if (_t2) { + *((string*)&_t1.data) = *((string*)_t2); + } else { + _t1.state = 2; _t1.err = _v_error(_SLIT("array index out of range")); + } + + if (_t1.state == 0) { + string cached_res = *(string*)_t1.data; + string _t3 = cached_res; + return _t3; + } v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); - string res = sym->name; + res = sym->name; + mt = ((v__ast__Table*)(t)); + v__ast__Table_type_to_str_using_aliases_defer_0 = true; switch (sym->kind) { case v__ast__Kind__int_literal: case v__ast__Kind__float_literal: @@ -47365,8 +49624,14 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__array: { if (v__ast__Type_alias_eq(typ, _const_v__ast__array_type)) { - string _t1 = _SLIT("array"); - return _t1; + res = _SLIT("array"); + string _t4 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t4; } if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { res = v__ast__Table_type_to_str_using_aliases(t, v__ast__Table_value_type(t, typ), import_aliases); @@ -47382,7 +49647,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; string elem_str = v__ast__Table_type_to_str_using_aliases(t, info.elem_type, import_aliases); if ((info.size_expr)._typ == 266 /* v.ast.EmptyExpr */) { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -47394,7 +49659,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__chan: { if (!string__eq(sym->mod, _SLIT("builtin")) && !string__eq(sym->name, _SLIT("chan"))) { - v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ; + v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.Chan */ ; v__ast__Type elem_type = info.elem_type; string mut_str = _SLIT(""); if (info.is_mut) { @@ -47408,22 +49673,22 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__function: { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; if (!t->is_fmt) { res = v__ast__Table_fn_signature(t, (voidptr)&/*qq*/info.func, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = true,})); } else { if (string_starts_with(res, _SLIT("fn ("))) { - bool _t2 = false; - Array_v__ast__Param _t2_orig = info.func.params; - int _t2_len = _t2_orig.len; - for (int _t3 = 0; _t3 < _t2_len; ++_t3) { - v__ast__Param it = ((v__ast__Param*) _t2_orig.data)[_t3]; + bool _t5 = false; + Array_v__ast__Param _t5_orig = info.func.params; + int _t5_len = _t5_orig.len; + for (int _t6 = 0; _t6 < _t5_len; ++_t6) { + v__ast__Param it = ((v__ast__Param*) _t5_orig.data)[_t6]; if (it.name.len > 0) { - _t2 = true; + _t5 = true; break; } } - bool has_names =_t2; + bool has_names =_t5; res = v__ast__Table_fn_signature_using_aliases(t, (voidptr)&/*qq*/info.func, import_aliases, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = !has_names,})); } else { res = v__ast__Table_shorten_user_defined_typenames(t, res, import_aliases); @@ -47434,8 +49699,14 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__map: { if (((int)(typ)) == _const_v__ast__map_type_idx) { - string _t4 = _SLIT("map"); - return _t4; + res = _SLIT("map"); + string _t7 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t7; } v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; string key_str = v__ast__Table_type_to_str_using_aliases(t, info.key_type, import_aliases); @@ -47446,7 +49717,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__multi_return: { res = _SLIT("("); - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; for (int i = 0; i < info.types.len; ++i) { v__ast__Type typ2 = ((v__ast__Type*)info.types.data)[i]; if (i > 0) { @@ -47473,7 +49744,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).generic_types.data)[i]; @@ -47484,7 +49755,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__SumType).generic_types.data)[i]; @@ -47499,18 +49770,18 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty else { } ; - } else if ((sym->info)._typ == 439 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).is_anon) { - Array_string _t5 = {0}; - Array_v__ast__Type _t5_orig = (*sym->info._v__ast__SumType).variants; - int _t5_len = _t5_orig.len; - _t5 = __new_array(0, _t5_len, sizeof(string)); + } else if ((sym->info)._typ == 440 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ).is_anon) { + Array_string _t8 = {0}; + Array_v__ast__Type _t8_orig = (*sym->info._v__ast__SumType).variants; + int _t8_len = _t8_orig.len; + _t8 = __new_array(0, _t8_len, sizeof(string)); - for (int _t6 = 0; _t6 < _t5_len; ++_t6) { - v__ast__Type it = ((v__ast__Type*) _t5_orig.data)[_t6]; + for (int _t9 = 0; _t9 < _t8_len; ++_t9) { + v__ast__Type it = ((v__ast__Type*) _t8_orig.data)[_t9]; string ti = v__ast__Table_shorten_user_defined_typenames(t, v__ast__Table_sym(t, it)->name, import_aliases); - array_push((array*)&_t5, &ti); + array_push((array*)&_t8, &ti); } - Array_string variant_names =_t5; + Array_string variant_names =_t8; res = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT(" | "))}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { res = v__ast__Table_shorten_user_defined_typenames(t, res, import_aliases); @@ -47519,7 +49790,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__generic_inst: { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 449) /*expected idx: 449, name: v.ast.GenericInst */ ; res = v__ast__Table_shorten_user_defined_typenames(t, string_all_before(sym->name, _SLIT("<")), import_aliases); res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < info.concrete_types.len; ++i) { @@ -47535,15 +49806,33 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__void: { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { - string _t7 = _SLIT("?"); - return _t7; + res = _SLIT("?"); + string _t10 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t10; } if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) { - string _t8 = _SLIT("!"); - return _t8; + res = _SLIT("!"); + string _t11 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t11; } - string _t9 = _SLIT("void"); - return _t9; + res = _SLIT("void"); + string _t12 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t12; break; } case v__ast__Kind__thread: @@ -47586,8 +49875,13 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) { res = str_intp(2, _MOV((StrIntpData[]){{_SLIT("!"), /*115 &string*/0xfe10, {.d_s = res}}, {_SLIT0, 0, { .d_c = 0 }}})); } - string _t10 = res; - return _t10; + string _t13 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t13; } VV_LOCAL_SYMBOL string v__ast__Table_shorten_user_defined_typenames(v__ast__Table* t, string originalname, Map_string_string import_aliases) { @@ -47784,7 +50078,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t9), sizeof(v__ast__Fn)); return _t9; } - else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 439 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t10 = {0}; Array_v__ast__Type _t10_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -47820,7 +50114,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t15), sizeof(v__ast__Fn)); return _t15; } - else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 440 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t16 = {0}; Array_v__ast__Type _t16_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -47863,7 +50157,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 438 /* v.ast.Interface */) { + else if (t->info._typ == 439 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*t->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Interface).parent_type); _option_v__ast__Fn _t22; @@ -47905,7 +50199,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t28), sizeof(v__ast__Fn)); return _t28; } - else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 439 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t29 = {0}; Array_v__ast__Type _t29_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -47941,7 +50235,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t34), sizeof(v__ast__Fn)); return _t34; } - else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 440 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t35 = {0}; Array_v__ast__Type _t35_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -47984,7 +50278,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 439 /* v.ast.SumType */) { + else if (t->info._typ == 440 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*t->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__SumType).parent_type); _option_v__ast__Fn _t41; @@ -48026,7 +50320,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t47), sizeof(v__ast__Fn)); return _t47; } - else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 439 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t48 = {0}; Array_v__ast__Type _t48_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -48062,7 +50356,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t53), sizeof(v__ast__Fn)); return _t53; } - else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 440 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t54 = {0}; Array_v__ast__Type _t54_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -48126,7 +50420,7 @@ bool v__ast__TypeSymbol_is_js_compatible(v__ast__TypeSymbol* t) { bool _t3 = true; return _t3; } - if (t->info._typ == 439 /* v.ast.SumType */) { + if (t->info._typ == 440 /* v.ast.SumType */) { for (int _t4 = 0; _t4 < (*t->info._v__ast__SumType).variants.len; ++_t4) { v__ast__Type variant = ((v__ast__Type*)(*t->info._v__ast__SumType).variants.data)[_t4]; v__ast__TypeSymbol* sym = v__ast__Table_final_sym(table, variant); @@ -48164,7 +50458,7 @@ multi_return_bool_bool_int v__ast__TypeSymbol_str_method_info(v__ast__TypeSymbol } _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, string name) { - if (t->info._typ == 433 /* v.ast.Aggregate */) { + if (t->info._typ == 434 /* v.ast.Aggregate */) { _option_v__ast__StructField _t1 = v__ast__Aggregate_find_field(&(*t->info._v__ast__Aggregate), name); return _t1; } @@ -48172,11 +50466,11 @@ _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, _option_v__ast__StructField _t2 = v__ast__Struct_find_field(&(*t->info._v__ast__Struct), name); return _t2; } - else if (t->info._typ == 438 /* v.ast.Interface */) { + else if (t->info._typ == 439 /* v.ast.Interface */) { _option_v__ast__StructField _t3 = v__ast__Interface_find_field(&(*t->info._v__ast__Interface), name); return _t3; } - else if (t->info._typ == 439 /* v.ast.SumType */) { + else if (t->info._typ == 440 /* v.ast.SumType */) { _option_v__ast__StructField _t4 = v__ast__SumType_find_field(&(*t->info._v__ast__SumType), name); return _t4; } @@ -48262,7 +50556,7 @@ v__ast__StructField v__ast__Struct_get_field(v__ast__Struct* s, string name) { } _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown field `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); - return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}; + return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}; } _option_v__ast__StructField v__ast__SumType_find_field(v__ast__SumType* s, string name) { @@ -48578,7 +50872,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } ; - v__ast__Type left_type_unwrapped = v__checker__Checker_unwrap_generic(c, left_type); + v__ast__Type left_type_unwrapped = v__checker__Checker_unwrap_generic(c, v__ast__mktyp(left_type)); v__ast__Type right_type_unwrapped = v__checker__Checker_unwrap_generic(c, right_type); if (right_type_unwrapped == 0) { continue; @@ -48604,7 +50898,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 270 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 270 /* v.ast.Ident */) { - if ((right_sym->info)._typ == 443 /* v.ast.ArrayFixed */) { + if ((right_sym->info)._typ == 444 /* v.ast.ArrayFixed */) { if (v__ast__Type_is_ptr((*right_sym->info._v__ast__ArrayFixed).elem_type)) { v__checker__Checker_error(c, _SLIT("assignment from one fixed array to another with a pointer element type is prohibited outside of `unsafe`"), node->pos); } @@ -48873,11 +51167,11 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v return _t8; } } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t10 = true; return _t10; } @@ -48897,7 +51191,7 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v bool _t13 = true; return _t13; } else if (got_sym->kind == v__ast__Kind__array) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { bool _t14 = true; @@ -49043,17 +51337,18 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, return (_option_void){0}; } } - v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); - string got_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); - v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); - string expected_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); if (v__checker__Checker_check_types(c, got, expected)) { if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { return (_option_void){0}; } } else { + v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); + v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { + multi_return_string_string mr_8384 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8384.arg0; + string expected_typ_str = mr_8384.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } return (_option_void){0}; @@ -49061,14 +51356,27 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, if (v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(arg.expr)}}, {_SLIT("` (no value) used as value"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } + multi_return_string_string mr_8632 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8632.arg0; + string expected_typ_str = mr_8632.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } if (!v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { + multi_return_string_string mr_8802 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8802.arg0; + string expected_typ_str = mr_8802.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } return (_option_void){0}; } +VV_LOCAL_SYMBOL multi_return_string_string v__checker__Checker_get_string_names_of(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected) { +v__checker__Checker* c = HEAP(v__checker__Checker, _v_toheap_c); + string got_typ_str = v__ast__Table_type_to_str((*(c)).table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); + string expected_typ_str = v__ast__Table_type_to_str((*(c)).table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); + return (multi_return_string_string){.arg0=got_typ_str, .arg1=expected_typ_str}; +} + VV_LOCAL_SYMBOL bool v__checker__Checker_check_same_module(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected) { v__checker__Checker* c = HEAP(v__checker__Checker, _v_toheap_c); string clean_got_typ = string_all_before(v__ast__Table_clean_generics_type_str((*(c)).table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)), _SLIT("<")); @@ -49171,8 +51479,8 @@ bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v } bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym) { - v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; - v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; + v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; v__ast__Fn got_fn = got_info.func; v__ast__Fn exp_fn = exp_info.func; if (got_fn.params.len != exp_fn.params.len) { @@ -49213,7 +51521,7 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker* c, v__ast__InfixExpr* node, v__ast__Type left_type, v__ast__Type right_type) { if (!v__ast__Type_is_int(left_type)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); - if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)) { + if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type)) { v__ast__Type _t1 = left_type; return _t1; } @@ -49340,10 +51648,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_promote_num(v__checker__Checker v__ast__Type type_hi = left_type; v__ast__Type type_lo = right_type; if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { - v__ast__Type _var_18748 = type_hi; - v__ast__Type _var_18757 = type_lo; - type_hi = _var_18757; - type_lo = _var_18748; + v__ast__Type _var_19097 = type_hi; + v__ast__Type _var_19106 = type_lo; + type_hi = _var_19106; + type_lo = _var_19097; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -49436,7 +51744,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (node->is_method && v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->receiver_type); if (sym->info._typ == 420 /* v.ast.Struct */) { - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -49459,8 +51767,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 438 /* v.ast.Interface */) { - if (c->table->cur_fn->generic_names.len > 0) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -49483,8 +51791,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 439 /* v.ast.SumType */) { - if (c->table->cur_fn->generic_names.len > 0) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -49522,7 +51830,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && string__eq(param_type_sym->name, gt_name)) { to_set = v__ast__mktyp(arg.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, arg.typ); - if ((sym->info)._typ == 447 /* v.ast.FnType */) { + if ((sym->info)._typ == 448 /* v.ast.FnType */) { v__ast__Fn func_ = (*sym->info._v__ast__FnType).func; func_.name = _SLIT(""); int idx = v__ast__Table_find_or_register_fn_type(c->table, c->mod, func_, true, false); @@ -49547,7 +51855,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { - if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { + if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; @@ -49560,15 +51868,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__array_fixed && param_type_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; - v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { - if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { + arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -49587,8 +51895,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ typ = arg_map_info.value_type; } } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { - v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; - v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ).func; if (param_type_func.params.len == arg_type_func.params.len) { for (int n = 0; n < param_type_func.params.len; ++n) { v__ast__Param fn_param = ((v__ast__Param*)param_type_func.params.data)[n]; @@ -49607,11 +51915,11 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ generic_types = (*arg_sym->info._v__ast__Struct).generic_types; concrete_types = (*arg_sym->info._v__ast__Struct).concrete_types; } - else if (arg_sym->info._typ == 438 /* v.ast.Interface */) { + else if (arg_sym->info._typ == 439 /* v.ast.Interface */) { generic_types = (*arg_sym->info._v__ast__Interface).generic_types; concrete_types = (*arg_sym->info._v__ast__Interface).concrete_types; } - else if (arg_sym->info._typ == 439 /* v.ast.SumType */) { + else if (arg_sym->info._typ == 440 /* v.ast.SumType */) { generic_types = (*arg_sym->info._v__ast__SumType).generic_types; concrete_types = (*arg_sym->info._v__ast__SumType).concrete_types; } @@ -49685,14 +51993,14 @@ v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Pref timers_should_print = true; } #endif - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.const_var = ((voidptr)(0)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); return _t1; } VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_file(v__checker__Checker* c) { c->expected_type = _const_v__ast__void_type; c->expected_or_type = _const_v__ast__void_type; - c->const_decl = _SLIT(""); + c->const_var = ((voidptr)(0)); c->in_for_count = 0; c->returns = false; c->scope_returns = false; @@ -49846,7 +52154,7 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ if (c->pref->is_script && !c->pref->is_test) { v__ast__File* the_main_file = (*(v__ast__File**)array_last(files_from_main_module)); array_push((array*)&the_main_file->stmts, _MOV((v__ast__Stmt[]){ v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = __new_array(0, 0, sizeof(v__ast__Param)), @@ -50074,7 +52382,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy if (typ_sym->kind == v__ast__Kind__placeholder || typ_sym->kind == v__ast__Kind__int_literal || typ_sym->kind == v__ast__Kind__float_literal) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__alias) { - v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_str(typ_sym)}}, {_SLIT("` is an alias, use the original alias type `"), /*115 &string*/0xfe10, {.d_s = orig_sym->name}}, {_SLIT("` instead"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__chan) { v__checker__Checker_error(c, _SLIT("aliases of `chan` types are not allowed."), node.type_pos); @@ -50084,7 +52392,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy void v__checker__Checker_fn_type_decl(v__checker__Checker* c, v__ast__FnTypeDecl node) { v__checker__Checker_check_valid_pascal_case(c, node.name, _SLIT("fn type"), node.pos); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, node.typ); - v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; v__ast__Fn fn_info = fn_typ_info.func; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, fn_info.return_type, fn_info.return_type_pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -50281,7 +52589,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im elem_type = (*left_sym->info._v__ast__Array).elem_type; kind = _SLIT("array"); } - else if (left_sym->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (left_sym->info._typ == 444 /* v.ast.ArrayFixed */) { elem_type = (*left_sym->info._v__ast__ArrayFixed).elem_type; kind = _SLIT("fixed array"); } @@ -50296,19 +52604,19 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (v__ast__Type_has_flag(elem_type, v__ast__TypeFlag__shared_f)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("you have to create a handle and `lock` it to modify `shared` "), /*115 &string*/0xfe10, {.d_s = kind}}, {_SLIT(" element"), 0, { .d_c = 0 }}})), v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos)); } - multi_return_string_v__token__Pos mr_21955 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_21955.arg0; - pos = mr_21955.arg1; + multi_return_string_v__token__Pos mr_22155 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_22155.arg0; + pos = mr_22155.arg1; } else if (expr._typ == 285 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_22024 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_22024.arg0; - pos = mr_22024.arg1; + multi_return_string_v__token__Pos mr_22224 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_22224.arg0; + pos = mr_22224.arg1; } else if (expr._typ == 287 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_22096 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_22096.arg0; - pos = mr_22096.arg1; + multi_return_string_v__token__Pos mr_22296 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_22296.arg0; + pos = mr_22296.arg1; } else if (expr._typ == 290 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -50330,7 +52638,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (_t6.state != 0) { /*or block*/ IError err = _t6.err; has_field = false; - *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); } v__ast__StructField field_info = (*(v__ast__StructField*)_t6.data); @@ -50358,9 +52666,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im string type_str = v__ast__Table_type_to_str(c->table, (*expr._v__ast__SelectorExpr).expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT("` of struct `"), /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT("` is immutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__SelectorExpr).pos); } - multi_return_string_v__token__Pos mr_23560 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_23560.arg0; - pos = mr_23560.arg1; + multi_return_string_v__token__Pos mr_23760 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_23760.arg0; + pos = mr_23760.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -50369,7 +52677,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__interface_: { - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; _option_v__ast__StructField _t9 = v__ast__Interface_find_field(&interface_info, (*expr._v__ast__SelectorExpr).field_name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -50389,7 +52697,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__sum_type: { - v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; _option_v__ast__StructField _t12 = v__ast__SumType_find_field(&sumtype_info, (*expr._v__ast__SelectorExpr).field_name); if (_t12.state != 0) { /*or block*/ IError err = _t12.err; @@ -50466,9 +52774,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_25383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_25383.arg0; - pos = mr_25383.arg1; + multi_return_string_v__token__Pos mr_25583 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_25583.arg0; + pos = mr_25583.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -50486,7 +52794,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else { - if (!v__ast__Expr_is_lit(expr)) { + if (!v__ast__Expr_is_pure_literal(expr)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected expression `"), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (expr)._typ ))}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -50516,12 +52824,12 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t2 = true; return _t2; } - if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 439 /* v.ast.Interface */) { v__ast__Type generic_type = interface_type; v__ast__Interface generic_info = (*inter_sym->info._v__ast__Interface); if (v__ast__Type_has_flag((*inter_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*inter_sym->info._v__ast__Interface).parent_type); - if ((parent_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((parent_sym->info)._typ == 439 /* v.ast.Interface */) { generic_type = (*inter_sym->info._v__ast__Interface).parent_type; generic_info = (*parent_sym->info._v__ast__Interface); } @@ -50543,7 +52851,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, return _t5; } } - if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 439 /* v.ast.Interface */) { for (int _t6 = 0; _t6 < (*inter_sym->info._v__ast__Interface).types.len; ++_t6) { v__ast__Type t = ((v__ast__Type*)(*inter_sym->info._v__ast__Interface).types.data)[_t6]; if (v__ast__Type_idx(t) == v__ast__Type_idx(utyp)) { @@ -50552,7 +52860,6 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - string styp = v__ast__Table_type_to_str(c->table, utyp); if (v__ast__Type_idx(utyp) == v__ast__Type_idx(interface_type)) { bool _t8 = true; return _t8; @@ -50561,10 +52868,11 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t9 = true; return _t9; } + string styp = v__ast__Table_type_to_str(c->table, utyp); if (typ_sym->kind == v__ast__Kind__interface_ && inter_sym->kind == v__ast__Kind__interface_ && !string_starts_with(styp, _SLIT("JS.")) && !string_starts_with(inter_sym->name, _SLIT("JS."))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot implement interface `"), /*115 &string*/0xfe10, {.d_s = inter_sym->name}}, {_SLIT("` with a different interface `"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); + Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); if (!v__ast__Type_alias_eq(utyp, _const_v__ast__voidptr_type)) { for (int _t10 = 0; _t10 < imethods.len; ++_t10) { v__ast__Fn imethod = ((v__ast__Fn*)imethods.data)[_t10]; @@ -50598,7 +52906,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 439 /* v.ast.Interface */) { for (int _t14 = 0; _t14 < (*inter_sym->info._v__ast__Interface).fields.len; ++_t14) { v__ast__StructField ifield = ((v__ast__StructField*)(*inter_sym->info._v__ast__Interface).fields.data)[_t14]; _option_v__ast__StructField _t15; @@ -50662,7 +52970,7 @@ v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr node, v__ast__Type ret_type, v__ast__Type expr_return_type) { if (node.kind == v__ast__OrKind__propagate_option) { - if (!v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { + if (!isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__optional)) { @@ -50675,7 +52983,7 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no return; } if (node.kind == v__ast__OrKind__propagate_result) { - if (!v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__result) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { + if (!isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__result) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an result type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__result)) { @@ -50706,7 +53014,6 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* if (type_fits || is_noreturn) { return; } - string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__void_type)) { if (((*stmt._v__ast__ExprStmt).expr)._typ == 271 /* v.ast.IfExpr */) { for (int _t1 = 0; _t1 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t1) { @@ -50721,9 +53028,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* } return; } + string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`or` block must provide a default value of type `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`, or return/continue/break or call a [noreturn] function like panic(err) or exit(1)"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } else { string type_name = v__ast__Table_type_to_str(c->table, last_stmt_typ); + string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("wrong return type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` in the `or {}` block, expected `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } } @@ -50783,7 +53092,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S int name_type = 0; if (node->expr._typ == 270 /* v.ast.Ident */) { string name = (*node->expr._v__ast__Ident).name; - bool valid_generic = v__util__is_generic_type_name(name) && Array_string_contains(c->table->cur_fn->generic_names, name); + bool valid_generic = v__util__is_generic_type_name(name) && !isnil(c->table->cur_fn) && Array_string_contains(c->table->cur_fn->generic_names, name); if (valid_generic) { name_type = v__ast__Type_set_flag(((v__ast__Table_find_type_idx(c->table, name))), v__ast__TypeFlag__generic); } @@ -50859,7 +53168,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; - v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 420 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; @@ -50887,12 +53196,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_39652 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_39652.arg0; - embed_types = mr_39652.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40023 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_40023.arg0; + embed_types = mr_40023.arg1; node->from_embed_types = embed_types; if (sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__sum_type) { unknown_field_msg = IError_name_table[err._typ]._method_msg(err._object); @@ -50923,12 +53232,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_40483 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40483.arg0; - embed_types = mr_40483.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40854 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40854.arg0; + embed_types = mr_40854.arg1; node->from_embed_types = embed_types; } } @@ -50948,33 +53257,49 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S return _t18; } if (has_field) { - if (!string__eq(sym->mod, c->mod) && !field.is_pub && sym->language != v__ast__Language__c) { + bool is_used_outside = !string__eq(sym->mod, c->mod); + if (is_used_outside && !field.is_pub && sym->language != v__ast__Language__c) { v__ast__TypeSymbol* unwrapped_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("` is not public"), 0, { .d_c = 0 }}})), node->pos); } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); + if (field.is_deprecated && is_used_outside) { + time__Time now = time__now(); + time__Time after_time = now; + if ((field.deprecated_after).len != 0) { + _option_time__Time _t19 = time__parse_iso8601(field.deprecated_after); + if (_t19.state != 0) { /*or block*/ + IError err = _t19.err; + v__checker__Checker_error(c, _SLIT("invalid time format"), field.pos); + *(time__Time*) _t19.data = now; + } + + after_time = (*(time__Time*)_t19.data); + } + v__checker__Checker_deprecate(c, _SLIT("field"), field_name, field.deprecation_msg, now, after_time, node->pos); + } if (field_sym->kind == v__ast__Kind__sum_type || field_sym->kind == v__ast__Kind__interface_) { if (!prevent_sum_type_unwrapping_once) { - _option_v__ast__ScopeStructField _t19; - if (_t19 = v__ast__Scope_find_struct_field(node->scope, v__ast__Expr_str(node->expr), typ, field_name), _t19.state == 0) { - v__ast__ScopeStructField scope_field = *(v__ast__ScopeStructField*)_t19.data; - v__ast__Type _t20 = (*(v__ast__Type*)array_last(scope_field.smartcasts)); - return _t20; + _option_v__ast__ScopeStructField _t20; + if (_t20 = v__ast__Scope_find_struct_field(node->scope, v__ast__Expr_str(node->expr), typ, field_name), _t20.state == 0) { + v__ast__ScopeStructField scope_field = *(v__ast__ScopeStructField*)_t20.data; + v__ast__Type _t21 = (*(v__ast__Type*)array_last(scope_field.smartcasts)); + return _t21; } } } node->typ = field.typ; - v__ast__Type _t21 = field.typ; - return _t21; + v__ast__Type _t22 = field.typ; + return _t22; } - _option_v__ast__Fn _t22; - if (_t22 = v__ast__Table_find_method(c->table, sym, field_name), _t22.state == 0) { - v__ast__Fn method = *(v__ast__Fn*)_t22.data; + _option_v__ast__Fn _t23; + if (_t23 = v__ast__Table_find_method(c->table, sym, field_name), _t23.state == 0) { + v__ast__Fn method = *(v__ast__Fn*)_t23.data; if (c->expected_type != 0 && !v__ast__Type_alias_eq(c->expected_type, _const_v__ast__none_type)) { v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, c->mod, method, false, true)); if (v__checker__Checker_check_types(c, fn_type, c->expected_type)) { - v__ast__Type _t23 = fn_type; - return _t23; + v__ast__Type _t24 = fn_type; + return _t24; } } v__ast__Type receiver = (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).typ; @@ -50987,21 +53312,21 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } } } - Array_v__ast__Param _t24; - method.params = (_t24 = method.params, array_slice(_t24, 1, _t24.len)); + Array_v__ast__Param _t25; + method.params = (_t25 = method.params, array_slice(_t25, 1, _t25.len)); node->has_hidden_receiver = true; method.name = _SLIT(""); v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, c->mod, method, false, true)); - v__ast__Type _t25 = fn_type; - return _t25; + v__ast__Type _t26 = fn_type; + return _t26; } if (!(sym->kind == v__ast__Kind__struct_ || sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__interface_ || sym->kind == v__ast__Kind__sum_type)) { if (sym->kind != v__ast__Kind__placeholder) { v__ast__TypeSymbol* unwrapped_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (unwrapped_sym->kind == v__ast__Kind__array_fixed && string__eq(node->field_name, _SLIT("len"))) { node->typ = _const_v__ast__int_type; - v__ast__Type _t26 = _const_v__ast__int_type; - return _t26; + v__ast__Type _t27 = _const_v__ast__int_type; + return _t27; } v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("` has no property `"), /*115 &string*/0xfe10, {.d_s = node->field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -51010,20 +53335,20 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); } - Array_string _t27 = {0}; - Array_v__ast__StructField _t27_orig = (*sym->info._v__ast__Struct).fields; - int _t27_len = _t27_orig.len; - _t27 = __new_array(0, _t27_len, sizeof(string)); + Array_string _t28 = {0}; + Array_v__ast__StructField _t28_orig = (*sym->info._v__ast__Struct).fields; + int _t28_len = _t28_orig.len; + _t28 = __new_array(0, _t28_len, sizeof(string)); - for (int _t28 = 0; _t28 < _t27_len; ++_t28) { - v__ast__StructField it = ((v__ast__StructField*) _t27_orig.data)[_t28]; + for (int _t29 = 0; _t29 < _t28_len; ++_t29) { + v__ast__StructField it = ((v__ast__StructField*) _t28_orig.data)[_t29]; string ti = it.name; - array_push((array*)&_t27, &ti); + array_push((array*)&_t28, &ti); } - v__util__Suggestion suggestion = v__util__new_suggestion(field_name,_t27); + v__util__Suggestion suggestion = v__util__new_suggestion(field_name,_t28); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_field_msg), node->pos); - v__ast__Type _t29 = _const_v__ast__void_type; - return _t29; + v__ast__Type _t30 = _const_v__ast__void_type; + return _t30; } if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); @@ -51033,8 +53358,8 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } v__checker__Checker_error(c, unknown_field_msg, node->pos); } - v__ast__Type _t30 = _const_v__ast__void_type; - return _t30; + v__ast__Type _t31 = _const_v__ast__void_type; + return _t31; } void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* node) { @@ -51051,8 +53376,9 @@ void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* n } for (int i = 0; i < node->fields.len; ++i) { v__ast__ConstField* field = ((v__ast__ConstField*)node->fields.data) + i; - c->const_decl = field->name; array_push((array*)&c->const_deps, _MOV((string[]){ string_clone(field->name) })); + v__ast__ConstField* prev_const_var = c->const_var; + c->const_var = field; v__ast__Type typ = v__checker__Checker_check_expr_opt_call(c, field->expr, v__checker__Checker_expr(c, field->expr)); _option_v__ast__ComptTimeConstValue _t4; if (_t4 = v__checker__Checker_eval_comptime_const_expr(c, field->expr, 0), _t4.state == 0) { @@ -51064,6 +53390,7 @@ void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* n } (*(v__ast__ConstField*)/*ee elem_sym */array_get(node->fields, i)).typ = v__ast__mktyp(typ); c->const_deps = __new_array_with_default(0, 0, sizeof(string), 0); + c->const_var = prev_const_var; } } @@ -51181,7 +53508,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St c->inside_const = false; } else if (node._typ == 307 /* v.ast.DeferStmt */) { - if ((*node._v__ast__DeferStmt).idx_in_fn < 0) { + if ((*node._v__ast__DeferStmt).idx_in_fn < 0 && !isnil(c->table->cur_fn)) { (*node._v__ast__DeferStmt).idx_in_fn = c->table->cur_fn->defer_stmts.len; array_push((array*)&c->table->cur_fn->defer_stmts, _MOV((v__ast__DeferStmt[]){ *&(*node._v__ast__DeferStmt) })); } @@ -51267,7 +53594,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St if (!c->inside_unsafe) { v__checker__Checker_warn(c, _SLIT("`goto` requires `unsafe` (consider using labelled break/continue)"), (*node._v__ast__GotoStmt).pos); } - if (!Array_string_contains(c->table->cur_fn->label_names, (*node._v__ast__GotoStmt).name)) { + if (!isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->label_names, (*node._v__ast__GotoStmt).name)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown label `"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__GotoStmt).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__GotoStmt).pos); } } @@ -51742,7 +54069,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmts_ending_with_expression(v__checker } v__ast__Type v__checker__Checker_unwrap_generic(v__checker__Checker* c, v__ast__Type typ) { - if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { + if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn)) { _option_v__ast__Type _t1; if (_t1 = v__ast__Table_resolve_generic_to_concrete(c->table, typ, c->table->cur_fn->generic_names, c->table->cur_concrete_types), _t1.state == 0) { v__ast__Type t_typ = *(v__ast__Type*)_t1.data; @@ -52056,8 +54383,7 @@ bool v__checker__Checker_expr_defer_0 = false; return _t27; } else if (node._typ == 270 /* v.ast.Ident */) { - v__ast__Type res = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); - v__ast__Type _t28 = res; + v__ast__Type _t28 = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); // Defer begin if (v__checker__Checker_expr_defer_0) { c->expr_level--; @@ -52418,7 +54744,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - } else if ((to_sym->info)._typ == 435 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { + } else if ((to_sym->info)._typ == 436 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { if (!v__checker__Checker_check_types(c, from_type, (*to_sym->info._v__ast__Alias).parent_type) && !(v__ast__TypeSymbol_is_int(final_to_sym) && (final_from_sym->kind == v__ast__Kind__enum_ || final_from_sym->kind == v__ast__Kind__bool || final_from_sym->kind == v__ast__Kind__i8 || final_from_sym->kind == v__ast__Kind__char))) { string ft = v__ast__Table_type_to_str(c->table, from_type); string tt = v__ast__Table_type_to_str(c->table, to_type); @@ -52441,7 +54767,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE if (!v__ast__Type_is_ptr(from_type) && !v__ast__Type_is_pointer(from_type) && from_sym->kind != v__ast__Kind__interface_ && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->expr, true); } - if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).is_generic) { + if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ).is_generic) { v__ast__Type inferred_type = v__checker__Checker_resolve_generic_interface(c, from_type, to_type, node->pos); if (inferred_type != 0) { to_type = inferred_type; @@ -52579,11 +54905,19 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, switch (node->kind) { case v__token__AtKind__fn_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t1 = _const_v__ast__void_type; + return _t1; + } node->val = string_all_after_last(c->table->cur_fn->name, _SLIT(".")); break; } case v__token__AtKind__method_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t2 = _const_v__ast__void_type; + return _t2; + } string fname = string_all_after_last(c->table->cur_fn->name, _SLIT(".")); if (c->table->cur_fn->is_method) { node->val = string__plus(string__plus(string_all_after_last(v__ast__Table_type_to_str(c->table, c->table->cur_fn->receiver.typ), _SLIT(".")), _SLIT(".")), fname); @@ -52594,6 +54928,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, } case v__token__AtKind__mod_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t3 = _const_v__ast__void_type; + return _t3; + } node->val = c->table->cur_fn->mod; break; } @@ -52639,13 +54977,13 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, if (vmod_file_location.vmod_file.len == 0) { v__checker__Checker_error(c, _SLIT("@VMOD_FILE can be used only in projects, that have v.mod file"), node->pos); } - _option_string _t1 = os__read_file(vmod_file_location.vmod_file); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - *(string*) _t1.data = _SLIT(""); + _option_string _t4 = os__read_file(vmod_file_location.vmod_file); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(string*) _t4.data = _SLIT(""); } - string vmod_content = (*(string*)_t1.data); + string vmod_content = (*(string*)_t4.data); c->vmod_file_content = string_replace(vmod_content, _SLIT("\r\n"), _SLIT("\n")); } node->val = c->vmod_file_content; @@ -52675,8 +55013,8 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, } } ; - v__ast__Type _t2 = _const_v__ast__string_type; - return _t2; + v__ast__Type _t5 = _const_v__ast__string_type; + return _t5; } v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* node) { @@ -52685,10 +55023,21 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no if (!string_contains(name, _SLIT(".")) && !string__eq(node->mod, _SLIT("builtin"))) { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = node->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}})); } - if (string__eq(name, c->const_decl)) { - v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cycle in constant `"), /*115 &string*/0xfe10, {.d_s = c->const_decl}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t1 = _const_v__ast__void_type; - return _t1; + if (c->const_var != 0 && string__eq(name, c->const_var->name)) { + if ((c->const_var->expr)._typ == 250 /* v.ast.ArrayInit */) { + if ((*c->const_var->expr._v__ast__ArrayInit).is_fixed && v__ast__Type_nr_muls(c->expected_type) > 0) { + v__ast__Type elem_typ = v__ast__Type_deref(c->expected_type); + node->kind = v__ast__IdentKind__constant; + node->name = c->const_var->name; + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = elem_typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); + node->obj = v__ast__ConstField_to_sumtype_v__ast__ScopeObject(c->const_var); + v__ast__Type _t1 = c->expected_type; + return _t1; + } + } + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cycle in constant `"), /*115 &fn (mut v.ast.ConstDecl)*/0xfe10, {.d_s = anon_fn_v__ast__constdecl_str()}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); + v__ast__Type _t2 = _const_v__ast__void_type; + return _t2; } array_push((array*)&c->const_deps, _MOV((string[]){ string_clone(name) })); } @@ -52696,30 +55045,30 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no if (!(node->tok_kind == v__token__Kind__assign || node->tok_kind == v__token__Kind__decl_assign)) { v__checker__Checker_error(c, _SLIT("undefined ident: `_` (may only be used in assignments)"), node->pos); } - v__ast__Type _t3 = _const_v__ast__void_type; - return _t3; + v__ast__Type _t4 = _const_v__ast__void_type; + return _t4; } if (node->kind == v__ast__IdentKind__constant || node->kind == v__ast__IdentKind__global || node->kind == v__ast__IdentKind__variable) { v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 380) /*expected idx: 380, name: v.ast.IdentVar */ ; - v__ast__Type _t4 = info.typ; - return _t4; - } else if (node->kind == v__ast__IdentKind__function) { - v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 379) /*expected idx: 379, name: v.ast.IdentFn */ ; v__ast__Type _t5 = info.typ; return _t5; + } else if (node->kind == v__ast__IdentKind__function) { + v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 379) /*expected idx: 379, name: v.ast.IdentFn */ ; + v__ast__Type _t6 = info.typ; + return _t6; } else if (node->kind == v__ast__IdentKind__unresolved) { if (node->tok_kind == v__token__Kind__assign && node->is_mut) { v__checker__Checker_error(c, _SLIT("`mut` not allowed with `=` (use `:=` to declare a variable)"), node->pos); } - _option_v__ast__ScopeObject _t6; - if (_t6 = v__ast__Scope_find(node->scope, node->name), _t6.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; + _option_v__ast__ScopeObject _t7; + if (_t7 = v__ast__Scope_find(node->scope, node->name), _t7.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t7.data; if (obj._typ == 327 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; - v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; - return _t7; + v__ast__Type _t8 = (*obj._v__ast__GlobalField).typ; + return _t8; } else if (obj._typ == 328 /* v.ast.Var */) { int node_pos = (c->pref->is_vweb && !_IN_MAP(ADDR(string, node->name), ADDR(map, node->scope->objects)) && node->scope->start_pos < c->comptime_call_pos ? (c->comptime_call_pos) : (node->pos.pos)); @@ -52728,25 +55077,25 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } bool is_sum_type_cast = (*obj._v__ast__Var).smartcasts.len != 0 && !c->prevent_sum_type_unwrapping_once; c->prevent_sum_type_unwrapping_once = false; - v__ast__Type _t8; /* if prepend */ + v__ast__Type _t9; /* if prepend */ if (is_sum_type_cast) { - _t8 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); + _t9 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); } else { - _t8 = (*obj._v__ast__Var).typ; + _t9 = (*obj._v__ast__Var).typ; } - v__ast__Type typ = _t8; + v__ast__Type typ = _t9; if (typ == 0) { if (((*obj._v__ast__Var).expr)._typ == 270 /* v.ast.Ident */) { if ((*(*obj._v__ast__Var).expr._v__ast__Ident).kind == v__ast__IdentKind__unresolved) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unresolved variable: `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t9 = _const_v__ast__void_type; - return _t9; + v__ast__Type _t10 = _const_v__ast__void_type; + return _t10; } } if (((*obj._v__ast__Var).expr)._typ == 272 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len) { for (int vi = 0; vi < (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len; ++vi) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.data)[vi]; @@ -52770,11 +55119,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } node->obj = obj; if (is_optional) { - v__ast__Type _t10 = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); - return _t10; + v__ast__Type _t11 = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); + return _t11; } - v__ast__Type _t11 = typ; - return _t11; + v__ast__Type _t12 = typ; + return _t12; } else { @@ -52787,9 +55136,9 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } else if (!string_contains(name, _SLIT(".")) && !string__eq(node->mod, _SLIT("builtin"))) { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = node->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}})); } - _option_v__ast__ScopeObject _t12; - if (_t12 = v__ast__Scope_find(c->file->global_scope, name), _t12.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t12.data; + _option_v__ast__ScopeObject _t13; + if (_t13 = v__ast__Scope_find(c->file->global_scope, name), _t13.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t13.data; if (obj._typ == 326 /* v.ast.ConstField */) { if (!((*obj._v__ast__ConstField).is_pub || string__eq((*obj._v__ast__ConstField).mod, c->mod) || c->pref->is_test)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("constant `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); @@ -52813,39 +55162,39 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); (*obj._v__ast__ConstField).typ = typ; node->obj = obj; - v__ast__Type _t13 = typ; - return _t13; + v__ast__Type _t14 = typ; + return _t14; } else { } ; } - _option_v__ast__Fn _t14; - if (_t14 = v__ast__Table_find_fn(c->table, name), _t14.state == 0) { - v__ast__Fn func = *(v__ast__Fn*)_t14.data; + _option_v__ast__Fn _t15; + if (_t15 = v__ast__Table_find_fn(c->table, name), _t15.state == 0) { + v__ast__Fn func = *(v__ast__Fn*)_t15.data; v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, node->mod, func, false, true)); node->name = name; node->kind = v__ast__IdentKind__function; node->info = v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentFn, (((v__ast__IdentFn){.typ = fn_type,})))); - v__ast__Type _t15 = fn_type; - return _t15; + v__ast__Type _t16 = fn_type; + return _t16; } } if (node->language == v__ast__Language__c) { if (string__eq(node->name, _SLIT("C.NULL"))) { - v__ast__Type _t16 = _const_v__ast__voidptr_type; - return _t16; + v__ast__Type _t17 = _const_v__ast__voidptr_type; + return _t17; } - v__ast__Type _t17 = _const_v__ast__int_type; - return _t17; + v__ast__Type _t18 = _const_v__ast__int_type; + return _t18; } if (c->inside_sql) { - _option_v__ast__StructField _t18; - if (_t18 = v__ast__Table_find_field(c->table, (voidptr)&/*qq*/c->cur_orm_ts, node->name), _t18.state == 0) { - v__ast__StructField field = *(v__ast__StructField*)_t18.data; - v__ast__Type _t19 = field.typ; - return _t19; + _option_v__ast__StructField _t19; + if (_t19 = v__ast__Table_find_field(c->table, (voidptr)&/*qq*/c->cur_orm_ts, node->name), _t19.state == 0) { + v__ast__StructField field = *(v__ast__StructField*)_t19.data; + v__ast__Type _t20 = field.typ; + return _t20; } } if (node->kind == v__ast__IdentKind__unresolved && !string__eq(node->mod, _SLIT("builtin"))) { @@ -52853,8 +55202,8 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no node->mod = _SLIT("builtin"); v__ast__Type builtin_type = v__checker__Checker_ident(c, node); if (!v__ast__Type_alias_eq(builtin_type, _const_v__ast__void_type)) { - v__ast__Type _t20 = builtin_type; - return _t20; + v__ast__Type _t21 = builtin_type; + return _t21; } node->mod = saved_mod; } @@ -52869,17 +55218,17 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no string cname_mod = string_all_before(node->name, _SLIT(".")); if (cname_mod.len != node->name.len) { Array_string const_names_in_mod = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_v__ast__ScopeObject _t21 = c->table->global_scope->objects; - int _t23 = _t21.key_values.len; - for (int _t22 = 0; _t22 < _t23; ++_t22 ) { - int _t24 = _t21.key_values.len - _t23; - _t23 = _t21.key_values.len; - if (_t24 < 0) { - _t22 = -1; + Map_string_v__ast__ScopeObject _t22 = c->table->global_scope->objects; + int _t24 = _t22.key_values.len; + for (int _t23 = 0; _t23 < _t24; ++_t23 ) { + int _t25 = _t22.key_values.len - _t24; + _t24 = _t22.key_values.len; + if (_t25 < 0) { + _t23 = -1; continue; } - if (!DenseArray_has_index(&_t21.key_values, _t22)) {continue;} - v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t21.key_values, _t22)); + if (!DenseArray_has_index(&_t22.key_values, _t23)) {continue;} + v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t22.key_values, _t23)); if ((so)._typ == 326 /* v.ast.ConstField */) { if (string__eq((*so._v__ast__ConstField).mod, cname_mod)) { array_push((array*)&const_names_in_mod, _MOV((string[]){ string_clone((*so._v__ast__ConstField).name) })); @@ -52893,11 +55242,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } } if (v__ast__Table_known_type(c->table, node->name)) { - v__ast__Type _t26 = _const_v__ast__void_type; - return _t26; + v__ast__Type _t27 = _const_v__ast__void_type; + return _t27; } - v__ast__Type _t27 = _const_v__ast__void_type; - return _t27; + v__ast__Type _t28 = _const_v__ast__void_type; + return _t28; } v__ast__Type v__checker__Checker_concat_expr(v__checker__Checker* c, v__ast__ConcatExpr* node) { @@ -53163,7 +55512,7 @@ VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_obj_definition(v__ _option_v__ast__Expr _t3 = v__checker__Checker_find_definition(c, (*expr._v__ast__Ident)); return _t3; } - if (!v__ast__Expr_is_lit(expr)) { + if (!v__ast__Expr_is_pure_literal(expr)) { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("definition of `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is unknown at compile time"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } _option_v__ast__Expr _t5; @@ -53201,8 +55550,8 @@ v__ast__Type v__checker__Checker_postfix_expr(v__checker__Checker* c, v__ast__Po string typ_str = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("invalid operation: "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" (non-numeric type `"), /*115 &string*/0xfe10, {.d_s = typ_str}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } else { - multi_return_string_v__token__Pos mr_96262 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_96262.arg0; + multi_return_string_v__token__Pos mr_97509 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_97509.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -53297,7 +55646,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre } else if ((node->right)._typ == 290 /* v.ast.SelectorExpr */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); - if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).uses_exprs))) { + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).uses_exprs))) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take address of field in struct `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, (*node->right._v__ast__SelectorExpr).expr_type)}}, {_SLIT("`, which is tagged as `[minify]`"), 0, { .d_c = 0 }}})), v__token__Pos_extend(node->pos, (*node->right._v__ast__SelectorExpr).pos)); } } @@ -53382,7 +55731,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) { v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type); if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) { - if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { + if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos); } @@ -53391,7 +55740,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative index `"), /*115 &string*/0xfe10, {.d_s = (*index._v__ast__IntegerLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } else if (typ_sym->kind == v__ast__Kind__array_fixed) { int i = string_int((*index._v__ast__IntegerLiteral).val); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; if ((!range_index && i >= info.size) || (range_index && i > info.size)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("index out of range (index: "), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT(", len: "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT(")"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } @@ -53491,6 +55840,9 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde typ = value_type; } } + if (node->or_expr.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->or_expr.stmts)))._typ == 310 /* v.ast.ExprStmt */) { + c->expected_or_type = typ; + } v__checker__Checker_stmts_ending_with_expression(c, node->or_expr.stmts); v__checker__Checker_check_expr_opt_call(c, v__ast__IndexExpr_to_sumtype_v__ast__Expr(node), typ); v__ast__Type _t1 = typ; @@ -53537,7 +55889,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - if ((fsym->info)._typ != 449 /* v.ast.Enum */) { + if ((fsym->info)._typ != 450 /* v.ast.Enum */) { v__checker__Checker_error(c, _SLIT("not an enum"), node->pos); v__ast__Type _t6 = _const_v__ast__void_type; return _t6; @@ -53800,7 +56152,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array_fixed: { - _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type, pos); + _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type, pos); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; memcpy(&_t4, &_t3, sizeof(_option)); @@ -53833,7 +56185,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__sum_type: { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; for (int _t9 = 0; _t9 < info.concrete_types.len; ++_t9) { v__ast__Type concrete_typ = ((v__ast__Type*)info.concrete_types.data)[_t9]; _option_void _t10 = v__checker__Checker_ensure_type_exists(c, concrete_typ, pos); @@ -53987,7 +56339,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).cmain,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_crun,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -55685,7 +58037,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } ; - if (v__ast__Type_has_flag(node->typ, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (v__ast__Type_has_flag(node->typ, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { v__checker__Checker_error(c, _SLIT("generic struct cannot use in non-generic function"), node->pos); } v__ast__Type _t3 = node->typ; @@ -56066,7 +58418,7 @@ v__ast__Scope* prev_fn_scope; } } v__ast__TypeSymbol* return_sym = v__ast__Table_final_sym(c->table, node->return_type); - if ((return_sym->info)._typ == 446 /* v.ast.MultiReturn */) { + if ((return_sym->info)._typ == 447 /* v.ast.MultiReturn */) { for (int _t4 = 0; _t4 < (*return_sym->info._v__ast__MultiReturn).types.len; ++_t4) { v__ast__Type multi_type = ((v__ast__Type*)(*return_sym->info._v__ast__MultiReturn).types.data)[_t4]; v__ast__TypeSymbol* multi_sym = v__ast__Table_sym(c->table, multi_type); @@ -56117,7 +58469,7 @@ v__ast__Scope* prev_fn_scope; return; } if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - if ((sym->info)._typ == 438 /* v.ast.Interface */) { + if ((sym->info)._typ == 439 /* v.ast.Interface */) { if (v__ast__Interface_has_method(&(*sym->info._v__ast__Interface), node->name)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` cannot implement its own interface method `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -56197,18 +58549,18 @@ v__ast__Scope* prev_fn_scope; v__checker__Checker_error(c, _SLIT("generic struct in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__interface_) { - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic interface in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic sumtype in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } } - if ((c->pref->translated || c->file->is_translated) && node->is_variadic && node->params.len == 1 && v__ast__Type_is_ptr(param->typ)) { + if ((c->pref->translated || c->file->is_translated) && node->is_variadic && v__ast__Type_is_ptr(param->typ)) { param->typ = v__ast__Type_ref(_const_v__ast__int_type); } } @@ -56416,7 +58768,7 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE c->expected_or_type = v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__optional); v__checker__Checker_stmts_ending_with_expression(c, node->or_block.stmts); c->expected_or_type = _const_v__ast__void_type; - if (node->or_block.kind == v__ast__OrKind__propagate_option && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !c->inside_const) { + if (node->or_block.kind == v__ast__OrKind__propagate_option && !isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !c->inside_const) { if (!c->table->cur_fn->is_main) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the optional call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional"), 0, { .d_c = 0 }}})), node->or_block.pos); } @@ -56472,7 +58824,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - c->table->cur_fn->has_await = true; + if (!isnil(c->table->cur_fn)) { + c->table->cur_fn->has_await = true; + } if (tsym->info._typ == 420 /* v.ast.Struct */) { v__ast__Type ret_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*tsym->info._v__ast__Struct).concrete_types, 0)); ret_type = v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional); @@ -56500,7 +58854,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, (*expr._v__ast__TypeNode).typ)); if (v__ast__Table_known_type(c->table, sym->name) && sym->kind != v__ast__Kind__placeholder) { v__ast__Kind kind = sym->kind; - if ((sym->info)._typ == 435 /* v.ast.Alias */) { + if ((sym->info)._typ == 436 /* v.ast.Alias */) { kind = v__ast__Table_sym(c->table, (*sym->info._v__ast__Alias).parent_type)->kind; } if (!(kind == v__ast__Kind__struct_ || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__map || kind == v__ast__Kind__array)) { @@ -56534,7 +58888,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_expr(c, node->left); if (!v__ast__Type_alias_eq((*node->left._v__ast__AnonFn).typ, ((v__ast__Type)(0)))) { v__ast__TypeSymbol* anon_fn_sym = v__ast__Table_sym(c->table, (*node->left._v__ast__AnonFn).typ); - func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ).func; found = true; } } @@ -56554,7 +58908,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_final_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); if ((sym->info)._typ == 415 /* v.ast.Array */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Array).elem_type); - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { func = (*elem_sym->info._v__ast__FnType).func; found = true; } else { @@ -56562,15 +58916,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } else if ((sym->info)._typ == 416 /* v.ast.Map */) { v__ast__TypeSymbol* value_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Map).value_type); - if ((value_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((value_sym->info)._typ == 448 /* v.ast.FnType */) { func = (*value_sym->info._v__ast__FnType).func; found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the value of the map, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 443 /* v.ast.ArrayFixed */) { + } else if ((sym->info)._typ == 444 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__ArrayFixed).elem_type); - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { func = (*elem_sym->info._v__ast__FnType).func; found = true; } else { @@ -56581,7 +58935,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (!found && (node->left)._typ == 256 /* v.ast.CallExpr */) { v__checker__Checker_expr(c, node->left); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__CallExpr).return_type); - if ((sym->info)._typ == 447 /* v.ast.FnType */) { + if ((sym->info)._typ == 448 /* v.ast.FnType */) { node->return_type = (*sym->info._v__ast__FnType).func.return_type; found = true; func = (*sym->info._v__ast__FnType).func; @@ -56653,14 +59007,14 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (typ != 0) { v__ast__TypeSymbol* generic_vts = v__ast__Table_final_sym(c->table, typ); if (generic_vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; } else { v__ast__TypeSymbol* vts = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; @@ -56676,7 +59030,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(obj.typ))); if (sym->kind == v__ast__Kind__function) { found = true; - func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ).func; } } } @@ -56834,9 +59188,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_error(c, _SLIT("function with `shared` arguments cannot be called inside `lock`/`rlock` block"), call_arg->pos); } if (call_arg->is_mut) { - multi_return_string_v__token__Pos mr_28912 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_28912.arg0; - v__token__Pos pos = mr_28912.arg1; + multi_return_string_v__token__Pos mr_28998 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_28998.arg0; + v__token__Pos pos = mr_28998.arg1; if (!v__ast__Expr_is_lvalue(call_arg->expr)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(call_arg->expr)); } @@ -56876,6 +59230,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } + if (v__ast__Type_is_ptr(param.typ) && !param.is_mut && !v__ast__Type_is_real_pointer(call_arg->typ) && v__ast__Expr_is_literal(call_arg->expr) && func.language == v__ast__Language__v) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("literal argument cannot be passed as reference parameter `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, param.typ)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), call_arg->pos); + } _option_void _t32 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { IError err = _t32.err; @@ -56928,7 +59285,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } } else if (arg_typ_sym_->kind == v__ast__Kind__array_fixed && param_typ_sym_->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ).elem_type)) { continue; } } @@ -56987,12 +59344,12 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } } - if (func.generic_names.len > 0 && v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (func.generic_names.len > 0 && v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { node->return_type = v__ast__Table_unwrap_generic_type(c->table, func.return_type, func.generic_names, concrete_types); } else { node->return_type = func.return_type; } - if (node->concrete_types.len > 0 && func.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { + if (node->concrete_types.len > 0 && func.return_type != 0 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { _option_v__ast__Type _t35; if (_t35 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t35.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t35.data; @@ -57034,7 +59391,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal node->left_type = left_type; node->return_type = left_type; node->receiver_type = left_type; - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { v__ast__Table_unwrap_generic_type(c->table, left_type, c->table->cur_fn->generic_names, c->table->cur_concrete_types); } v__ast__Type unwrapped_left_type = v__checker__Checker_unwrap_generic(c, left_type); @@ -57078,7 +59435,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); return _t8; } else { - v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); return _t9; } @@ -57119,13 +59476,15 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } - c->table->cur_fn->has_await = true; + if (!isnil(c->table->cur_fn)) { + c->table->cur_fn->has_await = true; + } node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0)); v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional); v__ast__Type _t14 = node->return_type; return _t14; } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { - v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.Thread */ ; + v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.Thread */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -57151,9 +59510,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type parent_type = _const_v__ast__void_type; if ((left_sym->info)._typ == 420 /* v.ast.Struct */) { parent_type = (*left_sym->info._v__ast__Struct).parent_type; - } else if ((left_sym->info)._typ == 439 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 440 /* v.ast.SumType */) { parent_type = (*left_sym->info._v__ast__SumType).parent_type; - } else if ((left_sym->info)._typ == 438 /* v.ast.Interface */) { + } else if ((left_sym->info)._typ == 439 /* v.ast.Interface */) { parent_type = (*left_sym->info._v__ast__Interface).parent_type; } if (parent_type != 0) { @@ -57180,9 +59539,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_42752 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_42752.arg0; - embed_types = mr_42752.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_43216 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_43216.arg0; + embed_types = mr_43216.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -57230,9 +59589,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); } if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { - multi_return_string_v__token__Pos mr_45062 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45062.arg0; - v__token__Pos pos = mr_45062.arg1; + multi_return_string_v__token__Pos mr_45526 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_45526.arg0; + v__token__Pos pos = mr_45526.arg1; if (!v__ast__Expr_is_lvalue(node->left)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); } @@ -57272,7 +59631,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type exp_arg_typ = ((v__ast__Type)(0)); bool param_is_mut = false; bool no_type_promotion = false; - if ((left_sym->info)._typ == 444 /* v.ast.Chan */) { + if ((left_sym->info)._typ == 445 /* v.ast.Chan */) { if (string__eq(method_name, _SLIT("try_push"))) { exp_arg_typ = v__ast__Type_ref((*left_sym->info._v__ast__Chan).elem_type); } else if (string__eq(method_name, _SLIT("try_pop"))) { @@ -57340,9 +59699,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); } if (arg->is_mut) { - multi_return_string_v__token__Pos mr_48964 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_48964.arg0; - v__token__Pos pos = mr_48964.arg1; + multi_return_string_v__token__Pos mr_49428 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_49428.arg0; + v__token__Pos pos = mr_49428.arg1; if (!param_is_mut) { string tok = v__ast__ShareType_str(arg->share); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); @@ -57366,7 +59725,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type elem_typ = (*left_sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg->typ); if (arg_sym->kind == v__ast__Kind__function) { - v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; if (func_info.func.params.len == 2) { if (v__ast__Type_nr_muls((*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ) != v__ast__Type_nr_muls(elem_typ) + 1) { string arg_typ_str = v__ast__Table_type_to_str(c->table, (*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ); @@ -57392,6 +59751,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } continue; } + if (v__ast__Type_is_ptr(param.typ) && !v__ast__Type_is_real_pointer(arg->typ) && v__ast__Expr_is_literal(arg->expr)) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("literal argument cannot be passed as reference parameter `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, param.typ)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); + } _option_void _t31 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg); if (_t31.state != 0 && _t31.err._typ != _IError_None___index) { IError err = _t31.err; @@ -57413,7 +59775,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (method.is_unsafe && !c->inside_unsafe) { v__checker__Checker_warn(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("method `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("` must be called from an `unsafe` block"), 0, { .d_c = 0 }}})), node->pos); } - if (!c->table->cur_fn->is_deprecated && method.is_deprecated) { + if (!isnil(c->table->cur_fn) && !c->table->cur_fn->is_deprecated && method.is_deprecated) { v__checker__Checker_deprecate_fnmethod(c, _SLIT("method"), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})), method, *node); } v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/method); @@ -57432,12 +59794,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Table_register_fn_concrete_types(c->table, v__ast__Fn_fkey(&method), node->concrete_types); } } - if (method.generic_names.len > 0 && v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (method.generic_names.len > 0 && v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { node->return_type = v__ast__Table_unwrap_generic_type(c->table, method.return_type, method.generic_names, concrete_types); } else { node->return_type = method.return_type; } - if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { + if (node->concrete_types.len > 0 && method.return_type != 0 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { _option_v__ast__Type _t32; if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t32.data; @@ -57487,7 +59849,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (field_sym->kind == v__ast__Kind__function) { node->is_method = false; node->is_field = true; - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; _option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); if (_t39.state != 0 && _t39.err._typ != _IError_None___index) { IError err = _t39.err; @@ -57526,8 +59888,8 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal return _t44; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_56127 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); - node->from_embed_types = mr_56127.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_56878 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_56878.arg1; v__ast__Type _t45 = info.func.return_type; return _t45; } @@ -57597,7 +59959,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* if (_t2.state != 0) { /*or block*/ IError err = _t2.err; v__checker__Checker_error(c, _SLIT("invalid time format"), attr.pos); - *(time__Time*) _t2.data = time__now(); + *(time__Time*) _t2.data = now; } after_time = (*(time__Time*)_t2.data); @@ -57900,7 +60262,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("map"))) { v__checker__Checker_check_map_and_filter(c, true, elem_typ, *node); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); - v__ast__Type ret_type = ((arg_sym->info._typ == 447 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); + v__ast__Type ret_type = ((arg_sym->info._typ == 448 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); node->return_type = v__ast__Table_find_or_register_array(c->table, v__checker__Checker_unwrap_generic(c, ret_type)); if (v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__shared_f)) { node->return_type = v__ast__Type_deref(v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__shared_f)); @@ -58389,7 +60751,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; if ((branch.cond)._typ == 272 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; if ((*branch.cond._v__ast__IfGuardExpr).vars.len != mr_info.types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("if guard expects "), /*100 &int*/0xfe07, {.d_i32 = mr_info.types.len}}, {_SLIT(" variables, but got "), /*100 &int*/0xfe07, {.d_i32 = (*branch.cond._v__ast__IfGuardExpr).vars.len}}, {_SLIT0, 0, { .d_c = 0 }}})), branch.pos); } else { @@ -58421,11 +60783,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; c->returns = false; } } - if (v__ast__Type_alias_eq(node->typ, _const_v__ast__int_literal_type)) { - node->typ = _const_v__ast__int_type; - } else if (v__ast__Type_alias_eq(node->typ, _const_v__ast__float_literal_type)) { - node->typ = _const_v__ast__f64_type; - } + node->typ = v__ast__mktyp(node->typ); if (expr_required && !node->has_else) { string d = (node->is_comptime ? (_SLIT("$")) : (_SLIT(""))); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT("` expression needs `"), /*115 &string*/0xfe10, {.d_s = d}}, {_SLIT("else` clause"), 0, { .d_c = 0 }}})), node->pos); @@ -58464,7 +60822,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__Type expr_type = v__checker__Checker_expr(c, (*node._v__ast__InfixExpr).left); if (left_sym->kind == v__ast__Kind__aggregate) { - expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; + expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ).sum_type; } if (left_sym->kind == v__ast__Kind__interface_) { if (right_sym->kind != v__ast__Kind__interface_) { @@ -58661,15 +61019,15 @@ v__ast__Type former_expected_type; case v__token__Kind__amp: case v__token__Kind__pipe: { - if ((right_sym->info)._typ == 435 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type))) { - right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + if ((right_sym->info)._typ == 436 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type))) { + right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); } - if ((left_sym->info)._typ == 435 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type))) { - left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + if ((left_sym->info)._typ == 436 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type))) { + left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); } if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; - } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 435 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 436 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t5; if (_t5 = v__ast__TypeSymbol_find_method(left_sym, v__token__Kind_str(node->op)), _t5.state == 0) { @@ -58688,7 +61046,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 435 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 436 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(right_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t6; if (_t6 = v__ast__TypeSymbol_find_method(right_sym, v__token__Kind_str(node->op)), _t6.state == 0) { @@ -59023,12 +61381,12 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT(": type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("` does not exist"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(right_expr)); } if (left_sym->kind == v__ast__Kind__aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(c->table, parent_left_type); } if (!(left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT("` can only be used with interfaces and sum types"), 0, { .d_c = 0 }}})), node->pos); - } else if ((left_sym->info)._typ == 439 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 440 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*left_sym->info._v__ast__SumType).variants, typ)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -59190,8 +61548,8 @@ v__ast__Type former_expected_type; } else if (v__ast__Type_alias_eq(left_type, _const_v__ast__string_type) && !(node->op == v__token__Kind__plus || node->op == v__token__Kind__eq || node->op == v__token__Kind__ne || node->op == v__token__Kind__lt || node->op == v__token__Kind__gt || node->op == v__token__Kind__le || node->op == v__token__Kind__ge)) { v__checker__Checker_error(c, _SLIT("string types only have the following operators defined: `==`, `!=`, `<`, `>`, `<=`, `>=`, and `+`"), node->pos); } else if (left_sym->kind == v__ast__Kind__enum_ && right_sym->kind == v__ast__Kind__enum_ && !eq_ne) { - v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ; - v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ; + v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ; + v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ; if (left_enum.is_flag && right_enum.is_flag) { if (!(node->op == v__token__Kind__pipe || node->op == v__token__Kind__amp)) { v__checker__Checker_error(c, _SLIT("only `==`, `!=`, `|` and `&` are defined on `[flag]` tagged `enum`, use an explicit cast to `int` if needed"), node->pos); @@ -59275,7 +61633,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_check_valid_pascal_case(c, node->name, _SLIT("interface name"), node->pos); v__ast__TypeSymbol* decl_sym = v__ast__Table_sym(c->table, node->typ); bool is_js = node->language == v__ast__Language__js; - if ((decl_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((decl_sym->info)._typ == 439 /* v.ast.Interface */) { if (node->embeds.len > 0) { Array_v__ast__InterfaceEmbedding all_embeds = v__checker__Checker_expand_iface_embeds(c, node, 0, node->embeds); node->embeds = all_embeds; @@ -59307,7 +61665,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` tries to embed `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("`, but `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("` is not an interface, but `"), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(isym->kind)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), embed.pos); continue; } - v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; for (int _t2 = 0; _t2 < isym_info.fields.len; ++_t2) { v__ast__StructField f = ((v__ast__StructField*)isym_info.fields.data)[_t2]; if (!(*(bool*)map_get(ADDR(map, efnames_ds_info), &(string[]){f.name}, &(bool[]){ 0 }))) { @@ -59472,7 +61830,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, utyp); v__ast__TypeSymbol* inter_sym = v__ast__Table_sym(c->table, interface_type); - if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 439 /* v.ast.Interface */) { if ((*inter_sym->info._v__ast__Interface).is_generic) { Array_v__ast__Type inferred_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_string _t1 = {0}; @@ -59529,7 +61887,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type _t11 = 0; return _t11; } - if ((imret_sym->info)._typ == 446 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 446 /* v.ast.MultiReturn */) { + if ((imret_sym->info)._typ == 447 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 447 /* v.ast.MultiReturn */) { for (int i = 0; i < (*imret_sym->info._v__ast__MultiReturn).types.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)(*imret_sym->info._v__ast__MultiReturn).types.data)[i]; if (v__ast__Type_has_flag(mr_typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_get_type_name(c->table, mr_typ), gt_name)) { @@ -59774,7 +62132,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__ast__Expr high_expr = (*expr._v__ast__RangeExpr).high; v__ast__TypeSymbol* final_cond_sym = v__ast__Table_final_sym(c->table, node->cond_type); if ((low_expr)._typ == 275 /* v.ast.IntegerLiteral */) { - if ((high_expr)._typ == 275 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 449 /* v.ast.Enum */)) { + if ((high_expr)._typ == 275 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 450 /* v.ast.Enum */)) { low = string_i64((*low_expr._v__ast__IntegerLiteral).val); high = string_i64((*high_expr._v__ast__IntegerLiteral).val); if (low > high) { @@ -59842,7 +62200,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - } else if ((cond_type_sym.info)._typ == 439 /* v.ast.SumType */) { + } else if ((cond_type_sym.info)._typ == 440 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*cond_type_sym.info._v__ast__SumType).variants, expr_type)) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); @@ -59861,7 +62219,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__util__Suggestion suggestion = v__util__new_suggestion(expr_str, sumtype_variant_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), v__ast__Expr_pos(expr)); } - } else if ((cond_type_sym.info)._typ == 435 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 420 /* v.ast.Struct */) { + } else if ((cond_type_sym.info)._typ == 436 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 420 /* v.ast.Struct */) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot match alias type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` with `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); @@ -59927,7 +62285,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } else { - if (cond_type_sym.info._typ == 439 /* v.ast.SumType */) { + if (cond_type_sym.info._typ == 440 /* v.ast.SumType */) { for (int _t8 = 0; _t8 < (*cond_type_sym.info._v__ast__SumType).variants.len; ++_t8) { v__ast__Type v = ((v__ast__Type*)(*cond_type_sym.info._v__ast__SumType).variants.data)[_t8]; string v_str = v__ast__Table_type_to_str(c->table, v); @@ -59937,7 +62295,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - else if (cond_type_sym.info._typ == 449 /* v.ast.Enum */) { + else if (cond_type_sym.info._typ == 450 /* v.ast.Enum */) { for (int _t10 = 0; _t10 < (*cond_type_sym.info._v__ast__Enum).vals.len; ++_t10) { string v = ((string*)(*cond_type_sym.info._v__ast__Enum).vals.data)[_t10]; if (!_IN_MAP(ADDR(string, v), ADDR(map, branch_exprs))) { @@ -60278,6 +62636,9 @@ VV_LOCAL_SYMBOL Array_v__ast__StructField v__checker__Checker_fetch_and_verify_o } void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* node) { + if (isnil(c->table->cur_fn)) { + return; + } c->expected_type = c->table->cur_fn->return_type; v__ast__Type expected_type = v__checker__Checker_unwrap_generic(c, c->expected_type); v__ast__TypeSymbol* expected_type_sym = v__ast__Table_sym(c->table, expected_type); @@ -60296,7 +62657,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod bool exp_is_optional = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional); bool exp_is_result = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__result); Array_v__ast__Type expected_types = new_array_from_c_array(1, 1, sizeof(v__ast__Type), _MOV((v__ast__Type[1]){expected_type})); - if ((expected_type_sym->info)._typ == 446 /* v.ast.MultiReturn */) { + if ((expected_type_sym->info)._typ == 447 /* v.ast.MultiReturn */) { expected_types = (*expected_type_sym->info._v__ast__MultiReturn).types; if (c->table->cur_concrete_types.len > 0) { Array_v__ast__Type _t1 = {0}; @@ -60377,7 +62738,9 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (expected_types.len > 0 && expected_types.len != got_types.len) { string arg = (expected_types.len == 1 ? (_SLIT("argument")) : (_SLIT("arguments"))); - v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = expected_types.len}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(", but got "), /*100 &int*/0xfe07, {.d_i32 = got_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); + int midx = v__checker__imax(0, v__checker__imin(expected_types.len, expr_idxs.len - 1)); + v__token__Pos mismatch_pos = v__ast__Expr_pos((*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, (*(int*)/*ee elem_sym */array_get(expr_idxs, midx))))); + v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = expected_types.len}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(", but got "), /*100 &int*/0xfe07, {.d_i32 = got_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), mismatch_pos); return; } for (int i = 0; i < expected_types.len; ++i) { @@ -60633,6 +62996,16 @@ VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr) { return _t2; } +VV_LOCAL_SYMBOL int v__checker__imin(int a, int b) { + int _t1 = (a < b ? (a) : (b)); + return _t1; +} + +VV_LOCAL_SYMBOL int v__checker__imax(int a, int b) { + int _t1 = (a < b ? (b) : (a)); + return _t1; +} + u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp, v__ast__Type typ) { if (v__ast__Type_has_flag(ftyp, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(ftyp, v__ast__TypeFlag__result)) { u8 _t1 = 's'; @@ -60652,7 +63025,7 @@ u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, ftyp)); if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; sym = v__ast__Table_sym(c->table, info.parent_type); if (v__ast__Type_alias_eq(info.parent_type, _const_v__ast__string_type)) { u8 _t6 = 's'; @@ -60715,7 +63088,7 @@ v__ast__Type v__checker__Checker_string_inter_lit(v__checker__Checker* c, v__ast } array_set(&node->need_fmts, i, &(bool[]) { fmt != v__checker__Checker_get_default_fmt(c, ftyp, typ) }); } - if (c->table->cur_fn->is_method && string__eq(c->table->cur_fn->name, _SLIT("str")) && string__eq(c->table->cur_fn->receiver.name, v__ast__Expr_str(expr))) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->is_method && string__eq(c->table->cur_fn->name, _SLIT("str")) && string__eq(c->table->cur_fn->receiver.name, v__ast__Expr_str(expr))) { v__checker__Checker_error(c, _SLIT("cannot call `str()` method recursively"), v__ast__Expr_pos(expr)); } } @@ -60886,7 +63259,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); if (field_sym->kind == v__ast__Kind__function) { - v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; _option_void _t4 = v__checker__Checker_ensure_type_exists(c, fn_info.func.return_type, fn_info.func.return_type_pos); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { IError err = _t4.err; @@ -60979,18 +63352,18 @@ VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__S v__ast__Table* t = global_table; v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); - if ((a_sym->info)._typ == 449 /* v.ast.Enum */) { + if ((a_sym->info)._typ == 450 /* v.ast.Enum */) { if (!(*a_sym->info._v__ast__Enum).is_flag && !(*a_sym->info._v__ast__Enum).uses_exprs) { if (b_sym->kind == v__ast__Kind__enum_) { int a_nr_vals = ((*a_sym->info._v__ast__Enum)).vals.len; - int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).vals.len; int _t5 = (a_nr_vals > b_nr_vals ? (-1) : a_nr_vals < b_nr_vals ? (1) : (0)); return _t5; } int _t6 = 1; return _t6; } - } else if ((b_sym->info)._typ == 449 /* v.ast.Enum */) { + } else if ((b_sym->info)._typ == 450 /* v.ast.Enum */) { if (!(*b_sym->info._v__ast__Enum).is_flag && !(*b_sym->info._v__ast__Enum).uses_exprs) { int _t7 = -1; return _t7; @@ -61036,7 +63409,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, _SLIT("generic struct init must specify type parameter, e.g. Foo"), node->pos); } else if (node->generic_types.len > 0 && node->generic_types.len != (*struct_sym->info._v__ast__Struct).generic_types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("generic struct init expects "), /*100 &int*/0xfe07, {.d_i32 = (*struct_sym->info._v__ast__Struct).generic_types.len}}, {_SLIT(" generic parameter, but got "), /*100 &int*/0xfe07, {.d_i32 = node->generic_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); - } else if (node->generic_types.len > 0) { + } else if (node->generic_types.len > 0 && !isnil(c->table->cur_fn)) { for (int _t3 = 0; _t3 < node->generic_types.len; ++_t3) { v__ast__Type gtyp = ((v__ast__Type*)node->generic_types.data)[_t3]; string gtyp_name = v__ast__Table_sym(c->table, gtyp)->name; @@ -61051,7 +63424,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->generic_types.len > 0 && (*struct_sym->info._v__ast__Struct).generic_types.len == node->generic_types.len && !Array_v__ast__Type_arr_eq((*struct_sym->info._v__ast__Struct).generic_types, node->generic_types)) { v__ast__Table_replace_generic_type(c->table, node->typ, node->generic_types); } - } else if ((struct_sym->info)._typ == 435 /* v.ast.Alias */) { + } else if ((struct_sym->info)._typ == 436 /* v.ast.Alias */) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*struct_sym->info._v__ast__Alias).parent_type); if (parent_sym->kind == v__ast__Kind__map) { string alias_str = v__ast__Table_type_to_str(c->table, node->typ); @@ -61061,7 +63434,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t4; } } - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { v__ast__Table_unwrap_generic_type(c->table, node->typ, c->table->cur_fn->generic_names, c->table->cur_concrete_types); } _option_void _t5 = v__checker__Checker_ensure_type_exists(c, node->typ, node->pos); @@ -61094,7 +63467,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (type_sym->kind == v__ast__Kind__interface_ && type_sym->language != v__ast__Language__js) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate interface `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - if ((type_sym->info)._typ == 435 /* v.ast.Alias */) { + if ((type_sym->info)._typ == 436 /* v.ast.Alias */) { if (v__ast__Type_is_number((*type_sym->info._v__ast__Alias).parent_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate number type alias `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t7 = _const_v__ast__void_type; @@ -61110,7 +63483,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is declared with a `[noinit]` attribute, so "), 0, { .d_c = 0 }}})), str_intp(2, _MOV((StrIntpData[]){{_SLIT("it cannot be initialized with `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("{}`"), 0, { .d_c = 0 }}}))), node->pos); } } - if (type_sym->name.len == 1 && c->table->cur_fn->generic_names.len == 0) { + if (type_sym->name.len == 1 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t8 = 0; return _t8; @@ -61124,7 +63497,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { - v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); if (sym->kind == v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct: "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); @@ -61155,7 +63528,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); for (int i = 0; i < node->fields.len; ++i) { v__ast__StructInitField* field = ((v__ast__StructInitField*)node->fields.data) + i; - v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); string field_name = _SLIT(""); if (node->is_short) { if (i >= info.fields.len) { @@ -61171,7 +63544,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (_t11.state != 0) { /*or block*/ IError err = _t11.err; exists = false; - *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); } field_info = (*(v__ast__StructField*)_t11.data); @@ -62892,10 +65265,10 @@ bool v__markused__mark_used_defer_0 = false; if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 438 /* v.ast.Interface */) { + if ((isym->info)._typ != 439 /* v.ast.Interface */) { continue; } - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (interface_info.methods.len == 0) { continue; } @@ -62999,7 +65372,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -63125,7 +65498,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 185 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } else if (node._typ == 306 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -63228,7 +65601,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ println( str_intp(2, _MOV((StrIntpData[]){{_SLIT(">>>> "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT(" uses: "), 0, { .d_c = 0 }}}))); } #endif - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } } } @@ -63899,7 +66272,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_write(g, _SLIT("0")); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; for (int _t1 = 1; _t1 < info.size; ++_t1) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_write(g, _SLIT("0")); @@ -63957,7 +66330,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_expr(g, node.default_expr); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; for (int _t2 = 1; _t2 < info.size; ++_t2) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_expr(g, node.default_expr); @@ -64515,7 +66888,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); } } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; int size = left_info.size; v__ast__Type elem_type = left_info.elem_type; string elem_type_str = v__gen__c__Gen_typ(g, elem_type); @@ -65387,7 +67760,7 @@ string sref_name; if (is_inside_ternary && is_decl) { strings__Builder_write_string(&g->out, v__util__tabs(g->indent - g->inside_ternary)); } - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); string call_conv = _SLIT(""); string msvc_call_conv = _SLIT(""); @@ -65636,12 +68009,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (left._typ == 270 /* v.ast.Ident */) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); + string anon_ctx = (g->anon_fn ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT("->"), 0, { .d_c = 0 }}}))) : (_SLIT(""))); if (left_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = anon_ctx}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { string styp = v__gen__c__Gen_typ(g, left_typ); - v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = anon_ctx}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else if (left._typ == 273 /* v.ast.IndexExpr */) { @@ -65652,7 +68026,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (elem_typ->kind == v__ast__Kind__function) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)array_get(")); } else { string styp = v__gen__c__Gen_typ(g, info.elem_type); @@ -65681,7 +68055,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (val_typ->kind == v__ast__Kind__function) { v__ast__Type left_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_type); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)map_get(")); } else { v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)map_get("), 0, { .d_c = 0 }}}))); @@ -65778,6 +68152,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__InfixExpr).right); } } + else if (val._typ == 285 /* v.ast.ParExpr */) { + v__gen__c__Gen_write(g, _SLIT("(")); + v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__ParExpr).expr); + v__gen__c__Gen_write(g, _SLIT(")")); + } + else if (val._typ == 256 /* v.ast.CallExpr */) { + string fn_name = string_replace((*val._v__ast__CallExpr).name, _SLIT("."), _SLIT("__")); + v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); + for (int i = 0; i < (*val._v__ast__CallExpr).args.len; ++i) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*val._v__ast__CallExpr).args.data)[i]; + v__gen__c__Gen_gen_cross_tmp_variable(g, left, arg.expr); + if (i != (*val._v__ast__CallExpr).args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + v__gen__c__Gen_write(g, _SLIT(")")); + } else if (val._typ == 287 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PrefixExpr).op)); v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PrefixExpr).right); @@ -65993,7 +68384,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_alias_equality_fn(v__gen__c__Gen* g, v return _t1; } array_push((array*)&g->generated_eq_fns, _MOV((v__ast__Type[]){ left_type })); - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b); // auto"), 0, { .d_c = 0 }}}))); strings__Builder fn_builder = strings__new_builder(512); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); @@ -66159,7 +68550,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_map_equality_fn(v__gen__c__Gen* g, v__ strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (!map_exists(&b, k)) return false;")); v__ast__Kind kind = v__ast__Table_type_kind(g->table, value.typ); if (kind == v__ast__Kind__function) { - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); strings__Builder_write_string(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*v) ("), 0, { .d_c = 0 }}}))); int arg_len = func.func.params.len; @@ -66294,7 +68685,7 @@ strings__Builder fn_builder; strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("_interface_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, _SLIT("\tif (a._typ == b._typ) {")); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tint idx = v_typeof_interface_idx_"), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("(a._typ);"), 0, { .d_c = 0 }}}))); - if ((info)._typ == 438 /* v.ast.Interface */) { + if ((info)._typ == 439 /* v.ast.Interface */) { for (int _t3 = 0; _t3 < (*info._v__ast__Interface).types.len; ++_t3) { v__ast__Type typ = ((v__ast__Type*)(*info._v__ast__Interface).types.data)[_t3]; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif (idx == "), /*100 &int*/0xfe07, {.d_i32 = v__ast__Type_idx(typ)}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); @@ -66350,7 +68741,7 @@ strings__Builder fn_builder; VV_LOCAL_SYMBOL string v__gen__c__Gen_get_free_method(v__gen__c__Gen* g, v__ast__Type typ) { map_set(&g->autofree_methods, &(int[]){typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 435 /* v.ast.Alias */) { + if ((sym->info)._typ == 436 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -66391,7 +68782,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ } map_set(&g->generated_free_methods, &(int[]){deref_typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 435 /* v.ast.Alias */) { + if ((sym->info)._typ == 436 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -66556,7 +68947,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, unwrapped); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped); string str_fn_name = v__gen__c__styp_to_str_fn_name(styp); - if ((sym->info)._typ == 435 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 436 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); str_fn_name = v__gen__c__styp_to_str_fn_name(sym->name); @@ -66594,7 +68985,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ v__gen__c__Gen_gen_str_for_result(g, typ.typ, styp, str_fn_name); return; } - if (sym->info._typ == 435 /* v.ast.Alias */) { + if (sym->info._typ == 436 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { v__gen__c__Gen_gen_str_default(g, *sym, styp, str_fn_name); } else { @@ -66604,13 +68995,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ else if (sym->info._typ == 415 /* v.ast.Array */) { v__gen__c__Gen_gen_str_for_array(g, (*sym->info._v__ast__Array), styp, str_fn_name); } - else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 444 /* v.ast.ArrayFixed */) { v__gen__c__Gen_gen_str_for_array_fixed(g, (*sym->info._v__ast__ArrayFixed), styp, str_fn_name); } - else if (sym->info._typ == 449 /* v.ast.Enum */) { + else if (sym->info._typ == 450 /* v.ast.Enum */) { v__gen__c__Gen_gen_str_for_enum(g, (*sym->info._v__ast__Enum), styp, str_fn_name); } - else if (sym->info._typ == 447 /* v.ast.FnType */) { + else if (sym->info._typ == 448 /* v.ast.FnType */) { v__gen__c__Gen_gen_str_for_fn_type(g, (*sym->info._v__ast__FnType), styp, str_fn_name); } else if (sym->info._typ == 420 /* v.ast.Struct */) { @@ -66619,19 +69010,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ else if (sym->info._typ == 416 /* v.ast.Map */) { v__gen__c__Gen_gen_str_for_map(g, (*sym->info._v__ast__Map), styp, str_fn_name); } - else if (sym->info._typ == 446 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 447 /* v.ast.MultiReturn */) { v__gen__c__Gen_gen_str_for_multi_return(g, (*sym->info._v__ast__MultiReturn), styp, str_fn_name); } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { v__gen__c__Gen_gen_str_for_union_sum_type(g, (*sym->info._v__ast__SumType), styp, str_fn_name); } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { v__gen__c__Gen_gen_str_for_interface(g, (*sym->info._v__ast__Interface), styp, str_fn_name); } - else if (sym->info._typ == 444 /* v.ast.Chan */) { + else if (sym->info._typ == 445 /* v.ast.Chan */) { v__gen__c__Gen_gen_str_for_chan(g, (*sym->info._v__ast__Chan), styp, str_fn_name); } - else if (sym->info._typ == 445 /* v.ast.Thread */) { + else if (sym->info._typ == 446 /* v.ast.Thread */) { v__gen__c__Gen_gen_str_for_thread(g, (*sym->info._v__ast__Thread), styp, str_fn_name); } @@ -67032,7 +69423,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ #endif v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 435 /* v.ast.Alias */) { + if ((sym->info)._typ == 436 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } @@ -67112,7 +69503,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v #endif v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 435 /* v.ast.Alias */) { + if ((sym->info)._typ == 436 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } @@ -67180,7 +69571,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M #endif v__ast__Type key_typ = info.key_type; v__ast__TypeSymbol* key_sym = v__ast__Table_sym(g->table, key_typ); - if ((key_sym->info)._typ == 435 /* v.ast.Alias */) { + if ((key_sym->info)._typ == 436 /* v.ast.Alias */) { key_typ = (*key_sym->info._v__ast__Alias).parent_type; key_sym = v__ast__Table_sym(g->table, key_typ); } @@ -67191,7 +69582,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M } v__ast__Type val_typ = info.value_type; v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_typ); - if ((val_sym->info)._typ == 435 /* v.ast.Alias */) { + if ((val_sym->info)._typ == 436 /* v.ast.Alias */) { val_typ = (*val_sym->info._v__ast__Alias).parent_type; val_sym = v__ast__Table_sym(g->table, val_typ); } @@ -67752,7 +70143,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -67779,6 +70170,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .autofree_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .generated_free_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .autofree_scope_stmts = __new_array(0, 0, sizeof(string)), + .use_segfault_handler = !(Array_string_contains(pref->compile_defines, _SLIT("no_segfault_handler")) || pref->os == v__pref__OS__wasm32), }); if (pref->is_test) { v__gen__c__Gen_write_tests_definitions(&global_g); @@ -67793,6 +70185,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_init(&global_g); v__util__Timers_show(global_g.timers, _SLIT("cgen init")); global_g.tests_inited = false; + global_g.file = (*(v__ast__File**)array_last(files)); if (!pref->no_parallel) { sync__pool__PoolProcessor* pp = sync__pool__new_pool_processor(((sync__pool__PoolProcessorConfig){.maxjobs = 0,.callback = (voidptr)v__gen__c__cgen_process_one_file_cb,})); sync__pool__PoolProcessor_set_shared_context(pp, (voidptr)&/*qq*/global_g); @@ -68214,6 +70607,9 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_finish(&g); strings__Builder b = strings__new_builder(640000); strings__Builder_write_string(&b, v__gen__c__Gen_hashes(&g)); + if (g.use_segfault_handler) { + strings__Builder_writeln(&b, _SLIT("\n#define V_USE_SIGNAL_H")); + } strings__Builder_writeln(&b, _SLIT("\n// V comptime_definitions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.comptime_definitions)); strings__Builder_writeln(&b, _SLIT("\n// V typedefs:")); @@ -68447,7 +70843,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -68474,6 +70870,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .autofree_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .generated_free_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .autofree_scope_stmts = __new_array(0, 0, sizeof(string)), + .use_segfault_handler = global_g->use_segfault_handler, }, sizeof(v__gen__c__Gen))); v__gen__c__Gen_gen_file(g); v__gen__c__Gen* _t1 = g; @@ -68709,7 +71106,9 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { } } v__ast__Table* muttable = ((v__ast__Table*)(g->table)); - map_set(&muttable->used_fns, &(string[]){_SLIT("v_segmentation_fault_handler")}, &(bool[]) { true }); + if (g->use_segfault_handler) { + map_set(&muttable->used_fns, &(string[]){_SLIT("v_segmentation_fault_handler")}, &(bool[]) { true }); + } map_set(&muttable->used_fns, &(string[]){_SLIT("eprintln")}, &(bool[]) { true }); map_set(&muttable->used_fns, &(string[]){_SLIT("print_backtrace")}, &(bool[]) { true }); map_set(&muttable->used_fns, &(string[]){_SLIT("exit")}, &(bool[]) { true }); @@ -68729,12 +71128,7 @@ void v__gen__c__Gen_finish(v__gen__c__Gen* g) { if (g->pref->is_livemain || g->pref->is_liveshared) { v__gen__c__Gen_generate_hotcode_reloader_code(g); } - if (g->embedded_files.len > 0) { - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { - v__gen__c__Gen_gen_embedded_data(g); - } - v__gen__c__Gen_gen_embedded_metadata(g); - } + v__gen__c__Gen_handle_embedded_files_finish(g); if (g->pref->is_test) { v__gen__c__Gen_gen_c_main_for_tests(g); } else { @@ -68748,7 +71142,7 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { for (int ityp = 0; ityp < g->table->type_symbols.len; ++ityp) { v__ast__TypeSymbol* sym = ((v__ast__TypeSymbol**)g->table->type_symbols.data)[ityp]; if (sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; if (sum_info.is_generic) { continue; } @@ -68797,10 +71191,10 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("}")); } else if (sym->kind == v__ast__Kind__interface_) { - if ((sym->info)._typ != 438 /* v.ast.Interface */) { + if ((sym->info)._typ != 439 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -68946,18 +71340,18 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_result_type_text(v__gen__c__Gen* g, string } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_optional(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_37846 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_37846.arg0; - string base = mr_37846.arg1; + multi_return_string_string mr_38074 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_38074.arg0; + string base = mr_38074.arg1; map_set(&g->optionals, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_result(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_37979 = v__gen__c__Gen_result_type_name(g, t); - string styp = mr_37979.arg0; - string base = mr_37979.arg1; + multi_return_string_string mr_38207 = v__gen__c__Gen_result_type_name(g, t); + string styp = mr_38207.arg0; + string base = mr_38207.arg1; map_set(&g->results, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -69179,7 +71573,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string sgtyps = _SLIT("_T"); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Interface).generic_types.len; ++_t2) { @@ -69190,7 +71584,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string sgtyps = _SLIT("_T"); for (int _t3 = 0; _t3 < (*sym->info._v__ast__SumType).generic_types.len; ++_t3) { @@ -69244,13 +71638,13 @@ void v__gen__c__Gen_write_typedef_types(v__gen__c__Gen* g) { } } else if (sym->kind == (v__ast__Kind__array_fixed)) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (v__ast__TypeSymbol_is_builtin(elem_sym)) { string styp = sym->cname; string len = string_after(styp, _SLIT("_")); string fixed = v__gen__c__Gen_typ(g, info.elem_type); - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed = strings__Builder_cut_to(&g->out, pos); @@ -69323,10 +71717,10 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast parent_styp = string_substr(parent->cname, 3, (parent->cname).len); } } else { - if ((sym.info)._typ == 435 /* v.ast.Alias */) { + if ((sym.info)._typ == 436 /* v.ast.Alias */) { parent_styp = v__gen__c__Gen_typ(g, (*sym.info._v__ast__Alias).parent_type); v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym.info._v__ast__Alias).parent_type); - if ((parent_sym->info)._typ == 443 /* v.ast.ArrayFixed */) { + if ((parent_sym->info)._typ == 444 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*parent_sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym)) { is_fixed_array_of_non_builtin = true; @@ -69350,10 +71744,10 @@ void v__gen__c__Gen_write_interface_typedef(v__gen__c__Gen* g, v__ast__TypeSymbo } void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - if ((sym.info)._typ != 438 /* v.ast.Interface */) { + if ((sym.info)._typ != 439 /* v.ast.Interface */) { return; } - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (info.is_generic) { return; } @@ -69382,7 +71776,7 @@ void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v_ } void v__gen__c__Gen_write_fn_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; v__ast__Fn func = info.func; bool is_fn_sig = (func.name).len == 0; bool not_anon = !info.is_anon; @@ -69896,7 +72290,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } else if (node._typ == 319 /* v.ast.InterfaceDecl */) { v__ast__TypeSymbol* ts = v__ast__Table_sym(g->table, (*node._v__ast__InterfaceDecl).typ); - if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).is_generic) { + if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ).is_generic) { for (int _t4 = 0; _t4 < (*node._v__ast__InterfaceDecl).methods.len; ++_t4) { v__ast__FnDecl method = ((v__ast__FnDecl*)(*node._v__ast__InterfaceDecl).methods.data)[_t4]; if (v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__optional)) { @@ -70014,18 +72408,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, strings__Builder_writeln(&sb, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT("_ptr = memdup("), /*115 &string*/0xfe10, {.d_s = accessor}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } strings__Builder_write_string(&sb, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = exp_cname}}, {_SLIT("){ ._"), /*115 &string*/0xfe10, {.d_s = got_cname}}, {_SLIT(" = ptr, ._typ = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_sidx(g, got)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).fields.len; ++_t3) { - v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).fields.data)[_t3]; + for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ).fields.len; ++_t3) { + v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ).fields.data)[_t3]; string ptr = _SLIT("ptr"); string type_cname = got_cname; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_66722 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66722.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_66950 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_66950.arg1; if (embed_types.len > 0) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); ptr = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT("_ptr"), 0, { .d_c = 0 }}})); @@ -70078,7 +72472,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_expr(g, expr); return; } - if ((exp_sym->info)._typ == 438 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { + if ((exp_sym->info)._typ == 439 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { if ((expr)._typ == 295 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { g->inside_cast_in_heap++; string got_styp = v__gen__c__Gen_cc_type(g, v__ast__Type_ref(got_type), true); @@ -70137,7 +72531,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex g->prevent_sum_type_unwrapping_once = true; v__gen__c__Gen_expr(g, expr); } else { - if ((unwrapped_got_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((unwrapped_got_sym->info)._typ == 434 /* v.ast.Aggregate */) { unwrapped_got_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*unwrapped_got_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); unwrapped_got_sym = v__ast__Table_sym(g->table, unwrapped_got_type); } @@ -70642,6 +73036,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_scope_vars2(v__gen__c__Gen* g, v__a } VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_variable(v__gen__c__Gen* g, v__ast__Var v) { + if (v.typ == 0) { + return; + } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v.typ); if (g->is_autofree) { } @@ -70867,7 +73264,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("*)__dup"), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("(&("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("){.mtx = {0}, .val ="), 0, { .d_c = 0 }}}))); } } - int last_stmt_pos = (*(int*)array_last(g->stmt_path_pos)); + int _t1; /* if prepend */ + if (g->stmt_path_pos.len > 0) { + _t1 = (*(int*)array_last(g->stmt_path_pos)); + } else { + _t1 = 0; + } + int last_stmt_pos = _t1; v__gen__c__Gen_call_expr(g, (*node._v__ast__CallExpr)); if (g->is_autofree && !g->is_builtin_mod && !g->is_js_call && g->strs_to_free0.len == 0 && !g->inside_lambda) { v__gen__c__Gen_autofree_call_pregen(g, (*node._v__ast__CallExpr)); @@ -71034,18 +73437,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) if ((*node._v__ast__PrefixExpr).op == v__token__Kind__arrow) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__PrefixExpr).right_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, (*node._v__ast__PrefixExpr).right_type); - v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ; + v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.Chan */ ; v__ast__Type elem_type = right_inf.elem_type; bool is_gen_or_and_assign_rhs = gen_or && !g->discard_or_result; - string _t1; /* if prepend */ + string _t2; /* if prepend */ if (is_gen_or_and_assign_rhs) { string line = v__gen__c__Gen_go_before_stmt(g, 0); strings__Builder_write_string(&g->out, v__util__tabs(g->indent)); - _t1 = line; + _t2 = line; } else { - _t1 = _SLIT(""); + _t2 = _SLIT(""); } - string cur_line = _t1; + string cur_line = _t2; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { string opt_elem_type = v__gen__c__Gen_typ(g, v__ast__Type_set_flag(elem_type, v__ast__TypeFlag__optional)); @@ -71146,9 +73549,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_type_name(v__gen__c__Gen* g, v__ast__Type ra string s = _SLIT(""); if (sym->kind == v__ast__Kind__function) { if (v__ast__Type_is_ptr(typ)) { - s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ )); + s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ )); } else { - s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ); + s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ); } } else { s = v__ast__Table_type_to_str(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); @@ -71164,11 +73567,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_typeof_expr(v__gen__c__Gen* g, v__ast__TypeO v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")._typ ))")); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; string typ_name = v__ast__Table_get_type_name(g->table, fixed_info.elem_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_SLIT(\"["), /*100 &int*/0xfe07, {.d_i32 = fixed_info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = v__util__strip_main_name(typ_name)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_SLIT(\""), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_fn_decl_str(g, info)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* varg_elem_type_sym = v__ast__Table_sym(g->table, v__ast__Table_value_type(g->table, typ)); @@ -71246,7 +73649,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_error(g, _SLIT("field_name should be `len`"), node.pos); VUNREACHABLE(); } - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { @@ -71282,7 +73685,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel string dot = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("->")) : (_SLIT("."))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")"), /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = agg_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -71295,7 +73698,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel } else if (_t4 = v__ast__Table_find_method(g->table, sym, node.field_name), _t4.state == 0) { v__ast__Fn m = *(v__ast__Fn*)_t4.data; bool has_embeds = false; - if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 434 /* v.ast.Aggregate */) { if (node.from_embed_types.len > 0) { has_embeds = true; } @@ -71319,7 +73722,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel strings__Builder_write_string(&sb, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, param.typ)}}, {_SLIT(" a"), /*100 &int literal*/0xfe07, {.d_i32 = i}}, {_SLIT0, 0, { .d_c = 0 }}}))); } strings__Builder_writeln(&sb, _SLIT(") {")); - strings__Builder_writeln(&sb, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("* a0 = *("), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("**)(__RETURN_ADDRESS() - __CLOSURE_DATA_OFFSET);"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("* a0 = __CLOSURE_GET_DATA();"), 0, { .d_c = 0 }}}))); if (!v__ast__Type_alias_eq(m.return_type, _const_v__ast__void_type)) { strings__Builder_write_string(&sb, _SLIT("\treturn ")); } else { @@ -71366,7 +73769,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel if (is_optional) { v__gen__c__Gen_write(g, _SLIT(".data)")); } - if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 434 /* v.ast.Aggregate */) { for (int i = 0; i < node.from_embed_types.len; ++i) { v__ast__Type embed = ((v__ast__Type*)node.from_embed_types.data)[i]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); @@ -71556,11 +73959,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit string value_typ_str = v__gen__c__Gen_typ(g, unwrap_val_typ); v__ast__TypeSymbol* value_sym = v__ast__Table_sym(g->table, unwrap_val_typ); v__ast__TypeSymbol* key_sym = v__ast__Table_final_sym(g->table, unwrap_key_typ); - multi_return_string_string_string_string mr_108350 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108350.arg0; - string key_eq_fn = mr_108350.arg1; - string clone_fn = mr_108350.arg2; - string free_fn = mr_108350.arg3; + multi_return_string_string_string_string mr_108643 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_108643.arg0; + string key_eq_fn = mr_108643.arg1; + string clone_fn = mr_108643.arg2; + string free_fn = mr_108643.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -71842,7 +74245,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } } string dot = (is_ptr || is_auto_heap ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -71921,7 +74324,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp if ((g->pref->translated || g->file->is_translated) && sym->kind == v__ast__Kind__function) { } string cast_label = _SLIT(""); - if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { + if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { cast_label = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(")"), 0, { .d_c = 0 }}})); } if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 282 /* v.ast.None */) { @@ -72130,7 +74533,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, g->fn_decl->return_type); - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; string styp = _SLIT(""); if (fn_return_is_optional || fn_return_is_result) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -72569,6 +74972,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, str VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__GlobalDecl node) { string visibility_kw = ((g->pref->use_cache || (g->pref->build_mode == v__pref__BuildMode__build_module && !string__eq(g->module_built, node.mod))) && !v__util__should_bundle_module(node.mod) ? (_SLIT("extern ")) : (_SLIT(""))); bool cinit = Array_v__ast__Attr_contains(node.attrs, _SLIT("cinit")); + bool cextern = Array_v__ast__Attr_contains(node.attrs, _SLIT("c_extern")); bool should_init = (!g->pref->use_cache && g->pref->build_mode != v__pref__BuildMode__build_module) || (g->pref->build_mode == v__pref__BuildMode__build_module && string__eq(g->module_built, node.mod)); string attributes = _SLIT(""); if (Array_v__ast__Attr_contains(node.attrs, _SLIT("weak"))) { @@ -72594,8 +74998,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_type_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_sym(g->table, field.typ)->name}}, {_SLIT("; // global2"), 0, { .d_c = 0 }}}))); continue; } + string _v_extern = (cextern ? (_SLIT("extern ")) : (_SLIT(""))); string modifier = (field.is_volatile ? (_SLIT(" volatile ")) : (_SLIT(""))); - strings__Builder_write_string(&g->definitions, str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = visibility_kw}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = modifier}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = attributes}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + strings__Builder_write_string(&g->definitions, str_intp(7, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _v_extern}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = visibility_kw}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = modifier}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = attributes}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + if (cextern) { + strings__Builder_writeln(&g->definitions, _SLIT("; // global5")); + continue; + } if (field.has_expr || cinit) { if (g->pref->translated) { strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -72688,7 +75097,7 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; } int fn_vinit_start_pos = g->out.len; v__gen__c__Gen_writeln(g, _SLIT("void _vinit(int ___argc, voidptr ___argv) {")); - if (!Array_string_contains(g->pref->compile_defines, _SLIT("no_segfault_handler")) || g->pref->os == v__pref__OS__wasm32) { + if (g->use_segfault_handler) { v__gen__c__Gen_writeln(g, _SLIT("#if __STDC_HOSTED__ == 1\n\tsignal(11, v_segmentation_fault_handler);\n#endif")); } if (g->pref->is_bare) { @@ -72842,9 +75251,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ for (int _t3 = 0; _t3 < (*sym->info._v__ast__Struct).fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data)[_t3]; if (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__optional)) { - multi_return_string_string mr_148577 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_148577.arg0; - string base = mr_148577.arg1; + multi_return_string_string mr_148992 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_148992.arg0; + string base = mr_148992.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -72867,7 +75276,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ size_suffix = _SLIT(" : 1"); } else { v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); - if ((field_sym->info)._typ == 449 /* v.ast.Enum */) { + if ((field_sym->info)._typ == 450 /* v.ast.Enum */) { if (!(*field_sym->info._v__ast__Enum).is_flag && !(*field_sym->info._v__ast__Enum).uses_exprs) { int bits_needed = 0; int l = (*field_sym->info._v__ast__Enum).vals.len; @@ -72890,9 +75299,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}"), /*115 &string*/0xfe10, {.d_s = ti_attrs}}, {_SLIT(";\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->type_definitions, post_pragma); } - else if (sym->info._typ == 435 /* v.ast.Alias */) { + else if (sym->info._typ == 436 /* v.ast.Alias */) { } - else if (sym->info._typ == 445 /* v.ast.Thread */) { + else if (sym->info._typ == 446 /* v.ast.Thread */) { if (g->pref->os == v__pref__OS__windows) { if (string__eq(name, _SLIT("__v_thread"))) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef HANDLE "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -72908,7 +75317,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { continue; } @@ -72938,7 +75347,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, _SLIT("};")); strings__Builder_writeln(&g->type_definitions, _SLIT("")); } - else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 444 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym) && !v__ast__Type_has_flag((*sym->info._v__ast__ArrayFixed).elem_type, v__ast__TypeFlag__generic)) { string styp = sym->cname; @@ -72950,7 +75359,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ if (string_starts_with(fixed_elem_name, _SLIT("C__"))) { fixed_elem_name = string_substr(fixed_elem_name, 3, (fixed_elem_name).len); } - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed_elem_name = strings__Builder_cut_to(&g->out, pos); @@ -72986,8 +75395,8 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } Array_string field_deps = __new_array_with_default(0, 0, sizeof(string), 0); - if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { - string dep = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; + if (sym->info._typ == 444 /* v.ast.ArrayFixed */) { + string dep = v__ast__Table_final_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; if (Array_string_contains(type_names, dep)) { array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); } @@ -73012,7 +75421,7 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); - if ((fsym->info)._typ == 435 /* v.ast.Alias */) { + if ((fsym->info)._typ == 436 /* v.ast.Alias */) { string xdep = v__ast__Table_sym(g->table, (*fsym->info._v__ast__Alias).parent_type)->name; if (!Array_string_contains(type_names, xdep) || Array_string_contains(field_deps, xdep)) { continue; @@ -73139,11 +75548,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_158435 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158435.arg0; - string pafile = mr_158435.arg1; - string pamod = mr_158435.arg2; - string pafn = mr_158435.arg3; + multi_return_int_string_string_string mr_158856 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_158856.arg0; + string pafile = mr_158856.arg1; + string pamod = mr_158856.arg2; + string pafn = mr_158856.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_result_not_set("), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); @@ -73166,11 +75575,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_159705 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_159705.arg0; - string pafile = mr_159705.arg1; - string pamod = mr_159705.arg2; - string pafn = mr_159705.arg3; + multi_return_int_string_string_string mr_160126 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_160126.arg0; + string pafile = mr_160126.arg1; + string pamod = mr_160126.arg2; + string pafn = mr_160126.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_optional_not_set( "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); @@ -73243,7 +75652,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } case v__ast__Kind__alias: { - string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); return _t6; break; } @@ -73280,11 +75689,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { v__ast__Map info = v__ast__TypeSymbol_map_info(sym); v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type); - multi_return_string_string_string_string mr_162313 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162313.arg0; - string key_eq_fn = mr_162313.arg1; - string clone_fn = mr_162313.arg2; - string free_fn = mr_162313.arg3; + multi_return_string_string_string_string mr_162734 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_162734.arg0; + string key_eq_fn = mr_162734.arg1; + string clone_fn = mr_162734.arg2; + string free_fn = mr_162734.arg3; string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type); string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type); string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT(""))); @@ -73475,7 +75884,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no string styp = v__gen__c__Gen_typ(g, unwrapped_node_typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped_node_typ); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - if ((expr_type_sym->info)._typ == 439 /* v.ast.SumType */) { + if ((expr_type_sym->info)._typ == 440 /* v.ast.SumType */) { string dot = (v__ast__Type_is_ptr(node.expr_type) ? (_SLIT("->")) : (_SLIT("."))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* as */ *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)__as_cast("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT("(")); @@ -73505,7 +75914,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no } v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (!_IN_MAP(ADDR(int, node.typ), ADDR(map, info.conversions))) { Array_v__ast__Type left_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){expr_type_sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); Array_v__ast__Type right_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); @@ -73576,10 +75985,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 438 /* v.ast.Interface */) { + if ((isym->info)._typ != 439 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -73647,19 +76056,22 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { _option_v__ast__StructField _t4; if (_t4 = v__ast__TypeSymbol_find_field(st_sym, field.name), _t4.state == 0) { strings__Builder_writeln(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")),"), 0, { .d_c = 0 }}}))); + } else if (st_sym->kind == v__ast__Kind__array && (string__eq(field.name, _SLIT("element_size")) || string__eq(field.name, _SLIT("data")) || string__eq(field.name, _SLIT("offset")) || string__eq(field.name, _SLIT("len")) || string__eq(field.name, _SLIT("cap")) || string__eq(field.name, _SLIT("flags")))) { + strings__Builder_writeln(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")),"), 0, { .d_c = 0 }}}))); } else { - IError err = _t4.err; strings__Builder_write_string(&cast_struct, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x"), 0, { .d_c = 0 }}}))); if (v__ast__Type_alias_eq(st, _const_v__ast__voidptr_type)) { strings__Builder_write_string(&cast_struct, _SLIT("/*.... ast.voidptr_type */")); } else { - for (int _t5 = 0; _t5 < v__ast__TypeSymbol_struct_info(st_sym).embeds.len; ++_t5) { - v__ast__Type embed_type = ((v__ast__Type*)v__ast__TypeSymbol_struct_info(st_sym).embeds.data)[_t5]; - v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed_type); - _option_v__ast__StructField _t6; - if (_t6 = v__ast__TypeSymbol_find_field(embed_sym, field.name), _t6.state == 0) { - strings__Builder_write_string(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT(" + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT(") + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); - break; + if (st_sym->kind == v__ast__Kind__struct_) { + for (int _t5 = 0; _t5 < v__ast__TypeSymbol_struct_info(st_sym).embeds.len; ++_t5) { + v__ast__Type embed_type = ((v__ast__Type*)v__ast__TypeSymbol_struct_info(st_sym).embeds.data)[_t5]; + v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed_type); + _option_v__ast__StructField _t6; + if (_t6 = v__ast__TypeSymbol_find_field(embed_sym, field.name), _t6.state == 0) { + strings__Builder_write_string(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT(" + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT(") + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); + break; + } } } } @@ -73732,7 +76144,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 438 /* v.ast.Interface */) { + else if (st_sym->info._typ == 439 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Interface).parent_type); for (int _t15 = 0; _t15 < parent_sym->methods.len; ++_t15) { @@ -73749,7 +76161,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 439 /* v.ast.SumType */) { + else if (st_sym->info._typ == 440 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__SumType).parent_type); for (int _t18 = 0; _t18 < parent_sym->methods.len; ++_t18) { @@ -73795,10 +76207,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (parent_sym->info._typ == 420 /* v.ast.Struct */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Struct).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 439 /* v.ast.Interface */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Interface).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 440 /* v.ast.SumType */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__SumType).concrete_types, method.name, false); } @@ -73823,8 +76235,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,.typ = v__ast__Type_set_nr_muls(st, 1),(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,}) }); - multi_return_Array_string_Array_string_Array_bool mr_176920 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_176920.arg0; + multi_return_Array_string_Array_string_Array_bool mr_177692 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_177692.arg0; string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos); if (v__ast__Type_is_ptr(st)) { parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__")); @@ -73841,8 +76253,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_177384 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_177384.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_178156 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_178156.arg1; if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -74027,7 +76439,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; bool _t5 = v__gen__c__Gen_contains_ptr(g, info.elem_type); return _t5; break; @@ -74055,7 +76467,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__aggregate: { - v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; + v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ; for (int _t11 = 0; _t11 < info.types.len; ++_t11) { v__ast__Type atyp = ((v__ast__Type*)info.types.data)[_t11]; if (v__gen__c__Gen_contains_ptr(g, atyp)) { @@ -74069,7 +76481,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__multi_return: { - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; for (int _t14 = 0; _t14 < info.types.len; ++_t14) { v__ast__Type mrtyp = ((v__ast__Type*)info.types.data)[_t14]; if (v__gen__c__Gen_contains_ptr(g, mrtyp)) { @@ -74129,7 +76541,7 @@ VV_LOCAL_SYMBOL string v__gen__c__c_closure_helpers(v__pref__Preferences* pref) if (pref->os != v__pref__OS__windows) { strings__Builder_writeln(&builder, _SLIT("#include ")); } - strings__Builder_write_string(&builder, _SLIT("\n#ifdef _MSC_VER\n\011#define __RETURN_ADDRESS() ((char*)_ReturnAddress())\n#elif defined(__TINYC__) && defined(_WIN32)\n\011#define __RETURN_ADDRESS() ((char*)__builtin_return_address(0))\n#else\n\011#define __RETURN_ADDRESS() ((char*)__builtin_extract_return_addr(__builtin_return_address(0)))\n#endif\n\n#define ASSUMED_PAGE_SIZE 0x4000 // 16K\n#define _CLOSURE_SIZE (((3*sizeof(void*) > sizeof(__closure_thunk) ? 3*sizeof(void*) : sizeof(__closure_thunk)) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))\n// equal to `max(3*sizeof(void*), sizeof(__closure_thunk))`, rounded up to the next multiple of `sizeof(void*)`\n\n// refer to https://godbolt.org/z/r7P3EYv6c for a complete assembly\n#ifdef __V_amd64\nstatic const char __closure_thunk[] = {\n\0110x8f, 0x05, 0x0a, 0xc0, 0xff, 0xff, // pop QWORD PTR [rip - return_addr]\n\0110xff, 0x15, 0xfc, 0xbf, 0xff, 0xff, // call QWORD PTR [rip - fn]\n\0110xff, 0x25, 0xfe, 0xbf, 0xff, 0xff // jmp QWORD PTR [rip - return_addr]\n};\n#define __CLOSURE_DATA_OFFSET 0x400C\n#elif defined(__V_x86)\nstatic char __closure_thunk[] = {\n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call 4\n\0110x59, // pop ecx\n\0110x8f, 0x81, 0x03, 0xc0, 0xff, 0xff, // pop DWORD PTR [ecx - 0x3ffd] # \n\0110xff, 0x91, 0xff, 0xbf, 0xff, 0xff, // call DWORD PTR [ecx - 0x4001] # \n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call 4\n\0110x59, // pop ecx\n\0110xff, 0xa1, 0xf1, 0xbf, 0xff, 0xff // jmp DWORD PTR [ecx - 0x400f] # \n};\n#define __CLOSURE_DATA_OFFSET 0x4012\n#elif defined(__V_arm64)\nstatic char __closure_thunk[] = {\n\0110x90, 0x00, 0xfe, 0x10, // adr x16, return_addr\n\0110x1e, 0x02, 0x00, 0xf9, // str x30, [x16]\n\0110x10, 0x00, 0xfe, 0x58, // ldr x16, fn\n\0110x00, 0x02, 0x3f, 0xd6, // blr x16\n\0110x1e, 0x00, 0xfe, 0x58, // ldr x30, return_addr\n\0110xc0, 0x03, 0x5f, 0xd6 // ret\n};\n#define __CLOSURE_DATA_OFFSET 0x4010\n#elif defined(__V_arm32)\n// arm32 needs a small page size because its pc-relative addressing range is just \302\2614095 bytes\n#undef ASSUMED_PAGE_SIZE\n#define ASSUMED_PAGE_SIZE 4080\n#undef _CLOSURE_SIZE\n#define _CLOSURE_SIZE 28\nstatic char __closure_thunk[] = {\n\0110xf0, 0xef, 0x0f, 0xe5, // str lr, return_addr\n\0110xf8, 0xcf, 0x1f, 0xe5, // ldr ip, fn\n\0110x3c, 0xff, 0x2f, 0xe1, // blx ip\n\0110xfc, 0xef, 0x1f, 0xe5, // ldr lr, return_addr\n\0110x1e, 0xff, 0x2f, 0xe1 // bx lr\n};\n#define __CLOSURE_DATA_OFFSET 0xFFC\n#endif\n\nstatic inline void __closure_set_data(char* closure, void* data) {\n void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n p[0] = data;\n}\n\nstatic inline void __closure_set_function(char* closure, void* f) {\n void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n p[1] = f;\n}\n\n#ifdef _WIN32\n#include \nstatic SRWLOCK _closure_mtx;\n#define _closure_mtx_init() InitializeSRWLock(&_closure_mtx)\n#define _closure_mtx_lock() AcquireSRWLockExclusive(&_closure_mtx)\n#define _closure_mtx_unlock() ReleaseSRWLockExclusive(&_closure_mtx)\n#else\nstatic pthread_mutex_t _closure_mtx;\n#define _closure_mtx_init() pthread_mutex_init(&_closure_mtx, 0)\n#define _closure_mtx_lock() pthread_mutex_lock(&_closure_mtx)\n#define _closure_mtx_unlock() pthread_mutex_unlock(&_closure_mtx)\n#endif\nstatic char* _closure_ptr = 0;\nstatic int _closure_cap = 0;\n\nstatic void* __closure_create(void* fn, void* data) {\n\011_closure_mtx_lock();\n\011if (_closure_cap == 0) {\n#ifdef _WIN32\n\011\011SYSTEM_INFO si;\n\011\011GetNativeSystemInfo(&si);\n\011\011uint32_t page_size = si.dwPageSize;\n\011\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011\011char* p = VirtualAlloc(NULL, page_size * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);\n\011\011if (p == NULL) return 0;\n#else\n\011\011uint32_t page_size = sysconf(_SC_PAGESIZE);\n\011\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011\011int prot = PROT_READ | PROT_WRITE;\n\011\011int flags = MAP_ANONYMOUS | MAP_PRIVATE;\n\011\011char* p = mmap(0, page_size * 2, prot, flags, -1, 0);\n\011\011if (p == MAP_FAILED) return 0;\n#endif\n\011\011char* x = p + page_size;\n\011\011int remaining = page_size / _CLOSURE_SIZE;\n\011\011_closure_ptr = x;\n\011\011_closure_cap = remaining;\n\011\011while (remaining > 0) {\n\011\011\011memcpy(x, __closure_thunk, sizeof(__closure_thunk));\n\011\011\011remaining--;\n\011\011\011x += _CLOSURE_SIZE;\n\011\011}\n#ifdef _WIN32\n\011\011DWORD _tmp;\n\011\011VirtualProtect(_closure_ptr, page_size, PAGE_EXECUTE_READ, &_tmp);\n#else\n\011\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_EXEC);\n#endif\n\011}\n\011_closure_cap--;\n\011void* closure = _closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011__closure_set_data(closure, data);\n\011__closure_set_function(closure, fn);\n\011_closure_mtx_unlock();\n\011return closure;\n}\n\nstatic void __closure_destroy(void *closure) {\n#ifdef _WIN32\n\011SYSTEM_INFO si;\n\011GetNativeSystemInfo(&si);\n\011uint32_t page_size = si.dwPageSize;\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011VirtualFree(closure, page_size * 2, MEM_RELEASE);\n#else\n long page_size = sysconf(_SC_PAGESIZE);\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n munmap((char*)closure - page_size, page_size * 2);\n#endif\n}\n")); + strings__Builder_write_string(&builder, _SLIT("\n#ifdef _MSC_VER\n\011#define __RETURN_ADDRESS() ((char*)_ReturnAddress())\n#elif defined(__TINYC__) && defined(_WIN32)\n\011#define __RETURN_ADDRESS() ((char*)__builtin_return_address(0))\n#else\n\011#define __RETURN_ADDRESS() ((char*)__builtin_extract_return_addr(__builtin_return_address(0)))\n#endif\n\nstatic int _V_page_size = 0x4000; // 16K\n#define ASSUMED_PAGE_SIZE 0x4000\n#define _CLOSURE_SIZE (((2*sizeof(void*) > sizeof(__closure_thunk) ? 2*sizeof(void*) : sizeof(__closure_thunk)) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))\n// equal to `max(2*sizeof(void*), sizeof(__closure_thunk))`, rounded up to the next multiple of `sizeof(void*)`\n\n// refer to https://godbolt.org/z/r7P3EYv6c for a complete assembly\n#ifdef __V_amd64\nstatic const char __closure_thunk[] = {\n\0110xF3, 0x44, 0x0F, 0x7E, 0x3D, 0xF7, 0xBF, 0xFF, 0xFF, // movq xmm15, QWORD PTR [rip - userdata]\n\0110xFF, 0x25, 0xF9, 0xBF, 0xFF, 0xFF // jmp QWORD PTR [rip - fn]\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x66, 0x4C, 0x0F, 0x7E, 0xF8, // movq rax, xmm15\n\0110xC3 // ret\n};\n#define __CLOSURE_DATA_OFFSET 0x400C\n#elif defined(__V_x86)\nstatic char __closure_thunk[] = {\n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call here\n\011 // here:\n\0110x59, // pop ecx\n\0110x66, 0x0F, 0x6E, 0xF9, // movd xmm7, ecx\n\0110xff, 0xA1, 0xff, 0xbf, 0xff, 0xff, // jmp DWORD PTR [ecx - 0x4001] # \n};\n\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x66, 0x0F, 0x7E, 0xF8, // movd eax, xmm7\n\0110x8B, 0x80, 0xFB, 0xBF, 0xFF, 0xFF, // mov eax, DWORD PTR [eax - 0x4005]\n\0110xc3 // ret\n};\n\n#define __CLOSURE_DATA_OFFSET 0x4012\n#elif defined(__V_arm64)\nstatic char __closure_thunk[] = {\n\0110x11, 0x00, 0xFE, 0x58, // ldr x17, userdata\n\0110x30, 0x00, 0xFE, 0x58, // ldr x16, fn\n\0110x00, 0x02, 0x1F, 0xD6 // br x16\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110xE0, 0x03, 0x11, 0xAA, // mov x0, x17\n\0110xC0, 0x03, 0x5F, 0xD6 // ret\n};\n#elif defined(__V_arm32)\nstatic char __closure_thunk[] = {\n\0110x04, 0xC0, 0x4F, 0xE2, // adr ip, here\n // here:\n\0110x01, 0xC9, 0x4C, 0xE2, // sub ip, ip, #4000\n\0110x90, 0xCA, 0x07, 0xEE, // vmov s15, ip\n\0110x00, 0xC0, 0x9C, 0xE5, // ldr ip, [ip, 0]\n\0110x1C, 0xFF, 0x2F, 0xE1 // bx ip\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x90, 0x0A, 0x17, 0xEE,\n\0110x04, 0x00, 0x10, 0xE5,\n\0110x1E, 0xFF, 0x2F, 0xE1\n};\n#define __CLOSURE_DATA_OFFSET 0xFFC\n#endif\n\nstatic void*(*__CLOSURE_GET_DATA)(void) = 0;\n\nstatic inline void __closure_set_data(char* closure, void* data) {\n\011void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n\011p[0] = data;\n}\n\nstatic inline void __closure_set_function(char* closure, void* f) {\n\011void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n\011p[1] = f;\n}\n\n#ifdef _WIN32\n#include \nstatic SRWLOCK _closure_mtx;\n#define _closure_mtx_init() InitializeSRWLock(&_closure_mtx)\n#define _closure_mtx_lock() AcquireSRWLockExclusive(&_closure_mtx)\n#define _closure_mtx_unlock() ReleaseSRWLockExclusive(&_closure_mtx)\n#else\nstatic pthread_mutex_t _closure_mtx;\n#define _closure_mtx_init() pthread_mutex_init(&_closure_mtx, 0)\n#define _closure_mtx_lock() pthread_mutex_lock(&_closure_mtx)\n#define _closure_mtx_unlock() pthread_mutex_unlock(&_closure_mtx)\n#endif\nstatic char* _closure_ptr = 0;\nstatic int _closure_cap = 0;\n\nstatic void __closure_alloc(void) {\n#ifdef _WIN32\n\011char* p = VirtualAlloc(NULL, _V_page_size * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);\n\011if (p == NULL) return;\n#else\n\011char* p = mmap(0, _V_page_size * 2, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);\n\011if (p == MAP_FAILED) return;\n#endif\n\011char* x = p + _V_page_size;\n\011int remaining = _V_page_size / _CLOSURE_SIZE;\n\011_closure_ptr = x;\n\011_closure_cap = remaining;\n\011while (remaining > 0) {\n\011\011memcpy(x, __closure_thunk, sizeof(__closure_thunk));\n\011\011remaining--;\n\011\011x += _CLOSURE_SIZE;\n\011}\n#ifdef _WIN32\n\011DWORD _tmp;\n\011VirtualProtect(_closure_ptr, _V_page_size, PAGE_EXECUTE_READ, &_tmp);\n#else\n\011mprotect(_closure_ptr, _V_page_size, PROT_READ | PROT_EXEC);\n#endif\n}\n\n#ifdef _WIN32\nvoid __closure_init() {\n\011SYSTEM_INFO si;\n\011GetNativeSystemInfo(&si);\n\011uint32_t page_size = si.dwPageSize * (((ASSUMED_PAGE_SIZE - 1) / si.dwPageSize) + 1);\n\011_V_page_size = page_size;\n\011__closure_alloc();\n\011DWORD _tmp;\n\011VirtualProtect(_closure_ptr, page_size, PAGE_READWRITE, &_tmp);\n\011memcpy(_closure_ptr, __CLOSURE_GET_DATA_BYTES, sizeof(__CLOSURE_GET_DATA_BYTES));\n\011VirtualProtect(_closure_ptr, page_size, PAGE_EXECUTE_READ, &_tmp);\n\011__CLOSURE_GET_DATA = (void*)_closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011_closure_cap--;\n}\n#else\nvoid __closure_init() {\n\011uint32_t page_size = sysconf(_SC_PAGESIZE);\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011_V_page_size = page_size;\n\011__closure_alloc();\n\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_WRITE);\n\011memcpy(_closure_ptr, __CLOSURE_GET_DATA_BYTES, sizeof(__CLOSURE_GET_DATA_BYTES));\n\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_EXEC);\n\011__CLOSURE_GET_DATA = (void*)_closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011_closure_cap--;\n}\n#endif\n\nstatic void* __closure_create(void* fn, void* data) {\n\011_closure_mtx_lock();\n\011if (_closure_cap == 0) {\n\011\011__closure_alloc();\n\011}\n\011_closure_cap--;\n\011void* closure = _closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011__closure_set_data(closure, data);\n\011__closure_set_function(closure, fn);\n\011_closure_mtx_unlock();\n\011return closure;\n}\n")); string _t1 = strings__Builder_str(&builder); return _t1; } @@ -74173,7 +76585,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_vlines_reset(v__gen__c__Gen* g) { } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_only_header(v__gen__c__Gen* g) { + if ((g->pref->cmain).len != 0) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("int "), /*115 &string*/0xfe10, {.d_s = g->pref->cmain}}, {_SLIT("(int ___argc, char** ___argv){"), 0, { .d_c = 0 }}}))); + return; + } if (g->pref->os == v__pref__OS__windows) { if (v__gen__c__Gen_is_gui_app(g)) { #if defined(_MSC_VER) @@ -74188,14 +76604,21 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g v__gen__c__Gen_writeln(g, _SLIT("\tcmd_line_to_argv CommandLineToArgvW = (cmd_line_to_argv)GetProcAddress(shell32_module, \"CommandLineToArgvW\");")); v__gen__c__Gen_writeln(g, _SLIT("\tint ___argc;")); v__gen__c__Gen_writeln(g, _SLIT("\twchar_t** ___argv = CommandLineToArgvW(full_cmd_line, &___argc);")); - } else { - v__gen__c__Gen_writeln(g, _SLIT("int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){")); + return; } - } else { - v__gen__c__Gen_writeln(g, _SLIT("int main(int ___argc, char** ___argv){")); + v__gen__c__Gen_writeln(g, _SLIT("int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){")); + return; } + v__gen__c__Gen_writeln(g, _SLIT("int main(int ___argc, char** ___argv){")); +} + +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g) { + v__gen__c__Gen_gen_c_main_function_only_header(g); v__gen__c__Gen_writeln(g, _SLIT("\tg_main_argc = ___argc;")); v__gen__c__Gen_writeln(g, _SLIT("\tg_main_argv = ___argv;")); + if (g->nr_closures > 0) { + v__gen__c__Gen_writeln(g, _SLIT("__closure_init();")); + } } VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { @@ -74244,22 +76667,22 @@ void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g) { } void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name) { - multi_return_int_string_string_string mr_4758 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_4758.arg0; - string pafile = mr_4758.arg1; - string pamod = mr_4758.arg2; - string pafn = mr_4758.arg3; + multi_return_int_string_string_string mr_5006 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_5006.arg0; + string pafile = mr_5006.arg1; + string pamod = mr_5006.arg2; + string pafn = mr_5006.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name) { - multi_return_int_string_string_string mr_5449 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); - int paline = mr_5449.arg0; - string pafile = mr_5449.arg1; - string pamod = mr_5449.arg2; - string pafn = mr_5449.arg3; + multi_return_int_string_string_string mr_5697 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5697.arg0; + string pafile = mr_5697.arg1; + string pamod = mr_5697.arg2; + string pafn = mr_5697.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); @@ -74742,7 +77165,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 296) /*expected idx: 296, name: v.ast.TypeNode */ ).typ; if ((left)._typ == 296 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { v__ast__TypeSymbol* interface_sym = v__ast__Table_sym(g->table, got_type); - if ((interface_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((interface_sym->info)._typ == 439 /* v.ast.Interface */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_does_type_implement_interface(g->table, checked_type, got_type); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -75274,7 +77697,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { string ptr_asterisk = (is_ptr ? (_SLIT("*")) : (_SLIT(""))); string str_dumparg_type = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = ptr_asterisk}}, {_SLIT0, 0, { .d_c = 0 }}})); if (dump_sym->kind == v__ast__Kind__function) { - v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; str_dumparg_type = str_intp(2, _MOV((StrIntpData[]){{_SLIT("DumpFNType_"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, 0, { .d_c = 0 }}})); int tdef_pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &fninfo, str_dumparg_type); @@ -75342,22 +77765,31 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_writeln_fn_header(v__gen__c__Gen* g, string return _t2; } -VV_LOCAL_SYMBOL bool v__gen__c__Gen_embed_file_is_prod_mode(v__gen__c__Gen* g) { - if (g->pref->is_prod || Array_string_contains(g->pref->compile_defines, _SLIT("debug_embed_file_in_prod"))) { - bool _t1 = true; +VV_LOCAL_SYMBOL bool v__gen__c__Gen_should_really_embed_file(v__gen__c__Gen* g) { + if (Array_string_contains(g->pref->compile_defines, _SLIT("embed_only_metadata"))) { + bool _t1 = false; return _t1; } - bool _t2 = false; + bool _t2 = true; return _t2; } +VV_LOCAL_SYMBOL void v__gen__c__Gen_handle_embedded_files_finish(v__gen__c__Gen* g) { + if (g->embedded_files.len > 0) { + if (v__gen__c__Gen_should_really_embed_file(g)) { + v__gen__c__Gen_gen_embedded_data(g); + } + v__gen__c__Gen_gen_embedded_metadata(g); + } +} + VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embed_file_init(v__gen__c__Gen* g, v__ast__ComptimeCall* node) { #if defined(CUSTOM_DEFINE_trace_embed_file) { eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> gen_embed_file_init "), /*115 &string*/0xfe10, {.d_s = node->embed_file.apath}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { _option_Array_u8 _t1 = os__read_bytes(node->embed_file.apath); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -75441,12 +77873,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g) { u64 ef_idx = v__ast__EmbeddedFile_hash(emfile); strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tcase "), /*117 &u64*/0xfe08, {.d_u64 = ef_idx}}, {_SLIT("U: {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.path = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.rpath)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.apath = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(_SLIT(""))}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.apath = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.apath)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { if (emfile.is_compressed) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.compression_type = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.compression_type)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->embedded_data, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.compressed = v__embed_file__find_index_entry_by_path((voidptr)_v_embed_file_index, "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.rpath)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.compression_type)}}, {_SLIT(")->data;"), 0, { .d_c = 0 }}}))); @@ -75459,7 +77891,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g) { } strings__Builder_writeln(&g->embedded_data, _SLIT("\t\t\tres.free_compressed = 0;")); strings__Builder_writeln(&g->embedded_data, _SLIT("\t\t\tres.free_uncompressed = 0;")); - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.len = "), /*100 &int*/0xfe07, {.d_i32 = emfile.len}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { u64 file_size = os__file_size(emfile.apath); @@ -75839,7 +78271,7 @@ int ctmp; strings__Builder_writeln(&g->definitions, _SLIT(");")); v__gen__c__Gen_writeln(g, _SLIT(") {")); if (is_closure) { - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cur_closure_ctx}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT(" = *(void**)(__RETURN_ADDRESS() - __CLOSURE_DATA_OFFSET);"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cur_closure_ctx}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT(" = __CLOSURE_GET_DATA();"), 0, { .d_c = 0 }}}))); } for (int i = 0; i < heap_promoted.len; ++i) { bool is_promoted = ((bool*)heap_promoted.data)[i]; @@ -76080,34 +78512,34 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_defer_stmts_when_needed(v__gen__c__Gen } VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen_fn_decl_params(v__gen__c__Gen* g, Array_v__ast__Param params, v__ast__Scope* scope, bool is_variadic) { - Array_string fargs = __new_array_with_default(0, 0, sizeof(string), 0); - Array_string fargtypes = __new_array_with_default(0, 0, sizeof(string), 0); + Array_string fparams = __new_array_with_default(0, 0, sizeof(string), 0); + Array_string fparamtypes = __new_array_with_default(0, 0, sizeof(string), 0); Array_bool heap_promoted = __new_array_with_default(0, 0, sizeof(bool), 0); if (params.len == 0) { v__gen__c__Gen_write(g, _SLIT("void")); } for (int i = 0; i < params.len; ++i) { - v__ast__Param arg = ((v__ast__Param*)params.data)[i]; - string caname = (string__eq(arg.name, _SLIT("_")) ? (v__gen__c__Gen_new_tmp_declaration_name(g)) : (v__gen__c__c_name(arg.name))); - v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, arg.typ); - v__ast__TypeSymbol* arg_type_sym = v__ast__Table_sym(g->table, typ); - string arg_type_name = v__gen__c__Gen_typ(g, typ); - if (arg_type_sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__Param param = ((v__ast__Param*)params.data)[i]; + string caname = (string__eq(param.name, _SLIT("_")) ? (v__gen__c__Gen_new_tmp_declaration_name(g)) : (v__gen__c__c_name(param.name))); + v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, param.typ); + v__ast__TypeSymbol* param_type_sym = v__ast__Table_sym(g->table, typ); + string param_type_name = v__gen__c__Gen_typ(g, typ); + if (param_type_sym->kind == v__ast__Kind__function) { + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ; v__ast__Fn func = info.func; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); strings__Builder_write_string(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_fn_decl_params(g, func.params, ((voidptr)(0)), func.is_variadic); v__gen__c__Gen_write(g, _SLIT(")")); strings__Builder_write_string(&g->definitions, _SLIT(")")); - array_push((array*)&fargs, _MOV((string[]){ string_clone(caname) })); - array_push((array*)&fargtypes, _MOV((string[]){ string_clone(arg_type_name) })); + array_push((array*)&fparams, _MOV((string[]){ string_clone(caname) })); + array_push((array*)&fparamtypes, _MOV((string[]){ string_clone(param_type_name) })); } else { bool heap_prom = false; if (scope != ((voidptr)(0))) { - if (!string__eq(arg.name, _SLIT("_"))) { + if (!string__eq(param.name, _SLIT("_"))) { _option_v__ast__Var_ptr _t3; - if (_t3 = v__ast__Scope_find_var(scope, arg.name), _t3.state == 0) { + if (_t3 = v__ast__Scope_find_var(scope, param.name), _t3.state == 0) { v__ast__Var* v = *(v__ast__Var**)_t3.data; if (!v->is_stack_obj && v->is_auto_heap) { heap_prom = true; @@ -76116,12 +78548,12 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen } } string var_name_prefix = (heap_prom ? (_SLIT("_v_toheap_")) : (_SLIT(""))); - string const_prefix = (v__ast__Type_is_any_kind_of_pointer(arg.typ) && !arg.is_mut && string_starts_with(arg.name, _SLIT("const_")) ? (_SLIT("const ")) : (_SLIT(""))); - string s = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = const_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arg_type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT0, 0, { .d_c = 0 }}})); + string const_prefix = (v__ast__Type_is_any_kind_of_pointer(param.typ) && !param.is_mut && string_starts_with(param.name, _SLIT("const_")) ? (_SLIT("const ")) : (_SLIT(""))); + string s = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = const_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = param_type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT0, 0, { .d_c = 0 }}})); v__gen__c__Gen_write(g, s); strings__Builder_write_string(&g->definitions, s); - array_push((array*)&fargs, _MOV((string[]){ string_clone(caname) })); - array_push((array*)&fargtypes, _MOV((string[]){ string_clone(arg_type_name) })); + array_push((array*)&fparams, _MOV((string[]){ string_clone(caname) })); + array_push((array*)&fparamtypes, _MOV((string[]){ string_clone(param_type_name) })); array_push((array*)&heap_promoted, _MOV((bool[]){ heap_prom })); } if (i < params.len - 1) { @@ -76130,10 +78562,10 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen } } if (g->pref->translated && is_variadic) { - v__gen__c__Gen_write(g, _SLIT(", ...")); - strings__Builder_write_string(&g->definitions, _SLIT(", ...")); + v__gen__c__Gen_write(g, _SLIT(", ... ")); + strings__Builder_write_string(&g->definitions, _SLIT(", ... ")); } - return (multi_return_Array_string_Array_string_Array_bool){.arg0=fargs, .arg1=fargtypes, .arg2=heap_promoted}; + return (multi_return_Array_string_Array_string_Array_bool){.arg0=fparams, .arg1=fparamtypes, .arg2=heap_promoted}; } VV_LOCAL_SYMBOL string v__gen__c__Gen_get_anon_fn_type_name(v__gen__c__Gen* g, v__ast__AnonFn* node, string var_name) { @@ -76283,7 +78715,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 438 /* v.ast.Interface */) { + else if (sym->info._typ == 439 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*sym->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -76302,7 +78734,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 439 /* v.ast.SumType */) { + else if (sym->info._typ == 440 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*sym->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -76328,19 +78760,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); if (typ_sym->kind == v__ast__Kind__alias && !string__eq(node.name, _SLIT("str")) && !v__ast__TypeSymbol_has_method(typ_sym, node.name)) { - unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); } string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), node.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ )), node.name)) { #if defined(CUSTOM_DEFINE_debug_interface_method_call) { eprintln( str_intp(4, _MOV((StrIntpData[]){{_SLIT(">>> interface typ_sym.name: "), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT(" | receiver_type_name: "), /*115 &string*/0xfe10, {.d_s = receiver_type_name}}, {_SLIT(" | pos: "), /*115 &v.token.Pos*/0xfe10, {.d_s = v__token__Pos_str(node.pos)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif bool left_is_shared = v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f); - string left_cc_type = v__gen__c__Gen_cc_type(g, node.left_type, false); + string left_cc_type = v__gen__c__Gen_cc_type(g, v__ast__Table_unaliased_type(g->table, node.left_type), false); string left_type_name = v__util__no_dots(left_cc_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(left_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); if (v__ast__Expr_is_auto_deref_var(node.left) && v__ast__Type_nr_muls(node.left_type) > 1) { @@ -76513,7 +78945,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } else if ((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { rec_type = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, rec_type); - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { rec_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -76534,7 +78966,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE receiver_type_name = _SLIT("map"); } if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { - if (!((left_sym->info)._typ == 435 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { + if (!((left_sym->info)._typ == 436 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } if (string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("pop"))) { @@ -76829,7 +79261,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if (!v__ast__Type_alias_eq(typ, _const_v__ast__string_type) || g->comptime_for_method.len > 0) { v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, typ); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), _SLIT("str"))) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ )), _SLIT("str"))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -76883,7 +79315,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, typ); - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -76897,11 +79329,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_39776 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39776.arg0; - string pafile = mr_39776.arg1; - string pamod = mr_39776.arg2; - string pafn = mr_39776.arg3; + multi_return_int_string_string_string mr_39829 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39829.arg0; + string pafile = mr_39829.arg1; + string pamod = mr_39829.arg2; + string pafn = mr_39829.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -76926,7 +79358,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } } string dot = (is_ptr ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -77204,15 +79636,24 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr); } else { if (variadic_count > 0) { - string noscan = v__gen__c__Gen_check_noscan(g, arr_info.elem_type); - v__gen__c__Gen_write(g, str_intp(7, _MOV((StrIntpData[]){{_SLIT("new_array_from_c_array"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); - for (int j = arg_nr; j < args.len; ++j) { - v__gen__c__Gen_ref_or_deref_arg(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)), arr_info.elem_type, node.language); - if (j < args.len - 1) { - v__gen__c__Gen_write(g, _SLIT(", ")); + if (g->pref->translated || g->file->is_translated) { + for (int j = arg_nr; j < args.len; ++j) { + v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)).expr); + if (j < args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } } + } else { + string noscan = v__gen__c__Gen_check_noscan(g, arr_info.elem_type); + v__gen__c__Gen_write(g, str_intp(7, _MOV((StrIntpData[]){{_SLIT("new_array_from_c_array"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + for (int j = arg_nr; j < args.len; ++j) { + v__gen__c__Gen_ref_or_deref_arg(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)), arr_info.elem_type, node.language); + if (j < args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + v__gen__c__Gen_write(g, _SLIT("}))")); } - v__gen__c__Gen_write(g, _SLIT("}))")); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__new_array(0, 0, sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } @@ -77417,7 +79858,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__Type unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, expr.receiver_type); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), expr.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ )), expr.name)) { string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(receiver_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -77764,7 +80205,22 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_c_stmt(v__gen__c__Gen* g, v__ast__ForCSt } v__gen__c__Gen_write(g, _SLIT("; ")); if (node.has_inc) { - v__gen__c__Gen_stmt(g, node.inc); + bool processed = false; + if ((node.inc)._typ == 310 /* v.ast.ExprStmt */) { + if (((*node.inc._v__ast__ExprStmt).expr)._typ == 264 /* v.ast.ConcatExpr */) { + for (int inc_expr_idx = 0; inc_expr_idx < (*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.len; ++inc_expr_idx) { + v__ast__Expr inc_expr = ((v__ast__Expr*)(*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.data)[inc_expr_idx]; + v__gen__c__Gen_expr(g, inc_expr); + if (inc_expr_idx < (*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + processed = true; + } + } + if (!processed) { + v__gen__c__Gen_stmt(g, node.inc); + } } v__gen__c__Gen_writeln(g, _SLIT(") {")); g->is_vlines_enabled = true; @@ -77843,7 +80299,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT(" = ((voidptr*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("];"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { string right = str_intp(5, _MOV((StrIntpData[]){{_SLIT("(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("]"), 0, { .d_c = 0 }}})); @@ -77879,14 +80335,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } string idx = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__ast__TypeSymbol* cond_sym = v__ast__Table_sym(g->table, node.cond_type); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" != "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("; ++"), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); bool is_fixed_array = val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut; if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); } else if (is_fixed_array) { string styp = v__gen__c__Gen_typ(g, node.val_type); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(node.val_var)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -77948,7 +80404,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); if (val_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 448) /*expected idx: 448, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_write(g, _SLIT(" = (*(voidptr*)")); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("DenseArray_value(&"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arw_or_pt}}, {_SLIT("key_values, "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { @@ -78074,7 +80530,8 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_if(v__gen__c__Gen* g, v__ast bool _t6 = true; return _t6; } - } else if ((*stmt.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { + } + if ((*stmt.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { bool _t7 = true; return _t7; } @@ -78126,7 +80583,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no v__gen__c__Gen_stmts(g, branch.stmts); g->expected_cast_type = prev_expected_cast_type; } - if (node.branches.len == 1) { + if (node.branches.len == 1 && !node.is_expr) { v__gen__c__Gen_write(g, _SLIT(": 0")); } v__gen__c__Gen_write(g, _SLIT(")")); @@ -78217,7 +80674,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string left_var_name = v__gen__c__c_name(var.name); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*branch.cond._v__ast__IfGuardExpr).vars.len) { string var_typ = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(mr_info.types, vi))); if (is_auto_heap) { @@ -78378,7 +80835,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE v__gen__c__Gen_write(g, tmp_left); } } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; string noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); if (node.is_gated) { v__gen__c__Gen_write(g, _SLIT("array_slice_ni(")); @@ -78406,7 +80863,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE if (range.has_high) { v__gen__c__Gen_expr(g, range.high); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__array) { if (v__ast__Type_is_ptr(node.left_type)) { @@ -78506,7 +80963,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In v__gen__c__Gen_write(g, _SLIT("/*2*/string_clone(")); } if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")(*("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_sym */array_get("), 0, { .d_c = 0 }}}))); @@ -78570,10 +81027,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 447 /* v.ast.FnType */; + bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 448 /* v.ast.FnType */; if (is_fn_index_call) { v__gen__c__Gen_write(g, _SLIT("(*")); } @@ -78682,7 +81139,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = tmp_opt_ptr}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_ptr_typ */(map_get_check("), 0, { .d_c = 0 }}}))); } else { if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 448 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, _SLIT(")(*(voidptr*)map_get(")); @@ -78907,7 +81364,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr(v__gen__c__Gen* g, v__ast__InfixE VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arrow_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); string styp = left.sym->cname; - v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 445) /*expected idx: 445, name: v.ast.Chan */ ).elem_type; bool gen_or = node.or_block.kind != v__ast__OrKind__absent; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { @@ -78934,7 +81391,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_defined_eq_operator = v__ast__Table_has_method(g->table, left.sym, _SLIT("==")); - bool has_alias_eq_op_overload = (left.sym->info)._typ == 435 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + bool has_alias_eq_op_overload = (left.sym->info)._typ == 436 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + if (g->pref->translated && !g->is_builtin_mod) { + v__gen__c__Gen_gen_plain_infix_expr(g, node); + return; + } if ((v__ast__Type_is_ptr(left.typ) && v__ast__Type_is_int(right.typ)) || (v__ast__Type_is_ptr(right.typ) && v__ast__Type_is_int(left.typ))) { v__gen__c__Gen_gen_plain_infix_expr(g, node); } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 294 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 294) /*expected idx: 294, name: v.ast.StringLiteral */ ).val).len == 0) { @@ -79171,6 +81632,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_cmp_op(v__gen__c__Gen* g, v__ast_ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_operator_overloading = v__ast__Table_has_method(g->table, left.sym, _SLIT("<")); + if (g->pref->translated && !g->is_builtin_mod) { + v__gen__c__Gen_gen_plain_infix_expr(g, node); + return; + } if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { if (node.op == v__token__Kind__le || node.op == v__token__Kind__ge) { v__gen__c__Gen_write(g, _SLIT("!")); @@ -79339,7 +81804,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 443 /* v.ast.ArrayFixed */) { + if ((right.sym->info)._typ == 444 /* v.ast.ArrayFixed */) { v__ast__Type elem_type = (*right.sym->info._v__ast__ArrayFixed).elem_type; v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { @@ -79404,7 +81869,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); bool is_aggregate = left_sym->kind == v__ast__Kind__aggregate; if (is_aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 434) /*expected idx: 434, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(g->table, parent_left_type); } v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); @@ -79451,7 +81916,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; Array_v__ast__Type* _t2 = (Array_v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, info.conversions), &(int[]){node.right_type})); _option_Array_v__ast__Type _t1 = {0}; if (_t2) { @@ -79750,21 +82215,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { string dec_fn_dec = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = dec_fn_name}}, {_SLIT("(cJSON* root)"), 0, { .d_c = 0 }}})); string init_styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" res"), 0, { .d_c = 0 }}})); if (sym->kind == v__ast__Kind__struct_) { - int skips = 0; - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; - for (int _t2 = 0; _t2 < info.fields.len; ++_t2) { - v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t2]; - for (int _t3 = 0; _t3 < field.attrs.len; ++_t3) { - v__ast__Attr attr = ((v__ast__Attr*)field.attrs.data)[_t3]; - if (string__eq(attr.name, _SLIT("skip"))) { - skips++; - } - } - } - if (skips > 0) { - init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); - init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); - } + init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); + init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); } strings__Builder_writeln(&dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(" {\n "), /*115 &string*/0xfe10, {.d_s = init_styp}}, {_SLIT(";\n if (!root) {\n const char *error_ptr = cJSON_GetErrorPtr();\n if (error_ptr != NULL) {\n const int error_pos = (int)cJSON_GetErrorPos();\n int maxcontext_chars = 30;\n byte *buf = vcalloc_noscan(maxcontext_chars + 10);\n if(error_pos > 0) {\n int backlines = 1;\n int backchars = error_pos < maxcontext_chars-7 ? (int)error_pos : maxcontext_chars-7 ;\n char *prevline_ptr = (char*)error_ptr;\n while(backchars--){\n char prevc = *(prevline_ptr - 1);\n if(0==prevc){\n break;\n }\n if(10==prevc && !backlines--){\n break;\n }\n prevline_ptr--;\n if(123==prevc) {\n break; // stop at `{` too\n }\n }\n int maxchars = vstrlen_char(prevline_ptr);\n vmemcpy(buf, prevline_ptr, (maxchars < maxcontext_chars ? maxchars : maxcontext_chars));\n }\n return ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){.state = 2,.err = _v_error(tos2(buf)),.data = {0}};\n }\n }\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->json_forward_decls, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -79784,7 +82236,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, v__gen__c__Gen_decode_map(g, m.key_type, m.value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_map(g, m.key_type, m.value_type)); } else if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; v__ast__Type parent_typ = a.parent_type; v__ast__TypeSymbol* psym = v__ast__Table_sym(g->table, parent_typ); if (v__gen__c__is_js_prim(v__gen__c__Gen_typ(g, parent_typ))) { @@ -79803,7 +82255,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } } else if (sym->kind == v__ast__Kind__sum_type) { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 439 /* v.ast.SumType */) { + if ((sym->info)._typ != 440 /* v.ast.SumType */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not a sumtype"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } @@ -79827,7 +82279,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g, v__ast__TypeSymbol sym, strings__Builder* enc, strings__Builder* dec) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ; string type_var = v__gen__c__Gen_new_tmp_var(g); int typ = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){sym.name}, &(int[]){ 0 })); #if !defined(CUSTOM_DEFINE_json_no_inline_sumtypes) @@ -80039,81 +82491,69 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, if (v__gen__c__is_js_prim(field_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT("(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (field_sym->kind == v__ast__Kind__enum_) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (string__eq(field_sym->name, _SLIT("time.Time"))) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; string parent_type = v__gen__c__Gen_typ(g, alias.parent_type); string parent_dec_name = v__gen__c__js_dec_name(parent_type); if (v__gen__c__is_js_prim(parent_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else { v__gen__c__Gen_gen_json_for_type(g, field.typ); string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } } else { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } } string enc_name = v__gen__c__js_enc_name(field_type); @@ -80122,7 +82562,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } if (!v__gen__c__is_js_prim(field_type)) { if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; + v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ; enc_name = v__gen__c__js_enc_name(v__gen__c__Gen_typ(g, ainfo.parent_type)); } } @@ -80141,7 +82581,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, strings__Builder* dec, bool is_required) { strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root, \""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); if (is_required) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = 2, .err = _v_error(_SLIT(\"expected field \'"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\' is missing\")), .data = {0} };"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, _SLIT("\t}")); } @@ -80149,9 +82589,12 @@ VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, VV_LOCAL_SYMBOL void v__gen__c__gen_js_get_opt(string dec_name, string field_type, string styp, string tmp, string name, strings__Builder* dec, bool is_required) { v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - strings__Builder_writeln(dec, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state != 0) {"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state, .err = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".err, .data = {0} };"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT("(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state != 0) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state, .err = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".err, .data = {0} };"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t\t}")); strings__Builder_writeln(dec, _SLIT("\t}")); } @@ -80198,11 +82641,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, key_type); string styp_v = v__gen__c__Gen_typ(g, value_type); v__ast__TypeSymbol* key_type_symbol = v__ast__Table_sym(g->table, key_type); - multi_return_string_string_string_string mr_20487 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); - string hash_fn = mr_20487.arg0; - string key_eq_fn = mr_20487.arg1; - string clone_fn = mr_20487.arg2; - string free_fn = mr_20487.arg3; + multi_return_string_string_string_string mr_20160 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20160.arg0; + string key_eq_fn = mr_20160.arg1; + string clone_fn = mr_20160.arg2; + string free_fn = mr_20160.arg3; string fn_name_v = v__gen__c__js_dec_name(styp_v); string s = _SLIT(""); if (v__gen__c__is_js_prim(styp_v)) { @@ -80495,7 +82938,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast__MatchExpr node, bool is_expr, string cond_var, string tmp_var, v__ast__TypeSymbol enum_typ) { string cname = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = enum_typ.cname}}, {_SLIT("__"), 0, { .d_c = 0 }}})); - Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); + Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); Array_v__ast__MatchBranch range_branches = __new_array_with_default(0, node.branches.len, sizeof(v__ast__MatchBranch), 0); bool default_generated = false; g->empty_line = true; @@ -80504,8 +82947,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ for (int _t1 = 0; _t1 < node.branches.len; ++_t1) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)node.branches.data)[_t1]; if (branch.is_else) { - for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.len; ++_t2) { - string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.data)[_t2]; + for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).vals.len; ++_t2) { + string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 450) /*expected idx: 450, name: v.ast.Enum */ ).vals.data)[_t2]; if (!Array_string_contains(covered_enum, val)) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("case "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -81768,7 +84211,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_table_name(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL v__ast__StructField v__gen__c__Gen_get_struct_field(v__gen__c__Gen* g, string name) { v__ast__Struct info = v__ast__TypeSymbol_struct_info(v__ast__Table_sym(g->table, (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){g->sql_table_name}, &(int[]){ 0 })))); - v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; if (string__eq(field.name, name)) { @@ -81847,7 +84290,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast typ = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(typ, v__ast__TypeFlag__shared_f), 0); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - if ((sym->info)._typ == 435 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 436 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); if (v__ast__TypeSymbol_has_method(parent_sym, _SLIT("str"))) { typ = (*sym->info._v__ast__Alias).parent_type; @@ -81931,7 +84374,7 @@ VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i))); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (sym->kind == v__ast__Kind__alias) { - typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; } bool remove_tail_zeros = false; u8 fspec = (*(u8*)/*ee elem_sym */array_get(node.fmts, i)); @@ -82052,7 +84495,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } v__gen__c__Gen_expr(g, expr); } - } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), _SLIT("str"))) { + } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ )), _SLIT("str"))) { string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, expr); @@ -82070,7 +84513,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } else if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { exp_typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, exp_typ); - if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 434 /* v.ast.Aggregate */) { exp_typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -82361,7 +84804,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 270 /* v.ast.Ident */) { - v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, _SLIT("{")); for (int i = 0; i < fixed_array_info.size; ++i) { v__gen__c__Gen_expr(g, sfield.expr); @@ -82411,7 +84854,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t15 = v__ast__Table_find_field_from_embeds(g->table, update_sym, field->name); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_6823 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); @@ -82566,6 +85009,7 @@ _option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v .nr_lines = 0, .tidx = 0, .eofs = 0, + .inter_cbr_count = 0, .quote = 0, .inter_quote = 0, .comments_mode = comments_mode, @@ -82608,6 +85052,7 @@ v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMo .nr_lines = 0, .tidx = 0, .eofs = 0, + .inter_cbr_count = 0, .quote = 0, .inter_quote = 0, .comments_mode = comments_mode, @@ -82726,15 +85171,15 @@ VV_LOCAL_SYMBOL string v__scanner__Scanner_num_lit(v__scanner__Scanner* s, int s { // Unsafe block u8* txt = s->text.str; u8* b = malloc_noscan(end - start + 1); - int i1 = 0; - for (int i = start; i < end; i++) { + int i_no_sep = 0; + for (int i = start; i < end; ++i) { if (txt[i] != _const_v__scanner__num_sep) { - b[i1] = txt[i]; - i1++; + b[i_no_sep] = txt[i]; + i_no_sep++; } } - b[i1] = 0; - string _t2 = u8_vstring_with_len(b, i1); + b[i_no_sep] = 0; + string _t2 = u8_vstring_with_len(b, i_no_sep); return _t2; } return (string){.str=(byteptr)"", .is_lit=1}; @@ -83312,7 +85757,11 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne } else if (c == ('{')) { if (s->is_inside_string) { - continue; + if (s->text.str[ s->pos - 1] == '$') { + continue; + } else { + s->inter_cbr_count++; + } } v__token__Token _t28 = v__scanner__Scanner_new_token(s, v__token__Kind__lcbr, _SLIT(""), 1); return _t28; @@ -83327,7 +85776,7 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne } } else if (c == ('}')) { - if (s->is_enclosed_inter) { + if (s->is_enclosed_inter && s->inter_cbr_count == 0) { if (s->pos < s->text.len - 1) { s->pos++; } else { @@ -83344,6 +85793,9 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne v__token__Token _t32 = v__scanner__Scanner_new_token(s, v__token__Kind__string, ident_string, ident_string.len + 2); return _t32; } else { + if (s->inter_cbr_count > 0) { + s->inter_cbr_count--; + } v__token__Token _t33 = v__scanner__Scanner_new_token(s, v__token__Kind__rcbr, _SLIT(""), 1); return _t33; } @@ -84551,20 +87003,33 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* bool _t5 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).left) || v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).right); return _t5; } - else if (val._typ == 287 /* v.ast.PrefixExpr */) { - bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); + else if (val._typ == 285 /* v.ast.ParExpr */) { + bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__ParExpr).expr); return _t6; } + else if (val._typ == 256 /* v.ast.CallExpr */) { + for (int _t7 = 0; _t7 < (*val._v__ast__CallExpr).args.len; ++_t7) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*val._v__ast__CallExpr).args.data)[_t7]; + if (v__parser__Parser_check_cross_variables(p, exprs, arg.expr)) { + bool _t8 = true; + return _t8; + } + } + } + else if (val._typ == 287 /* v.ast.PrefixExpr */) { + bool _t9 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); + return _t9; + } else if (val._typ == 286 /* v.ast.PostfixExpr */) { - bool _t7 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); - return _t7; + bool _t10 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); + return _t10; } else if (val._typ == 290 /* v.ast.SelectorExpr */) { - for (int _t8 = 0; _t8 < exprs.len; ++_t8) { - v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t8]; + for (int _t11 = 0; _t11 < exprs.len; ++_t11) { + v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t11]; if (string__eq(v__ast__Expr_str(expr), val_str)) { - bool _t9 = true; - return _t9; + bool _t12 = true; + return _t12; } } } @@ -84572,8 +87037,8 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* else { } ; - bool _t10 = false; - return _t10; + bool _t13 = false; + return _t13; } VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Parser* p, Array_v__ast__Expr left, Array_v__ast__Comment left_comments) { @@ -84586,9 +87051,9 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t2, Array_v__ast__Comment); Array_v__ast__Comment right_comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); Array_v__ast__Expr right = __new_array_with_default(0, left.len, sizeof(v__ast__Expr), 0); - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_4041 = v__parser__Parser_expr_list(p); - right = mr_4041.arg0; - right_comments = mr_4041.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_4236 = v__parser__Parser_expr_list(p); + right = mr_4236.arg0; + right_comments = mr_4236.arg1; _PUSH_MANY(&comments, (right_comments), _t3, Array_v__ast__Comment); Array_v__ast__Comment end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); bool has_cross_var = false; @@ -84872,7 +87337,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } } v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file")); - if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { + if (string__eq(embed_compression_type, _SLIT("zlib"))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } v__ast__ComptimeCall _t7 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = ((v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.len = 0,.is_compressed = 0,}),.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = true,.is_env = 0,.is_pkgconfig = 0,}); @@ -85592,6 +88057,9 @@ bool inside_array_lit; v__parser__Parser_next(p); v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); + if (p->tok.kind == v__token__Kind__comma && p->peek_tok.kind == v__token__Kind__rpar) { + v__parser__Parser_next(p); + } v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.expr = expr,.cname = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; @@ -85834,18 +88302,11 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.right = right,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = pos,.left_type = 0,.right_type = 0,.op = tok.kind,.is_stmt = true,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,})))); - } else if (v__token__Kind_is_infix(p->tok.kind)) { - if (v__token__Kind_is_prefix(p->tok.kind) && p->tok.line_nr != p->prev_tok.line_nr) { - if (p->tok.kind == v__token__Kind__mul && v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__assign) { - v__ast__Expr _t4 = node; - return _t4; - } - v__parser__Parser_warn_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("move infix `"), /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str(p->tok.kind)}}, {_SLIT("` operator before new line (if infix intended) or use brackets for a prefix expression"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); - } + } else if (v__token__Kind_is_infix(p->tok.kind) && !((p->tok.kind == v__token__Kind__minus || p->tok.kind == v__token__Kind__amp || p->tok.kind == v__token__Kind__mul) && p->tok.line_nr != p->prev_tok.line_nr)) { node = v__parser__Parser_infix_expr(p, node); if (p->tok.kind == v__token__Kind__key_as && p->inside_if) { - v__ast__Expr _t5 = node; - return _t5; + v__ast__Expr _t4 = node; + return _t4; } } else if ((p->tok.kind == v__token__Kind__inc || p->tok.kind == v__token__Kind__dec) || (p->tok.kind == v__token__Kind__question && p->inside_ct_if_expr)) { if (p->peek_tok.kind == v__token__Kind__rpar || p->peek_tok.kind == v__token__Kind__rsbr) { @@ -85862,12 +88323,12 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr node = v__ast__PostfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PostfixExpr, (((v__ast__PostfixExpr){.op = p->tok.kind,.pos = v__token__Token_pos(&p->tok),.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); v__parser__Parser_next(p); } else { - v__ast__Expr _t6 = node; - return _t6; + v__ast__Expr _t5 = node; + return _t5; } } - v__ast__Expr _t7 = node; - return _t7; + v__ast__Expr _t6 = node; + return _t6; } VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, v__ast__Expr left) { @@ -86275,7 +88736,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { _option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t6; } @@ -86289,27 +88750,27 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); if (is_method) { bool is_duplicate = v__ast__TypeSymbol_has_method(type_sym, name); if (type_sym->kind == v__ast__Kind__interface_ && is_duplicate) { - if ((type_sym->info)._typ == 438 /* v.ast.Interface */) { + if ((type_sym->info)._typ == 439 /* v.ast.Interface */) { is_duplicate = !v__ast__Interface_has_method(&(*type_sym->info._v__ast__Interface), name); } } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t9; } } @@ -86323,7 +88784,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8871 = v__parser__Parser_parse_generic_types(p); @@ -86364,7 +88825,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); @@ -86419,7 +88880,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ @@ -86528,11 +88989,11 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ - .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}), + .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}), .generic_names = generic_names, .attrs = p->attrs, .params = params, @@ -86690,7 +89151,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->tok.kind == v__token__Kind__name) { if (v__parser__Parser_disallow_declarations_in_script_mode(p)) { - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } } @@ -86765,7 +89226,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__ast__Type typ = v__ast__new_type(idx); p->inside_defer = old_inside_defer; v__ast__AnonFn _t3 = ((v__ast__AnonFn){.decl = ((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = args, @@ -87062,7 +89523,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check_fn_mutable_arguments(v__parser__Par return; } if (sym->kind == v__ast__Kind__alias) { - v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; + v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type; v__parser__Parser_check_fn_mutable_arguments(p, atyp, pos); return; } @@ -88117,7 +90578,7 @@ v__ast__Type v__parser__Parser_parse_multi_return_type(v__parser__Parser* p) { Array_v__ast__Type mr_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool has_generic = false; for (;;) { - if (!(p->tok.kind != v__token__Kind__eof)) break; + if (!(!(p->tok.kind == v__token__Kind__eof || p->tok.kind == v__token__Kind__rpar))) break; v__ast__Type mr_type = v__parser__Parser_parse_type(p); if (v__ast__Type_idx(mr_type) == 0) { break; @@ -88164,9 +90625,9 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) } bool has_generic = false; int line_nr = p->tok.line_nr; - multi_return_Array_v__ast__Param_bool_bool mr_6628 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args = mr_6628.arg0; - bool is_variadic = mr_6628.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_6638 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args = mr_6638.arg0; + bool is_variadic = mr_6638.arg2; for (int _t2 = 0; _t2 < args.len; ++_t2) { v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; if (v__ast__Type_has_flag(arg.typ, v__ast__TypeFlag__generic)) { @@ -88388,7 +90849,7 @@ v__ast__Type v__parser__Parser_parse_type(v__parser__Parser* p) { return _t4; } v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); - if (is_optional && (sym->info)._typ == 439 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).is_anon) { + if (is_optional && (sym->info)._typ == 440 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 440) /*expected idx: 440, name: v.ast.SumType */ ).is_anon) { v__parser__Parser_error_with_pos(p, _SLIT("an inline sum type cannot be optional"), v__token__Pos_extend(optional_pos, v__token__Token_pos(&p->prev_tok))); } } @@ -88657,14 +91118,14 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 439 /* v.ast.Interface */) { if ((*parent_sym->info._v__ast__Interface).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Interface).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of interfce `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 440 /* v.ast.SumType */) { if ((*parent_sym->info._v__ast__SumType).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__SumType).generic_types.len != concrete_types.len) { @@ -88690,7 +91151,7 @@ bool v__parser__parse_stmt_defer_0 = false; eprintln( str_intp(4, _MOV((StrIntpData[]){{_SLIT("> "), /*115 &string*/0xfe10, {.d_s = _SLIT("v.parser")}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = _SLIT("parse_stmt")}}, {_SLIT(" text: "), /*115 &string*/0xfe10, {.d_s = text}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); + v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.table = table,.scope = scope,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -88721,15 +91182,15 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = tmpl_path, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -88739,9 +91200,9 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), .table = table, .scope = scope, + .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -88812,15 +91273,15 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -88830,9 +91291,9 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = v__scanner__new_scanner(text, comments_mode, pref), .table = table, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = v__scanner__new_scanner(text, comments_mode, pref), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -88965,15 +91426,15 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -88983,9 +91444,9 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = (*(v__scanner__Scanner**)_t1.data), .table = table, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = (*(v__scanner__Scanner**)_t1.data), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -89066,15 +91527,15 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -89084,9 +91545,9 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = (*(v__scanner__Scanner**)_t1.data), .table = table_, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = (*(v__scanner__Scanner**)_t1.data), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -89498,112 +91959,155 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { return _t15; } v__ast__IfExpr if_expr = v__parser__Parser_if_expr(p, true); - v__ast__Stmt _t16 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (((v__ast__ExprStmt){.pos = if_expr.pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__IfExpr_to_sumtype_v__ast__Expr(&if_expr),.is_expr = 0,.typ = 0,})))); - return _t16; + v__ast__ExprStmt cur_stmt = ((v__ast__ExprStmt){.pos = if_expr.pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__IfExpr_to_sumtype_v__ast__Expr(&if_expr),.is_expr = 0,.typ = 0,}); + if (v__parser__comptime_if_expr_contains_top_stmt(if_expr)) { + v__ast__Stmt _t16 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(&cur_stmt); + return _t16; + } else { + v__ast__Stmt _t17 = v__parser__Parser_other_stmts(p, v__ast__ExprStmt_to_sumtype_v__ast__Stmt(&cur_stmt)); + return _t17; + } } else if (p->tok.kind == (v__token__Kind__hash)) { - v__ast__Stmt _t17 = v__ast__HashStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__HashStmt, (v__parser__Parser_hash(p)))); - return _t17; - } - else if (p->tok.kind == (v__token__Kind__key_type)) { - v__ast__Stmt _t18 = v__ast__TypeDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__TypeDecl, (v__parser__Parser_type_decl(p)))); + v__ast__Stmt _t18 = v__ast__HashStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__HashStmt, (v__parser__Parser_hash(p)))); return _t18; } - else if (p->tok.kind == (v__token__Kind__key_enum)) { - v__ast__Stmt _t19 = v__ast__EnumDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__EnumDecl, (v__parser__Parser_enum_decl(p)))); + else if (p->tok.kind == (v__token__Kind__key_type)) { + v__ast__Stmt _t19 = v__ast__TypeDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__TypeDecl, (v__parser__Parser_type_decl(p)))); return _t19; } - else if (p->tok.kind == (v__token__Kind__key_union)) { - v__ast__Stmt _t20 = v__ast__StructDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__StructDecl, (v__parser__Parser_struct_decl(p)))); + else if (p->tok.kind == (v__token__Kind__key_enum)) { + v__ast__Stmt _t20 = v__ast__EnumDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__EnumDecl, (v__parser__Parser_enum_decl(p)))); return _t20; } - else if (p->tok.kind == (v__token__Kind__comment)) { - v__ast__Stmt _t21 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (v__parser__Parser_comment_stmt(p)))); + else if (p->tok.kind == (v__token__Kind__key_union)) { + v__ast__Stmt _t21 = v__ast__StructDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__StructDecl, (v__parser__Parser_struct_decl(p)))); return _t21; } + else if (p->tok.kind == (v__token__Kind__comment)) { + v__ast__Stmt _t22 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (v__parser__Parser_comment_stmt(p)))); + return _t22; + } else { - p->inside_fn = true; - if (p->pref->is_script && !p->pref->is_test) { - p->script_mode = true; - p->script_mode_start_token = p->tok; - if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { - v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); - } - v__parser__Parser_open_scope(p); - Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); - for (;;) { - if (!(p->tok.kind != v__token__Kind__eof)) break; - array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ v__parser__Parser_stmt(p, false) })); - } - v__parser__Parser_close_scope(p); - p->script_mode = false; - v__ast__Stmt _t23 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .label_names = p->label_names, - .name = _SLIT("main.main"), - .short_name = _SLIT("main"), - .mod = _SLIT("main"), - .file = p->file_name, - .source_file = 0, - .scope = p->scope, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, - .ctdefine_idx = -1, - .idx = 0, - .return_type = _const_v__ast__void_type, - .ninstances = 0, - .language = 0, - .file_mode = 0, - .rec_share = 0, - .is_deprecated = 0, - .is_pub = 0, - .is_variadic = 0, - .is_anon = 0, - .is_noreturn = 0, - .is_manualfree = 0, - .is_main = true, - .is_test = 0, - .is_conditional = 0, - .is_exported = 0, - .is_keep_alive = 0, - .is_unsafe = 0, - .is_markused = 0, - .is_method = 0, - .rec_mut = 0, - .no_body = 0, - .is_builtin = 0, - .is_direct_arr = 0, - .has_return = 0, - .should_be_skipped = 0, - .has_await = 0, - })))); - return _t23; - } else if (p->pref->is_fmt) { - v__ast__Stmt _t24 = v__parser__Parser_stmt(p, false); - return _t24; - } else { - v__ast__Stmt _t25 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, string__plus(_SLIT("bad top level statement "), v__token__Token_str(p->tok)))))); - return _t25; - } + v__ast__Stmt _t23 = v__parser__Parser_other_stmts(p, v__ast__empty_stmt()); + return _t23; }; if (p->should_abort) { break; } } - v__ast__Stmt _t26 = v__ast__empty_stmt(); - return _t26; + v__ast__Stmt _t24 = v__ast__empty_stmt(); + return _t24; +} + +VV_LOCAL_SYMBOL bool v__parser__comptime_if_expr_contains_top_stmt(v__ast__IfExpr if_expr) { + for (int _t1 = 0; _t1 < if_expr.branches.len; ++_t1) { + v__ast__IfBranch branch = ((v__ast__IfBranch*)if_expr.branches.data)[_t1]; + for (int _t2 = 0; _t2 < branch.stmts.len; ++_t2) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t2]; + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 271 /* v.ast.IfExpr */) { + if (!v__parser__comptime_if_expr_contains_top_stmt((*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr))) { + bool _t3 = false; + return _t3; + } + } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 256 /* v.ast.CallExpr */) { + bool _t4 = false; + return _t4; + } + } else if ((stmt)._typ == 302 /* v.ast.AssignStmt */) { + bool _t5 = false; + return _t5; + } else if ((stmt)._typ == 317 /* v.ast.HashStmt */) { + bool _t6 = true; + return _t6; + } + } + } + bool _t7 = true; + return _t7; +} + +VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_other_stmts(v__parser__Parser* p, v__ast__Stmt cur_stmt) { + p->inside_fn = true; + if (p->pref->is_script && !p->pref->is_test) { + p->script_mode = true; + p->script_mode_start_token = p->tok; + if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { + v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); + } + v__parser__Parser_open_scope(p); + Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); + if (!v__ast__Stmt_sumtype_eq(cur_stmt, v__ast__empty_stmt())) { + array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ cur_stmt })); + } + for (;;) { + if (!(p->tok.kind != v__token__Kind__eof)) break; + array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ v__parser__Parser_stmt(p, false) })); + } + v__parser__Parser_close_scope(p); + p->script_mode = false; + v__ast__Stmt _t3 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, + .name = _SLIT("main.main"), + .short_name = _SLIT("main"), + .mod = _SLIT("main"), + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, + .is_deprecated = 0, + .is_pub = 0, + .is_variadic = 0, + .is_anon = 0, + .is_noreturn = 0, + .is_manualfree = 0, + .is_main = true, + .is_test = 0, + .is_conditional = 0, + .is_exported = 0, + .is_keep_alive = 0, + .is_unsafe = 0, + .is_markused = 0, + .is_method = 0, + .rec_mut = 0, + .no_body = 0, + .is_builtin = 0, + .is_direct_arr = 0, + .has_return = 0, + .should_be_skipped = 0, + .has_await = 0, + })))); + return _t3; + } else if (p->pref->is_fmt) { + v__ast__Stmt _t4 = v__parser__Parser_stmt(p, false); + return _t4; + } else { + v__ast__Stmt _t5 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, string__plus(_SLIT("bad top level statement "), v__token__Token_str(p->tok)))))); + return _t5; + } + return (v__ast__Stmt){0}; } v__ast__Comment v__parser__Parser_check_comment(v__parser__Parser* p) { @@ -90765,9 +93269,9 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse v__token__Pos pos = v__token__Token_pos(&tok); Array_v__ast__Ident defer_vars = p->defer_vars; p->defer_vars = __new_array_with_default(0, 0, sizeof(v__ast__Ident), 0); - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48447 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_48447.arg0; - Array_v__ast__Comment left_comments = mr_48447.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_49074 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_49074.arg0; + Array_v__ast__Comment left_comments = mr_49074.arg1; if (!(p->inside_defer && p->tok.kind == v__token__Kind__decl_assign)) { _PUSH_MANY(&defer_vars, (p->defer_vars), _t1, Array_v__ast__Ident); } @@ -91142,6 +93646,9 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { arg = v__parser__Parser_expr(p, 0); has_arg = true; } + if (p->tok.kind == v__token__Kind__comma && p->peek_tok.kind == v__token__Kind__rpar) { + v__parser__Parser_next(p); + } v__token__Pos end_pos = v__token__Token_pos(&p->tok); v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){ @@ -91172,7 +93679,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { } else if ((p->peek_tok.kind == v__token__Kind__lcbr || (p->peek_tok.kind == v__token__Kind__lt && lit0_is_capital)) && (!p->inside_match || (p->inside_select && prev_tok_kind == v__token__Kind__arrow && lit0_is_capital)) && !p->inside_match_case && (!p->inside_if || p->inside_select) && (!p->inside_for || p->inside_select) && !known_var) { v__ast__Expr _t19 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (v__parser__Parser_struct_init(p, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit), false)))); return _t19; - } else if (p->peek_tok.kind == v__token__Kind__lcbr && p->inside_if && lit0_is_capital && !known_var && language == v__ast__Language__v) { + } else if (p->peek_tok.kind == v__token__Kind__lcbr && ((p->inside_if && lit0_is_capital && !known_var && language == v__ast__Language__v) || (p->inside_match_case && p->tok.kind == v__token__Kind__name && p->peek_tok.pos - p->tok.pos == p->tok.len))) { v__ast__Expr _t20 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (v__parser__Parser_struct_init(p, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit), false)))); return _t20; } else if (p->peek_tok.kind == v__token__Kind__dot && (lit0_is_capital && !known_var && language == v__ast__Language__v)) { @@ -92050,9 +94557,9 @@ VV_LOCAL_SYMBOL v__ast__Return v__parser__Parser_return_stmt(v__parser__Parser* v__ast__Return _t1 = ((v__ast__Return){.pos = first_pos,.comments = comments,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),}); return _t1; } - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_85187 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_85187.arg0; - Array_v__ast__Comment comments2 = mr_85187.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_86019 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_86019.arg0; + Array_v__ast__Comment comments2 = mr_86019.arg1; _PUSH_MANY(&comments, (comments2), _t2, Array_v__ast__Comment); v__token__Pos end_pos = v__ast__Expr_pos((*(v__ast__Expr*)array_last(exprs))); v__ast__Return _t3 = ((v__ast__Return){.pos = v__token__Pos_extend(first_pos, end_pos),.comments = comments,.exprs = exprs,.types = __new_array(0, 0, sizeof(v__ast__Type)),}); @@ -92322,8 +94829,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t3; } Array_v__ast__TypeNode sum_variants = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); - multi_return_Array_v__ast__Type_Array_string mr_91683 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_91683.arg0; + multi_return_Array_v__ast__Type_Array_string mr_92515 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_92515.arg0; v__token__Pos decl_pos_with_generics = v__token__Pos_extend(decl_pos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_check(p, v__token__Kind__assign); v__token__Pos type_pos = v__token__Token_pos(&p->tok); @@ -93123,6 +95630,9 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } v__token__Pos field_start_pos = v__token__Token_pos(&p->tok); bool is_field_volatile = false; + bool is_field_deprecated = false; + string field_deprecation_msg = _SLIT(""); + string field_deprecated_after = _SLIT(""); if (p->tok.kind == v__token__Kind__key_volatile) { v__parser__Parser_next(p); is_field_volatile = true; @@ -93200,6 +95710,19 @@ bool v__parser__Parser_struct_decl_defer_0 = false; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t23, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__lsbr) { v__parser__Parser_attributes(p); + for (int _t24 = 0; _t24 < p->attrs.len; ++_t24) { + v__ast__Attr fa = ((v__ast__Attr*)p->attrs.data)[_t24]; + + if (string__eq(fa.name, _SLIT("deprecated"))) { + is_field_deprecated = true; + field_deprecation_msg = fa.arg; + } + else if (string__eq(fa.name, _SLIT("deprecated_after"))) { + field_deprecated_after = fa.arg; + } + else { + }; + } } v__ast__Expr default_expr = v__ast__empty_expr(); bool has_default_expr = false; @@ -93215,12 +95738,14 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } ; has_default_expr = true; - _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t24, Array_v__ast__Comment); + _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t25, Array_v__ast__Comment); } array_push((array*)&ast_fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ .comments = comments, .attrs = p->attrs, .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = field_deprecation_msg, + .deprecated_after = field_deprecated_after, .default_expr = default_expr, .name = field_name, .pos = field_pos, @@ -93233,12 +95758,15 @@ bool v__parser__Parser_struct_decl_defer_0 = false; .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, + .is_deprecated = is_field_deprecated, }) })); } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ .comments = comments, .attrs = p->attrs, .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = field_deprecation_msg, + .deprecated_after = field_deprecated_after, .default_expr = default_expr, .name = field_name, .pos = field_pos, @@ -93251,6 +95779,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, + .is_deprecated = is_field_deprecated, }) })); p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); i++; @@ -93288,17 +95817,6 @@ bool v__parser__Parser_struct_decl_defer_0 = false; }); if (v__ast__Table_has_deep_child_no_ref(p->table, &t, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid recursive struct `"), /*115 &string*/0xfe10, {.d_s = orig_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t27 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); - // Defer begin - if (v__parser__Parser_struct_decl_defer_0) { - v__ast__Table_reset_parsing_type(p->table); - } - // Defer end - return _t27; - } - int ret = v__ast__Table_register_sym(p->table, t); - if (ret == -1 && language != v__ast__Language__c) { - v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); v__ast__StructDecl _t28 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { @@ -93307,8 +95825,19 @@ bool v__parser__Parser_struct_decl_defer_0 = false; // Defer end return _t28; } + int ret = v__ast__Table_register_sym(p->table, t); + if (ret == -1 && language != v__ast__Language__c) { + v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); + v__ast__StructDecl _t29 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); + // Defer begin + if (v__parser__Parser_struct_decl_defer_0) { + v__ast__Table_reset_parsing_type(p->table); + } + // Defer end + return _t29; + } p->expr_mod = _SLIT(""); - v__ast__StructDecl _t29 = ((v__ast__StructDecl){ + v__ast__StructDecl _t30 = ((v__ast__StructDecl){ .generic_types = generic_types, .attrs = attrs, .end_comments = end_comments, @@ -93330,7 +95859,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__ast__Table_reset_parsing_type(p->table); } // Defer end - return _t29; + return _t30; } VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Parser* p, string typ_str, bool short_syntax) { @@ -93454,8 +95983,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13120 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13120.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13775 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13775.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { @@ -93484,7 +96013,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } v__ast__Type typ = v__ast__new_type(reg_idx); v__ast__TypeSymbol* ts = v__ast__Table_sym(p->table, typ); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 439) /*expected idx: 439, name: v.ast.Interface */ ; ts->methods = __new_array_with_default(0, 20, sizeof(v__ast__Fn), 0); Array_v__ast__StructField fields = __new_array_with_default(0, 20, sizeof(v__ast__StructField), 0); Array_v__ast__FnDecl methods = __new_array_with_default(0, 20, sizeof(v__ast__FnDecl), 0); @@ -93550,13 +96079,13 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t8; } - multi_return_Array_v__ast__Param_bool_bool mr_16256 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16256.arg0; - bool is_variadic = mr_16256.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16911 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16911.arg0; + bool is_variadic = mr_16911.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = args, @@ -93668,6 +96197,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .comments = comments, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = (string){.str=(byteptr)"", .is_lit=1}, + .deprecated_after = (string){.str=(byteptr)"", .is_lit=1}, .default_expr = {0}, .name = field_name, .pos = field_pos, @@ -93680,8 +96211,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_mut = 0, .is_global = 0, .is_volatile = 0, + .is_deprecated = 0, }) })); - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,}) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}) })); } } Array_v__ast__Type _t15 = {0}; @@ -94150,6 +96682,7 @@ v__builder__Builder v__builder__new_builder(v__pref__Preferences* pref) { .mod_invalidates_paths = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .mod_invalidates_mods = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .path_invalidates_mods = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .crun_cache_keys = __new_array(0, 0, sizeof(string)), }); return _t2; } @@ -95694,6 +98227,17 @@ VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_rest_of_module_cfl // TypeDecl void v__builder__compile(string command, v__pref__Preferences* pref, void (*backend_cb)(v__builder__Builder* b)) { + v__builder__check_if_output_folder_is_writable(pref); + v__builder__Builder b = v__builder__new_builder(pref); + if (v__builder__Builder_should_rebuild(&b)) { + v__builder__Builder_rebuild(&b, (voidptr)backend_cb); + } + v__builder__Builder_exit_on_invalid_syntax(&b); + v__builder__Builder_myfree(&b); + v__builder__Builder_run_compiled_executable_and_exit(&b); +} + +VV_LOCAL_SYMBOL void v__builder__check_if_output_folder_is_writable(v__pref__Preferences* pref) { string odir = os__dir(pref->out_name); string output_folder = odir; if (odir.len == pref->out_name.len) { @@ -95708,54 +98252,6 @@ void v__builder__compile(string command, v__pref__Preferences* pref, void (*back } (*(bool*)_t1.data); - v__builder__Builder b = v__builder__new_builder(pref); - if (pref->is_verbose) { - println(_SLIT("builder.compile() pref:")); - } - time__StopWatch sw = time__new_stopwatch(((time__StopWatchOptions){.auto_start = true,})); - backend_cb((voidptr)&/*qq*/b); - v__util__Timers* timers = v__util__get_timers(); - v__util__Timers_show_remaining(timers); - if (pref->is_stats) { - i64 compilation_time_micros = 1 + time__Duration_microseconds(time__StopWatch_elapsed(sw)); - string scompilation_time_ms = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*102 &f64*/0xc062d, {.d_f64 = ((f64)(compilation_time_micros)) / 1000.0}}, {_SLIT0, 0, { .d_c = 0 }}}))); - int all_v_source_lines = 0; - int all_v_source_bytes = 0; - for (int _t2 = 0; _t2 < b.parsed_files.len; ++_t2) { - v__ast__File* pf = ((v__ast__File**)b.parsed_files.data)[_t2]; - all_v_source_lines += pf->nr_lines; - all_v_source_bytes += pf->nr_bytes; - } - string sall_v_source_lines = int_str(all_v_source_lines); - string sall_v_source_bytes = int_str(all_v_source_bytes); - sall_v_source_lines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_lines}}, {_SLIT0, 0, { .d_c = 0 }}}))); - sall_v_source_bytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_bytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" V source code size: "), /*115 &string*/0xfe10, {.d_s = sall_v_source_lines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sall_v_source_bytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); - string slines = int_str(b.stats_lines); - string sbytes = int_str(b.stats_bytes); - slines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = slines}}, {_SLIT0, 0, { .d_c = 0 }}}))); - sbytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sbytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("generated target code size: "), /*115 &string*/0xfe10, {.d_s = slines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sbytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); - int vlines_per_second = ((int)(1000000.0 * ((f64)(all_v_source_lines)) / ((f64)(compilation_time_micros)))); - string svlines_per_second = v__util__bold(int_str(vlines_per_second)); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("compilation took: "), /*115 &string*/0xfe10, {.d_s = scompilation_time_ms}}, {_SLIT(" ms, compilation speed: "), /*115 &string*/0xfe10, {.d_s = svlines_per_second}}, {_SLIT(" vlines/s"), 0, { .d_c = 0 }}}))); - } - v__builder__Builder_exit_on_invalid_syntax(&b); - v__builder__Builder_myfree(&b); - if (pref->is_test || pref->is_run) { - v__builder__Builder_run_compiled_executable_and_exit(&b); - } -} - -string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix) { - string vtmp = v__util__get_vtmp_folder(); - string uniq = _SLIT(""); - if (!b->pref->reuse_tmpc) { - uniq = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*117 &u64*/0xfe08, {.d_u64 = rand__u64()}}, {_SLIT0, 0, { .d_c = 0 }}})); - } - string fname = string__plus(os__file_name(os__real_path(base_file_name)), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = uniq}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = postfix}}, {_SLIT0, 0, { .d_c = 0 }}}))); - string _t1 = os__real_path(os__join_path(vtmp, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){fname})))); - return _t1; } // Attr: [unsafe] @@ -95798,94 +98294,92 @@ VV_LOCAL_SYMBOL void v__builder__Builder_run_compiled_executable_and_exit(v__bui _v_panic(_SLIT("Running iOS apps is not supported yet.")); VUNREACHABLE(); } - if (b->pref->is_verbose) { - } - if (b->pref->is_test || b->pref->is_run) { - string compiled_file = os__real_path(b->pref->out_name); - string _t1; /* if prepend */ - if (v__pref__Backend_is_js(b->pref->backend)) { - #if defined(_WIN32) - string node_basename = _SLIT("node.exe"); - #else - string node_basename = _SLIT("node"); - #endif - ; -_option_string _t2 = os__find_abs_path_of_executable(node_basename); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - _v_panic(_SLIT("Could not find `node` in system path. Do you have Node.js installed?")); - VUNREACHABLE(); - ; - } - - _t1 = (*(string*)_t2.data); - } else { - _t1 = compiled_file; - } - string run_file = _t1; - Array_string run_args = __new_array_with_default(0, b->pref->run_args.len + 1, sizeof(string), 0); - if (v__pref__Backend_is_js(b->pref->backend)) { - array_push((array*)&run_args, _MOV((string[]){ string_clone(compiled_file) })); - } - _PUSH_MANY(&run_args, (b->pref->run_args), _t4, Array_string); - os__Process* run_process = os__new_process(run_file); - os__Process_set_args(run_process, run_args); - if (b->pref->is_verbose) { - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("running "), /*115 &string*/0xfe10, {.d_s = run_process->filename}}, {_SLIT(" with arguments "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(run_process->args)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - _option_os__SignalHandler _t5 = os__signal_opt(os__Signal__int, (voidptr)v__builder__eshcb); - if (_t5.state != 0) { /*or block*/ - IError err = _t5.err; - v__builder__serror(_SLIT("set .int"), err); - VUNREACHABLE(); - ; - } - - void (*prev_int_handler) (os__Signal ) = (*(os__SignalHandler*)_t5.data); - void (*prev_quit_handler) (os__Signal ) = ((os__SignalHandler)(v__builder__eshcb)); - #if !defined(_WIN32) - { - _option_os__SignalHandler _t6 = os__signal_opt(os__Signal__quit, (voidptr)v__builder__eshcb); - if (_t6.state != 0) { /*or block*/ - IError err = _t6.err; - v__builder__serror(_SLIT("set .quit"), err); - VUNREACHABLE(); - ; - } - - prev_quit_handler = (voidptr) (*(os__SignalHandler*)_t6.data); - } - #endif - os__Process_wait(run_process); - _option_os__SignalHandler _t7 = os__signal_opt(os__Signal__int, (voidptr)prev_int_handler); - if (_t7.state != 0) { /*or block*/ - IError err = _t7.err; - v__builder__serror(_SLIT("restore .int"), err); - VUNREACHABLE(); - ; - } - - (*(os__SignalHandler*)_t7.data); - #if !defined(_WIN32) - { - _option_os__SignalHandler _t8 = os__signal_opt(os__Signal__quit, (voidptr)prev_quit_handler); - if (_t8.state != 0) { /*or block*/ - IError err = _t8.err; - v__builder__serror(_SLIT("restore .quit"), err); - VUNREACHABLE(); - ; - } - - (*(os__SignalHandler*)_t8.data); - } - #endif - int ret = run_process->code; - os__Process_close(run_process); - v__builder__Builder_cleanup_run_executable_after_exit(b, compiled_file); - _v_exit(ret); + if (!(b->pref->is_test || b->pref->is_run || b->pref->is_crun)) { + _v_exit(0); VUNREACHABLE(); } - _v_exit(0); + string compiled_file = os__real_path(b->pref->out_name); + string _t1; /* if prepend */ + if (v__pref__Backend_is_js(b->pref->backend)) { + #if defined(_WIN32) + string node_basename = _SLIT("node.exe"); + #else + string node_basename = _SLIT("node"); + #endif + ; +_option_string _t2 = os__find_abs_path_of_executable(node_basename); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + _v_panic(_SLIT("Could not find `node` in system path. Do you have Node.js installed?")); + VUNREACHABLE(); + ; + } + + _t1 = (*(string*)_t2.data); + } else { + _t1 = compiled_file; + } + string run_file = _t1; + Array_string run_args = __new_array_with_default(0, b->pref->run_args.len + 1, sizeof(string), 0); + if (v__pref__Backend_is_js(b->pref->backend)) { + array_push((array*)&run_args, _MOV((string[]){ string_clone(compiled_file) })); + } + _PUSH_MANY(&run_args, (b->pref->run_args), _t4, Array_string); + os__Process* run_process = os__new_process(run_file); + os__Process_set_args(run_process, run_args); + if (b->pref->is_verbose) { + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("running "), /*115 &string*/0xfe10, {.d_s = run_process->filename}}, {_SLIT(" with arguments "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(run_process->args)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + _option_os__SignalHandler _t5 = os__signal_opt(os__Signal__int, (voidptr)v__builder__eshcb); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; + v__builder__serror(_SLIT("set .int"), err); + VUNREACHABLE(); + ; + } + + void (*prev_int_handler) (os__Signal ) = (*(os__SignalHandler*)_t5.data); + void (*prev_quit_handler) (os__Signal ) = ((os__SignalHandler)(v__builder__eshcb)); + #if !defined(_WIN32) + { + _option_os__SignalHandler _t6 = os__signal_opt(os__Signal__quit, (voidptr)v__builder__eshcb); + if (_t6.state != 0) { /*or block*/ + IError err = _t6.err; + v__builder__serror(_SLIT("set .quit"), err); + VUNREACHABLE(); + ; + } + + prev_quit_handler = (voidptr) (*(os__SignalHandler*)_t6.data); + } + #endif + os__Process_wait(run_process); + _option_os__SignalHandler _t7 = os__signal_opt(os__Signal__int, (voidptr)prev_int_handler); + if (_t7.state != 0) { /*or block*/ + IError err = _t7.err; + v__builder__serror(_SLIT("restore .int"), err); + VUNREACHABLE(); + ; + } + + (*(os__SignalHandler*)_t7.data); + #if !defined(_WIN32) + { + _option_os__SignalHandler _t8 = os__signal_opt(os__Signal__quit, (voidptr)prev_quit_handler); + if (_t8.state != 0) { /*or block*/ + IError err = _t8.err; + v__builder__serror(_SLIT("restore .quit"), err); + VUNREACHABLE(); + ; + } + + (*(os__SignalHandler*)_t8.data); + } + #endif + int ret = run_process->code; + os__Process_close(run_process); + v__builder__Builder_cleanup_run_executable_after_exit(b, compiled_file); + _v_exit(ret); VUNREACHABLE(); } @@ -95901,6 +98395,9 @@ VNORETURN VV_LOCAL_SYMBOL void v__builder__serror(string reason, IError e) { } VV_LOCAL_SYMBOL void v__builder__Builder_cleanup_run_executable_after_exit(v__builder__Builder* v, string exefile) { + if (v->pref->is_crun) { + return; + } if (v->pref->reuse_tmpc) { v__pref__Preferences_vrun_elog(v->pref, str_intp(2, _MOV((StrIntpData[]){{_SLIT("keeping executable: "), /*115 &string*/0xfe10, {.d_s = exefile}}, {_SLIT(" , because -keepc was passed"), 0, { .d_c = 0 }}}))); return; @@ -96636,12 +99133,6 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (!b->pref->use_cache || b->pref->build_mode == v__pref__BuildMode__build_module) { return; } - v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); - Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) - ; - Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) - ; - strings__Builder sb_new_hashes = strings__new_builder(1024); Array_string _t1 = {0}; Array_v__ast__File_ptr _t1_orig = b->parsed_files; int _t1_len = _t1_orig.len; @@ -96653,17 +99144,44 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { array_push((array*)&_t1, &ti); } Array_string all_files =_t1; + #if defined(CUSTOM_DEFINE_trace_invalidations) + { + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> rebuild_modules all_files: "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(all_files)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + #endif + Array_string invalidations = v__builder__Builder_find_invalidated_modules_by_files(b, all_files); + #if defined(CUSTOM_DEFINE_trace_invalidations) + { + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> rebuild_modules invalidations: "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(invalidations)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + #endif + if (invalidations.len > 0) { + string vexe = v__pref__vexe_path(); + for (int _t3 = 0; _t3 < invalidations.len; ++_t3) { + string imp = ((string*)invalidations.data)[_t3]; + v__builder__Builder_v_build_module(b, vexe, imp); + } + } +} + +Array_string v__builder__Builder_find_invalidated_modules_by_files(v__builder__Builder* b, Array_string all_files) { + v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + strings__Builder sb_new_hashes = strings__new_builder(1024); v__vcache__CacheManager cm = v__vcache__new_cache_manager(all_files); - _option_string _t3 = v__vcache__CacheManager_load(&cm, _SLIT(".hashes"), _SLIT("all_files")); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - *(string*) _t3.data = _SLIT(" "); + _option_string _t1 = v__vcache__CacheManager_load(&cm, _SLIT(".hashes"), _SLIT("all_files")); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + *(string*) _t1.data = _SLIT(" "); } - string sold_hashes = (*(string*)_t3.data); + string sold_hashes = (*(string*)_t1.data); Array_string sold_hashes_lines = string_split(sold_hashes, _SLIT("\n")); - for (int _t4 = 0; _t4 < sold_hashes_lines.len; ++_t4) { - string line = ((string*)sold_hashes_lines.data)[_t4]; + for (int _t2 = 0; _t2 < sold_hashes_lines.len; ++_t2) { + string line = ((string*)sold_hashes_lines.data)[_t2]; if (line.len == 0) { continue; } @@ -96672,16 +99190,15 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { string cpath = (*(string*)/*ee elem_sym */array_get(x, 1)); map_set(&old_hashes, &(string[]){cpath}, &(string[]) { chash }); } - for (int _t5 = 0; _t5 < b->parsed_files.len; ++_t5) { - v__ast__File* p = ((v__ast__File**)b->parsed_files.data)[_t5]; - string cpath = p->path; - _option_string _t6 = v__util__read_file(cpath); - if (_t6.state != 0) { /*or block*/ - IError err = _t6.err; - *(string*) _t6.data = _SLIT(""); + for (int _t3 = 0; _t3 < all_files.len; ++_t3) { + string cpath = ((string*)all_files.data)[_t3]; + _option_string _t4 = v__util__read_file(cpath); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(string*) _t4.data = _SLIT(""); } - string ccontent = (*(string*)_t6.data); + string ccontent = (*(string*)_t4.data); string chash = u64_hex_full(hash__sum64_string(ccontent, 7U)); map_set(&new_hashes, &(string[]){cpath}, &(string[]) { chash }); strings__Builder_write_string(&sb_new_hashes, chash); @@ -96690,40 +99207,41 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { strings__Builder_write_u8(&sb_new_hashes, '\n'); } string snew_hashes = strings__Builder_str(&sb_new_hashes); - _option_string _t7 = v__vcache__CacheManager_save(&cm, _SLIT(".hashes"), _SLIT("all_files"), snew_hashes); - if (_t7.state != 0) { /*or block*/ - IError err = _t7.err; + _option_string _t5 = v__vcache__CacheManager_save(&cm, _SLIT(".hashes"), _SLIT("all_files"), snew_hashes); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; } - (*(string*)_t7.data); - v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + (*(string*)_t5.data); + v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + Array_string invalidations = __new_array_with_default(0, 0, sizeof(string), 0); if (!Map_string_string_map_eq(new_hashes, old_hashes)) { - v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); + v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); #if defined(CUSTOM_DEFINE_trace_invalidations) { - Map_string_Array_string _t8 = b->mod_invalidates_paths; - int _t10 = _t8.key_values.len; - for (int _t9 = 0; _t9 < _t10; ++_t9 ) { - int _t11 = _t8.key_values.len - _t10; - _t10 = _t8.key_values.len; - if (_t11 < 0) { - _t9 = -1; + Map_string_Array_string _t6 = b->mod_invalidates_paths; + int _t8 = _t6.key_values.len; + for (int _t7 = 0; _t7 < _t8; ++_t7 ) { + int _t9 = _t6.key_values.len - _t8; + _t8 = _t6.key_values.len; + if (_t9 < 0) { + _t7 = -1; continue; } - if (!DenseArray_has_index(&_t8.key_values, _t9)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t8.key_values, _t9); + if (!DenseArray_has_index(&_t6.key_values, _t7)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t6.key_values, _t7); k = string_clone(k); - Array_string v = (*(Array_string*)DenseArray_value(&_t8.key_values, _t9)); + Array_string v = (*(Array_string*)DenseArray_value(&_t6.key_values, _t7)); Map_string_bool m = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - Array_string _t12 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_mods), &(string[]){k}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); - for (int _t13 = 0; _t13 < _t12.len; ++_t13) { - string mm = ((string*)_t12.data)[_t13]; + Array_string _t10 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_mods), &(string[]){k}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); + for (int _t11 = 0; _t11 < _t10.len; ++_t11) { + string mm = ((string*)_t10.data)[_t11]; map_set(&m, &(string[]){mm}, &(bool[]) { true }); } eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("> module `"), /*115 &string*/0xfe10, {.d_s = k}}, {_SLIT("` invalidates: "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(map_keys(&m))}}, {_SLIT0, 0, { .d_c = 0 }}}))); - for (int _t14 = 0; _t14 < v.len; ++_t14) { - string fpath = ((string*)v.data)[_t14]; + for (int _t12 = 0; _t12 < v.len; ++_t12) { + string fpath = ((string*)v.data)[_t12]; eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fpath}}, {_SLIT0, 0, { .d_c = 0 }}}))); } } @@ -96733,18 +99251,18 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { ; Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t16 = new_hashes.key_values.len; - for (int _t15 = 0; _t15 < _t16; ++_t15 ) { - int _t17 = new_hashes.key_values.len - _t16; - _t16 = new_hashes.key_values.len; - if (_t17 < 0) { - _t15 = -1; + int _t14 = new_hashes.key_values.len; + for (int _t13 = 0; _t13 < _t14; ++_t13 ) { + int _t15 = new_hashes.key_values.len - _t14; + _t14 = new_hashes.key_values.len; + if (_t15 < 0) { + _t13 = -1; continue; } - if (!DenseArray_has_index(&new_hashes.key_values, _t15)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t15); + if (!DenseArray_has_index(&new_hashes.key_values, _t13)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t13); npath = string_clone(npath); - string nhash = (*(string*)DenseArray_value(&new_hashes.key_values, _t15)); + string nhash = (*(string*)DenseArray_value(&new_hashes.key_values, _t13)); if (!_IN_MAP(ADDR(string, npath), ADDR(map, old_hashes))) { (*(int*)map_get_and_set((map*)&invalidated_paths, &(string[]){npath}, &(int[]){ 0 }))++; continue; @@ -96754,18 +99272,18 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { continue; } } - int _t19 = old_hashes.key_values.len; - for (int _t18 = 0; _t18 < _t19; ++_t18 ) { - int _t20 = old_hashes.key_values.len - _t19; - _t19 = old_hashes.key_values.len; - if (_t20 < 0) { - _t18 = -1; + int _t17 = old_hashes.key_values.len; + for (int _t16 = 0; _t16 < _t17; ++_t16 ) { + int _t18 = old_hashes.key_values.len - _t17; + _t17 = old_hashes.key_values.len; + if (_t18 < 0) { + _t16 = -1; continue; } - if (!DenseArray_has_index(&old_hashes.key_values, _t18)) {continue;} - string opath = /*key*/ *(string*)DenseArray_key(&old_hashes.key_values, _t18); + if (!DenseArray_has_index(&old_hashes.key_values, _t16)) {continue;} + string opath = /*key*/ *(string*)DenseArray_key(&old_hashes.key_values, _t16); opath = string_clone(opath); - string ohash = (*(string*)DenseArray_value(&old_hashes.key_values, _t18)); + string ohash = (*(string*)DenseArray_value(&old_hashes.key_values, _t16)); if (!_IN_MAP(ADDR(string, opath), ADDR(map, new_hashes))) { (*(int*)map_get_and_set((map*)&invalidated_paths, &(string[]){opath}, &(int[]){ 0 }))++; continue; @@ -96789,16 +99307,16 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { #endif Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t22 = invalidated_paths.key_values.len; - for (int _t21 = 0; _t21 < _t22; ++_t21 ) { - int _t23 = invalidated_paths.key_values.len - _t22; - _t22 = invalidated_paths.key_values.len; - if (_t23 < 0) { - _t21 = -1; + int _t20 = invalidated_paths.key_values.len; + for (int _t19 = 0; _t19 < _t20; ++_t19 ) { + int _t21 = invalidated_paths.key_values.len - _t20; + _t20 = invalidated_paths.key_values.len; + if (_t21 < 0) { + _t19 = -1; continue; } - if (!DenseArray_has_index(&invalidated_paths.key_values, _t21)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&invalidated_paths.key_values, _t21); + if (!DenseArray_has_index(&invalidated_paths.key_values, _t19)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&invalidated_paths.key_values, _t19); npath = string_clone(npath); Array_string invalidated_mods = (*(Array_string*)map_get(ADDR(map, b->path_invalidates_mods), &(string[]){npath}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); if (Array_string_arr_eq(invalidated_mods, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("main")})))) { @@ -96808,14 +99326,14 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { rebuild_everything = true; break; } - for (int _t24 = 0; _t24 < invalidated_mods.len; ++_t24) { - string imod = ((string*)invalidated_mods.data)[_t24]; + for (int _t22 = 0; _t22 < invalidated_mods.len; ++_t22) { + string imod = ((string*)invalidated_mods.data)[_t22]; if (string__eq(imod, _SLIT("main"))) { continue; } - Array_string _t25 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_paths), &(string[]){imod}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); - for (int _t26 = 0; _t26 < _t25.len; ++_t26) { - string np = ((string*)_t25.data)[_t26]; + Array_string _t23 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_paths), &(string[]){imod}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); + for (int _t24 = 0; _t24 < _t23.len; ++_t24) { + string np = ((string*)_t23.data)[_t24]; (*(int*)map_get_and_set((map*)&new_invalidated_paths, &(string[]){np}, &(int[]){ 0 }))++; } } @@ -96838,16 +99356,16 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (rebuild_everything) { invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t28 = new_hashes.key_values.len; - for (int _t27 = 0; _t27 < _t28; ++_t27 ) { - int _t29 = new_hashes.key_values.len - _t28; - _t28 = new_hashes.key_values.len; - if (_t29 < 0) { - _t27 = -1; + int _t26 = new_hashes.key_values.len; + for (int _t25 = 0; _t25 < _t26; ++_t25 ) { + int _t27 = new_hashes.key_values.len - _t26; + _t26 = new_hashes.key_values.len; + if (_t27 < 0) { + _t25 = -1; continue; } - if (!DenseArray_has_index(&new_hashes.key_values, _t27)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t27); + if (!DenseArray_has_index(&new_hashes.key_values, _t25)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t25); npath = string_clone(npath); string mpath = os__dir(npath); Array_string pimods = (*(Array_string*)map_get(ADDR(map, b->path_invalidates_mods), &(string[]){npath}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); @@ -96865,14 +99383,15 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { #endif if (invalidated_mod_paths.len > 0) { Array_string impaths = map_keys(&invalidated_mod_paths); - string vexe = v__pref__vexe_path(); - for (int _t30 = 0; _t30 < impaths.len; ++_t30) { - string imp = ((string*)impaths.data)[_t30]; - v__builder__Builder_v_build_module(b, vexe, imp); + for (int _t28 = 0; _t28 < impaths.len; ++_t28) { + string imp = ((string*)impaths.data)[_t28]; + array_push((array*)&invalidations, _MOV((string[]){ string_clone(imp) })); } } - v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); + v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); } + Array_string _t30 = invalidations; + return _t30; } VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path) { @@ -96961,7 +99480,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, for (int _t6 = 0; _t6 < ast_file->imports.len; ++_t6) { v__ast__Import imp_stmt = ((v__ast__Import*)ast_file->imports.data)[_t6]; string imp = imp_stmt.mod; - if (string__eq(imp, _SLIT("strconv")) || string__eq(imp, _SLIT("strings")) || string__eq(imp, _SLIT("dlmalloc"))) { + if (v__util__module_is_builtin(imp)) { continue; } if (Array_string_contains(built_modules, imp)) { @@ -96990,6 +99509,150 @@ VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, _PUSH_MANY(&b->ccoptions.post_args, (libs), _t10, Array_string); } +bool v__builder__Builder_should_rebuild(v__builder__Builder* b) { + string exe_name = b->pref->out_name; + #if defined(_WIN32) + { + exe_name = string__plus(exe_name, _SLIT(".exe")); + } + #endif + if (!os__is_file(exe_name)) { + bool _t1 = true; + return _t1; + } + if (!b->pref->is_crun) { + bool _t2 = true; + return _t2; + } + Array_string v_program_files = __new_array_with_default(0, 0, sizeof(string), 0); + bool is_file = os__is_file(b->pref->path); + bool is_dir = os__is_dir(b->pref->path); + if (is_file) { + array_push((array*)&v_program_files, _MOV((string[]){ string_clone(b->pref->path) })); + } else if (is_dir) { + _PUSH_MANY(&v_program_files, (v__builder__Builder_v_files_from_dir(b, b->pref->path)), _t4, Array_string); + } + qsort(v_program_files.data, v_program_files.len, v_program_files.element_size, (int (*)(const void *, const void *))&compare_14016397514164073915_string); + b->crun_cache_keys = v_program_files; + array_push((array*)&b->crun_cache_keys, _MOV((string[]){ string_clone(exe_name) })); + i64 exe_stamp = os__file_last_mod_unix(exe_name); + i64 source_stamp = v__builder__most_recent_timestamp(v_program_files); + if (exe_stamp <= source_stamp) { + bool _t6 = true; + return _t6; + } + v__vcache__CacheManager cm = v__vcache__new_cache_manager(b->crun_cache_keys); + _option_string _t7 = v__vcache__CacheManager_load(&cm, _SLIT(".build_options"), _SLIT(".crun")); + if (_t7.state != 0) { /*or block*/ + IError err = _t7.err; + bool _t8 = true; + return _t8; + } + + string sbuild_options = (*(string*)_t7.data); + if (!string__eq(sbuild_options, Array_string_join(b->pref->build_options, _SLIT("\n")))) { + bool _t9 = true; + return _t9; + } + _option_string _t10 = v__vcache__CacheManager_load(&cm, _SLIT(".dependencies"), _SLIT(".crun")); + if (_t10.state != 0) { /*or block*/ + IError err = _t10.err; + bool _t11 = true; + return _t11; + } + + string sdependencies = (*(string*)_t10.data); + Array_string dependencies = string_split(sdependencies, _SLIT("\n")); + i64 dependencies_stamp = v__builder__most_recent_timestamp(dependencies); + if (dependencies_stamp < exe_stamp) { + bool _t12 = false; + return _t12; + } + bool _t13 = true; + return _t13; +} + +VV_LOCAL_SYMBOL i64 v__builder__most_recent_timestamp(Array_string files) { + i64 res = ((i64)(0)); + for (int _t1 = 0; _t1 < files.len; ++_t1) { + string f = ((string*)files.data)[_t1]; + i64 f_stamp = os__file_last_mod_unix(f); + if (res <= f_stamp) { + res = f_stamp; + } + } + i64 _t2 = res; + return _t2; +} + +void v__builder__Builder_rebuild(v__builder__Builder* b, void (*backend_cb)(v__builder__Builder* b)) { + time__StopWatch sw = time__new_stopwatch(((time__StopWatchOptions){.auto_start = true,})); + backend_cb(b); + if (b->pref->is_crun) { + v__vcache__CacheManager cm = v__vcache__new_cache_manager(b->crun_cache_keys); + Array_string _t1 = {0}; + Array_v__ast__File_ptr _t1_orig = b->parsed_files; + int _t1_len = _t1_orig.len; + _t1 = __new_array(0, _t1_len, sizeof(string)); + + for (int _t2 = 0; _t2 < _t1_len; ++_t2) { + v__ast__File* it = ((v__ast__File**) _t1_orig.data)[_t2]; + string ti = it->path; + array_push((array*)&_t1, &ti); + } + Array_string dependency_files =_t1; + _option_string _t3 = v__vcache__CacheManager_save(&cm, _SLIT(".dependencies"), _SLIT(".crun"), Array_string_join(dependency_files, _SLIT("\n"))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + } + + (*(string*)_t3.data); + _option_string _t4 = v__vcache__CacheManager_save(&cm, _SLIT(".build_options"), _SLIT(".crun"), Array_string_join(b->pref->build_options, _SLIT("\n"))); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + } + + (*(string*)_t4.data); + } + v__util__Timers* timers = v__util__get_timers(); + v__util__Timers_show_remaining(timers); + if (b->pref->is_stats) { + i64 compilation_time_micros = 1 + time__Duration_microseconds(time__StopWatch_elapsed(sw)); + string scompilation_time_ms = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*102 &f64*/0xc062d, {.d_f64 = ((f64)(compilation_time_micros)) / 1000.0}}, {_SLIT0, 0, { .d_c = 0 }}}))); + int all_v_source_lines = 0; + int all_v_source_bytes = 0; + for (int _t5 = 0; _t5 < b->parsed_files.len; ++_t5) { + v__ast__File* pf = ((v__ast__File**)b->parsed_files.data)[_t5]; + all_v_source_lines += pf->nr_lines; + all_v_source_bytes += pf->nr_bytes; + } + string sall_v_source_lines = int_str(all_v_source_lines); + string sall_v_source_bytes = int_str(all_v_source_bytes); + sall_v_source_lines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_lines}}, {_SLIT0, 0, { .d_c = 0 }}}))); + sall_v_source_bytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_bytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" V source code size: "), /*115 &string*/0xfe10, {.d_s = sall_v_source_lines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sall_v_source_bytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); + string slines = int_str(b->stats_lines); + string sbytes = int_str(b->stats_bytes); + slines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = slines}}, {_SLIT0, 0, { .d_c = 0 }}}))); + sbytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sbytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("generated target code size: "), /*115 &string*/0xfe10, {.d_s = slines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sbytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); + int vlines_per_second = ((int)(1000000.0 * ((f64)(all_v_source_lines)) / ((f64)(compilation_time_micros)))); + string svlines_per_second = v__util__bold(int_str(vlines_per_second)); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("compilation took: "), /*115 &string*/0xfe10, {.d_s = scompilation_time_ms}}, {_SLIT(" ms, compilation speed: "), /*115 &string*/0xfe10, {.d_s = svlines_per_second}}, {_SLIT(" vlines/s"), 0, { .d_c = 0 }}}))); + } +} + +string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix) { + string vtmp = v__util__get_vtmp_folder(); + string uniq = _SLIT(""); + if (!b->pref->reuse_tmpc) { + uniq = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*117 &u64*/0xfe08, {.d_u64 = rand__u64()}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + string fname = string__plus(os__file_name(os__real_path(base_file_name)), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = uniq}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = postfix}}, {_SLIT0, 0, { .d_c = 0 }}}))); + string _t1 = os__real_path(os__join_path(vtmp, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){fname})))); + return _t1; +} + void v__builder__cbuilder__start(void) { Array_string _t1; Array_string args_and_flags = (_t1 = v__util__join_env_vflags_and_os_args(), array_slice(_t1, 1, _t1.len)); @@ -97129,9 +99792,27 @@ v__util__Timers* timers; return; } - if (string__eq(command, _SLIT("help"))) { + if (string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("crun")) || string__eq(command, _SLIT("build")) || string__eq(command, _SLIT("build-module"))) { + main__rebuild(prefs); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); + } + // Defer end + return; + } + else if (string__eq(command, _SLIT("help"))) { main__invoke_help_and_exit(args); } + else if (string__eq(command, _SLIT("version"))) { + println(v__util__version__full_v_version(prefs->is_verbose)); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); + } + // Defer end + return; + } else if (string__eq(command, _SLIT("new")) || string__eq(command, _SLIT("init"))) { Array_string _t7; v__util__launch_tool(prefs->is_verbose, _SLIT("vcreate"), (_t7 = _const_os__args, array_slice(_t7, 1, _t7.len))); @@ -97143,11 +99824,6 @@ v__util__Timers* timers; // Defer end return; } - else if (string__eq(command, _SLIT("translate"))) { - eprintln(_SLIT("Translating C to V will be available in V 0.3")); - _v_exit(1); - VUNREACHABLE(); - } else if (string__eq(command, _SLIT("install")) || string__eq(command, _SLIT("list")) || string__eq(command, _SLIT("outdated")) || string__eq(command, _SLIT("remove")) || string__eq(command, _SLIT("search")) || string__eq(command, _SLIT("show")) || string__eq(command, _SLIT("update")) || string__eq(command, _SLIT("upgrade"))) { Array_string _t8; v__util__launch_tool(prefs->is_verbose, _SLIT("vpm"), (_t8 = _const_os__args, array_slice(_t8, 1, _t8.len))); @@ -97173,55 +99849,27 @@ v__util__Timers* timers; _v_exit(1); VUNREACHABLE(); } - else if (string__eq(command, _SLIT("version"))) { - println(v__util__version__full_v_version(prefs->is_verbose)); - // Defer begin - if (main__main_defer_0) { - v__util__Timers_show(timers, _SLIT("v total")); - } - // Defer end - return; + else if (string__eq(command, _SLIT("translate"))) { + eprintln(_SLIT("Translating C to V will be available in V 0.3")); + _v_exit(1); + VUNREACHABLE(); } else { - }; - if ((string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("build")) || string__eq(command, _SLIT("build-module"))) || string_ends_with(command, _SLIT(".v")) || os__exists(command)) { - - if (prefs->backend == (v__pref__Backend__c)) { - #if defined(CUSTOM_DEFINE_no_bootstrapv) - { - Array_string _t10; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/c_builder"), (_t10 = _const_os__args, array_slice(_t10, 1, _t10.len))); - VUNREACHABLE(); + if (string_ends_with(command, _SLIT(".v")) || os__exists(command)) { + main__rebuild(prefs); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); } - #endif - v__builder__compile(_SLIT("build"), prefs, (voidptr)v__builder__cbuilder__compile_c); + // Defer end + return; } - else if (prefs->backend == (v__pref__Backend__js_node) || prefs->backend == (v__pref__Backend__js_freestanding) || prefs->backend == (v__pref__Backend__js_browser)) { - Array_string _t11; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/js_builder"), (_t11 = _const_os__args, array_slice(_t11, 1, _t11.len))); - VUNREACHABLE(); - } - else if (prefs->backend == (v__pref__Backend__native)) { - Array_string _t12; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/native_builder"), (_t12 = _const_os__args, array_slice(_t12, 1, _t12.len))); - VUNREACHABLE(); - } - else if (prefs->backend == (v__pref__Backend__interpret)) { - Array_string _t13; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/interpret_builder"), (_t13 = _const_os__args, array_slice(_t13, 1, _t13.len))); - VUNREACHABLE(); - }; - // Defer begin - if (main__main_defer_0) { - v__util__Timers_show(timers, _SLIT("v total")); - } - // Defer end - return; - } + }; if (prefs->is_help) { main__invoke_help_and_exit(args); } - eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("v "), /*115 &string*/0xfe10, {.d_s = command}}, {_SLIT(": unknown command\nRun "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(" for usage."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("v "), /*115 &string*/0xfe10, {.d_s = command}}, {_SLIT(": unknown command"), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Run "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(" for usage."), 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); } @@ -97236,32 +99884,61 @@ VV_LOCAL_SYMBOL void main__invoke_help_and_exit(Array_string remaining) { } else { }; - println( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(": provide only one help topic."), 0, { .d_c = 0 }}}))); - println( str_intp(2, _MOV((StrIntpData[]){{_SLIT("For usage information, use "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(": provide only one help topic."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("For usage information, use "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); } +VV_LOCAL_SYMBOL void main__rebuild(v__pref__Preferences* prefs) { + + if (prefs->backend == (v__pref__Backend__c)) { + #if defined(CUSTOM_DEFINE_no_bootstrapv) + { + Array_string _t1; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/c_builder"), (_t1 = _const_os__args, array_slice(_t1, 1, _t1.len))); + VUNREACHABLE(); + } + #endif + v__builder__compile(_SLIT("build"), prefs, (voidptr)v__builder__cbuilder__compile_c); + } + else if (prefs->backend == (v__pref__Backend__js_node) || prefs->backend == (v__pref__Backend__js_freestanding) || prefs->backend == (v__pref__Backend__js_browser)) { + Array_string _t2; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/js_builder"), (_t2 = _const_os__args, array_slice(_t2, 1, _t2.len))); + VUNREACHABLE(); + } + else if (prefs->backend == (v__pref__Backend__native)) { + Array_string _t3; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/native_builder"), (_t3 = _const_os__args, array_slice(_t3, 1, _t3.len))); + VUNREACHABLE(); + } + else if (prefs->backend == (v__pref__Backend__interpret)) { + Array_string _t4; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/interpret_builder"), (_t4 = _const_os__args, array_slice(_t4, 1, _t4.len))); + VUNREACHABLE(); + }; +} + void _vinit(int ___argc, voidptr ___argv) { #if __STDC_HOSTED__ == 1 signal(11, v_segmentation_fault_handler); #endif as_cast_type_indexes = new_array_from_c_array(102, 102, sizeof(VCastTypeIndexName), _MOV((VCastTypeIndexName[102]){ (VCastTypeIndexName){.tindex = 0, .tname = _SLIT("unknown")} - , (VCastTypeIndexName){.tindex = 433, .tname = _SLIT("v.ast.Aggregate")} - , (VCastTypeIndexName){.tindex = 435, .tname = _SLIT("v.ast.Alias")} + , (VCastTypeIndexName){.tindex = 434, .tname = _SLIT("v.ast.Aggregate")} + , (VCastTypeIndexName){.tindex = 436, .tname = _SLIT("v.ast.Alias")} , (VCastTypeIndexName){.tindex = 415, .tname = _SLIT("v.ast.Array")} - , (VCastTypeIndexName){.tindex = 443, .tname = _SLIT("v.ast.ArrayFixed")} - , (VCastTypeIndexName){.tindex = 444, .tname = _SLIT("v.ast.Chan")} - , (VCastTypeIndexName){.tindex = 449, .tname = _SLIT("v.ast.Enum")} - , (VCastTypeIndexName){.tindex = 447, .tname = _SLIT("v.ast.FnType")} - , (VCastTypeIndexName){.tindex = 448, .tname = _SLIT("v.ast.GenericInst")} - , (VCastTypeIndexName){.tindex = 438, .tname = _SLIT("v.ast.Interface")} + , (VCastTypeIndexName){.tindex = 444, .tname = _SLIT("v.ast.ArrayFixed")} + , (VCastTypeIndexName){.tindex = 445, .tname = _SLIT("v.ast.Chan")} + , (VCastTypeIndexName){.tindex = 450, .tname = _SLIT("v.ast.Enum")} + , (VCastTypeIndexName){.tindex = 448, .tname = _SLIT("v.ast.FnType")} + , (VCastTypeIndexName){.tindex = 449, .tname = _SLIT("v.ast.GenericInst")} + , (VCastTypeIndexName){.tindex = 439, .tname = _SLIT("v.ast.Interface")} , (VCastTypeIndexName){.tindex = 416, .tname = _SLIT("v.ast.Map")} - , (VCastTypeIndexName){.tindex = 446, .tname = _SLIT("v.ast.MultiReturn")} + , (VCastTypeIndexName){.tindex = 447, .tname = _SLIT("v.ast.MultiReturn")} , (VCastTypeIndexName){.tindex = 420, .tname = _SLIT("v.ast.Struct")} - , (VCastTypeIndexName){.tindex = 439, .tname = _SLIT("v.ast.SumType")} - , (VCastTypeIndexName){.tindex = 445, .tname = _SLIT("v.ast.Thread")} + , (VCastTypeIndexName){.tindex = 440, .tname = _SLIT("v.ast.SumType")} + , (VCastTypeIndexName){.tindex = 446, .tname = _SLIT("v.ast.Thread")} , (VCastTypeIndexName){.tindex = 379, .tname = _SLIT("v.ast.IdentFn")} , (VCastTypeIndexName){.tindex = 380, .tname = _SLIT("v.ast.IdentVar")} , (VCastTypeIndexName){.tindex = 248, .tname = _SLIT("v.ast.AnonFn")} @@ -97836,7 +100513,6 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__util__const_tabs = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT(""), _SLIT("\t"), _SLIT("\t\t"), _SLIT("\t\t\t"), _SLIT("\t\t\t\t"), _SLIT("\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t\t")})); - _const_v__util__builtin_module_names = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("builtin"), _SLIT("strconv"), _SLIT("strings"), _SLIT("dlmalloc"), _SLIT("math")})); lines_cache = ((v__util__LinesCache*)memdup(&(v__util__LinesCache){.lines = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__util__LinesCache))); // 3global g_timers = v__util__new_timers(((v__util__TimerParams){.should_print = false,.label = _SLIT("g_timers"),})); // 3global } @@ -98107,7 +100783,7 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), string_clone(_const_v__gen__c__option_name), string_clone(_const_v__gen__c__result_name)})); - _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #ifdef V_USE_SIGNAL_H\n #include // signal and SIGSEGV for segmentation fault handler\n #endif\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); _const_v__gen__c__skip_struct_init = new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("struct stat"), _SLIT("struct addrinfo")})); } diff --git a/v_win.c b/v_win.c index bebb9a6..a1a188c 100644 --- a/v_win.c +++ b/v_win.c @@ -1,13 +1,15 @@ -#define V_COMMIT_HASH "3bc50721e" +#define V_COMMIT_HASH "5b16d5fdf" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "585cb9ec2" + #define V_COMMIT_HASH "3bc50721e" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "3bc5072" + #define V_CURRENT_COMMIT_HASH "5b16d5f" #endif +#define V_USE_SIGNAL_H + // V comptime_definitions: #define __VTHREADS__ (1) #define _VAUTOFREE (0) @@ -817,7 +819,9 @@ voidptr memdup(voidptr src, int sz); #include // _waccess #include // _wgetcwd + #ifdef V_USE_SIGNAL_H #include // signal and SIGSEGV for segmentation fault handler + #endif #ifdef _MSC_VER // On MSVC these are the same (as long as /volatile:ms is passed) @@ -2369,6 +2373,7 @@ typedef map Map_string_Array_Array_v__ast__Type; typedef map Map_int_v__ast__InterfaceDecl; typedef map Map_string_v__ast__EnumDecl; typedef map Map_string_time__Time; +typedef map Map_u64_string; typedef array Array_v__ast__Fn; typedef map Map_string_v__ast__StructField; typedef array Array_v__ast__Kind; @@ -2925,20 +2930,20 @@ struct v__ast__AsmArg { // Union sum type v__ast__TypeInfo = -// | 472 = v__ast__Aggregate -// | 474 = v__ast__Alias +// | 473 = v__ast__Aggregate +// | 475 = v__ast__Alias // | 454 = v__ast__Array -// | 482 = v__ast__ArrayFixed -// | 483 = v__ast__Chan -// | 488 = v__ast__Enum -// | 486 = v__ast__FnType -// | 487 = v__ast__GenericInst -// | 477 = v__ast__Interface +// | 483 = v__ast__ArrayFixed +// | 484 = v__ast__Chan +// | 489 = v__ast__Enum +// | 487 = v__ast__FnType +// | 488 = v__ast__GenericInst +// | 478 = v__ast__Interface // | 455 = v__ast__Map -// | 485 = v__ast__MultiReturn +// | 486 = v__ast__MultiReturn // | 459 = v__ast__Struct -// | 478 = v__ast__SumType -// | 484 = v__ast__Thread +// | 479 = v__ast__SumType +// | 485 = v__ast__Thread struct v__ast__TypeInfo { union { v__ast__Aggregate* _v__ast__Aggregate; @@ -3435,6 +3440,7 @@ struct v__ast__Table { Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + Map_u64_string cached_type_to_str; Array_v__ast__TypeSymbol_ptr type_symbols; Array_string imports; Array_string modules; @@ -3880,6 +3886,7 @@ struct v__scanner__Scanner { int nr_lines; int tidx; int eofs; + int inter_cbr_count; u8 quote; u8 inter_quote; v__scanner__CommentsMode comments_mode; @@ -4193,6 +4200,113 @@ struct StrIntpData { +struct v__pref__Preferences { + v__vcache__CacheManager cache_manager; + Array_string profile_fns; + Array_string lookup_path; + Array_string run_only; + Array_string compile_defines; + Array_string compile_defines_all; + Array_string run_args; + Array_string printfn_list; + Array_string cleanup_files; + Array_string build_options; + string test_runner; + string profile_file; + string dump_c_flags; + string dump_modules; + string dump_files; + string cflags; + string ccompiler; + string third_party_option; + string bare_builtin_dir; + string custom_prelude; + string cmain; + string vroot; + string out_name_c; + string out_name; + string path; + int message_limit; + int checker_match_exhaustive_cutoff_limit; + int thread_stack_size; + v__pref__OS os; + v__pref__Arch arch; + v__pref__Backend backend; + v__pref__CompilerType ccompiler_type; + v__pref__GarbageCollectionMode gc_mode; + v__pref__ColorOutput use_color; + v__pref__AssertFailureMode assert_failure_mode; + v__pref__BuildMode build_mode; + v__pref__OutputMode output_mode; + bool is_verbose; + bool is_glibc; + bool is_musl; + bool is_test; + bool is_script; + bool is_vsh; + bool is_livemain; + bool is_liveshared; + bool is_shared; + bool is_o; + bool is_prof; + bool is_prod; + bool is_repl; + bool is_run; + bool is_crun; + bool is_debug; + bool is_vlines; + bool is_stats; + bool is_fmt; + bool is_vet; + bool is_vweb; + bool is_ios_simulator; + bool is_apk; + bool is_help; + bool is_cstrict; + bool profile_no_inline; + bool translated; + bool obfuscate; + bool sanitize; + bool sourcemap; + bool sourcemap_inline; + bool sourcemap_src_included; + bool show_cc; + bool show_c_output; + bool show_callgraph; + bool show_depgraph; + bool use_cache; + bool retry_compilation; + bool m64; + bool building_v; + bool autofree; + bool compress; + bool no_builtin; + bool enable_globals; + bool is_bare; + bool no_preludes; + bool output_cross_c; + bool output_es5; + bool prealloc; + bool print_v_files; + bool skip_running; + bool skip_warnings; + bool warn_impure_v; + bool warns_are_errors; + bool fatal_errors; + bool reuse_tmpc; + bool no_rsp; + bool no_std; + bool no_parallel; + bool only_check_syntax; + bool check_only; + bool experimental; + bool skip_unused; + bool show_timings; + bool nofloat; +}; + + + struct os__FileMode { os__FileType typ; os__FilePermission owner; @@ -4249,111 +4363,6 @@ struct os__WProcess { -struct v__pref__Preferences { - v__vcache__CacheManager cache_manager; - Array_string profile_fns; - Array_string lookup_path; - Array_string run_only; - Array_string compile_defines; - Array_string compile_defines_all; - Array_string run_args; - Array_string printfn_list; - Array_string cleanup_files; - Array_string build_options; - string test_runner; - string profile_file; - string dump_c_flags; - string dump_modules; - string dump_files; - string cflags; - string ccompiler; - string third_party_option; - string bare_builtin_dir; - string custom_prelude; - string vroot; - string out_name_c; - string out_name; - string path; - int message_limit; - int checker_match_exhaustive_cutoff_limit; - int thread_stack_size; - v__pref__OS os; - v__pref__Arch arch; - v__pref__Backend backend; - v__pref__CompilerType ccompiler_type; - v__pref__GarbageCollectionMode gc_mode; - v__pref__ColorOutput use_color; - v__pref__AssertFailureMode assert_failure_mode; - v__pref__BuildMode build_mode; - v__pref__OutputMode output_mode; - bool is_verbose; - bool is_glibc; - bool is_musl; - bool is_test; - bool is_script; - bool is_vsh; - bool is_livemain; - bool is_liveshared; - bool is_shared; - bool is_o; - bool is_prof; - bool is_prod; - bool is_repl; - bool is_run; - bool is_debug; - bool is_vlines; - bool is_stats; - bool is_fmt; - bool is_vet; - bool is_vweb; - bool is_ios_simulator; - bool is_apk; - bool is_help; - bool is_cstrict; - bool profile_no_inline; - bool translated; - bool obfuscate; - bool sanitize; - bool sourcemap; - bool sourcemap_inline; - bool sourcemap_src_included; - bool show_cc; - bool show_c_output; - bool show_callgraph; - bool show_depgraph; - bool use_cache; - bool retry_compilation; - bool m64; - bool building_v; - bool autofree; - bool compress; - bool no_builtin; - bool enable_globals; - bool is_bare; - bool no_preludes; - bool output_cross_c; - bool output_es5; - bool prealloc; - bool print_v_files; - bool skip_running; - bool skip_warnings; - bool warn_impure_v; - bool warns_are_errors; - bool fatal_errors; - bool reuse_tmpc; - bool no_rsp; - bool no_std; - bool no_parallel; - bool only_check_syntax; - bool check_only; - bool experimental; - bool skip_unused; - bool show_timings; - bool nofloat; -}; - - - struct v__builder__Builder { string compiled_dir; string module_path; @@ -4375,6 +4384,7 @@ struct v__builder__Builder { Map_string_Array_string mod_invalidates_paths; Map_string_Array_string mod_invalidates_mods; Map_string_Array_string path_invalidates_mods; + Array_string crun_cache_keys; }; @@ -5290,6 +5300,8 @@ struct v__ast__StructField { Array_v__ast__Comment comments; Array_v__ast__Attr attrs; string default_val; + string deprecation_msg; + string deprecated_after; v__ast__Expr default_expr; string name; v__token__Pos pos; @@ -5302,6 +5314,7 @@ struct v__ast__StructField { bool is_mut; bool is_global; bool is_volatile; + bool is_deprecated; }; @@ -5488,15 +5501,15 @@ struct v__parser__Parser { Array_v__ast__Import ast_imports; Array_string used_imports; Array_string auto_imports; - Array_v__errors__Error errors; - Array_v__errors__Warning warnings; - Array_v__errors__Notice notices; - Array_v__vet__Error vet_errors; Array_string label_names; Array_string global_labels; Array_v__ast__Ident defer_vars; Array_v__ast__Type struct_init_generic_types; Array_v__ast__Comment if_cond_comments; + Array_v__errors__Error errors; + Array_v__errors__Warning warnings; + Array_v__errors__Notice notices; + Array_v__vet__Error vet_errors; string file_base; string file_name; string file_name_dir; @@ -5506,9 +5519,9 @@ struct v__parser__Parser { string cur_fn_name; string codegen_text; v__pref__Preferences* pref; - v__scanner__Scanner* scanner; v__ast__Table* table; v__ast__Scope* scope; + v__scanner__Scanner* scanner; int expr_level; int n_asm; v__ast__Language file_backend_mode; @@ -6056,6 +6069,7 @@ struct v__gen__c__Gen { Map_int_bool autofree_methods; Map_int_bool generated_free_methods; Array_string autofree_scope_stmts; + bool use_segfault_handler; }; @@ -6091,12 +6105,12 @@ struct v__checker__Checker { Array_string error_details; Array_v__ast__Type vweb_gen_types; string mod; - string const_decl; string vmod_file_content; string loop_label; v__pref__Preferences* pref; v__ast__Table* table; v__ast__File* file; + v__ast__ConstField* const_var; v__util__Timers* timers; v__ast__Scope* fn_scope; v__token__Pos smartcast_mut_pos; @@ -6884,6 +6898,10 @@ int math__bits__ones_count_8(u8 x); int math__bits__ones_count_16(u16 x); int math__bits__ones_count_32(u32 x); int math__bits__ones_count_64(u64 x); +u8 _const_math__bits__n8 = 8; // precomputed +u16 _const_math__bits__n16 = 16; // precomputed +u32 _const_math__bits__n32 = 32; // precomputed +u64 _const_math__bits__n64 = 64U; // precomputed u8 math__bits__rotate_left_8(u8 x, int k); u16 math__bits__rotate_left_16(u16 x, int k); u32 math__bits__rotate_left_32(u32 x, int k); @@ -6982,7 +7000,7 @@ void strconv__format_str_sb(string s, strconv__BF_param p, strings__Builder* sb) #define _const_strconv__max_size_f64_char 32 string _const_strconv__digit_pairs; // a string literal, inited later void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res); -VV_LOCAL_SYMBOL string strconv__f64_to_str_lnd1(f64 f, int dec_digit); +string strconv__f64_to_str_lnd1(f64 f, int dec_digit); string strconv__format_fl(f64 f, strconv__BF_param p); string strconv__format_es(f64 f, strconv__BF_param p); string strconv__remove_tail_zeros(string s); @@ -8003,6 +8021,7 @@ string _const_os__dot_str; // a string literal, inited later bool os__is_abs_path(string path); string os__abs_path(string path); string os__norm_path(string path); +_option_string os__existing_path(string path); VV_LOCAL_SYMBOL string os__clean_path(string path); VV_LOCAL_SYMBOL int os__win_volume_len(string path); VV_LOCAL_SYMBOL string os__get_volume(string path); @@ -8012,6 +8031,7 @@ VV_LOCAL_SYMBOL bool os__has_drive_letter(string path); VV_LOCAL_SYMBOL bool os__starts_w_slash_slash(string path); VV_LOCAL_SYMBOL bool os__is_drive_rooted(string path); VV_LOCAL_SYMBOL bool os__is_normal_path(string path); +VV_LOCAL_SYMBOL bool os__is_curr_dir_ref(int byte_one, int byte_two, int byte_three); u32 os__FilePermission_bitmask(os__FilePermission p); u32 os__FileMode_bitmask(os__FileMode m); os__FileMode os__inode(string path); @@ -8531,6 +8551,7 @@ _option_v__pref__Backend v__pref__backend_from_string(string s); v__pref__CompilerType v__pref__cc_from_string(string cc_str); v__pref__Arch v__pref__get_host_arch(void); VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define); +VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__Preferences* prefs, Array_string define_parts); Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_); VV_LOCAL_SYMBOL int compare_11540237029762306605_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; @@ -8679,7 +8700,6 @@ Array_string _const_v__util__builtin_module_parts; // inited later Array_string _const_v__util__bundle_modules; // inited later Map_string_Array_string _const_v__util__external_module_dependencies_for_tool; // inited later Array_string _const_v__util__const_tabs; // inited later -Array_string _const_v__util__builtin_module_names; // inited later bool v__util__module_is_builtin(string mod); string v__util__tabs(int n); void v__util__set_vroot_folder(string vroot_path); @@ -8740,7 +8760,7 @@ bool v__ast__Expr_is_blank_ident(v__ast__Expr expr); v__token__Pos v__ast__Expr_pos(v__ast__Expr expr); bool v__ast__Expr_is_lvalue(v__ast__Expr expr); bool v__ast__Expr_is_expr(v__ast__Expr expr); -bool v__ast__Expr_is_lit(v__ast__Expr expr); +bool v__ast__Expr_is_pure_literal(v__ast__Expr expr); bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr); bool v__ast__Expr_is_lockable(v__ast__Expr* e); _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt); @@ -9074,6 +9094,7 @@ bool v__ast__Interface_defines_method(v__ast__Interface* i, string name); void v__checker__Checker_assign_stmt(v__checker__Checker* c, v__ast__AssignStmt* node); bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg); +VV_LOCAL_SYMBOL multi_return_string_string v__checker__Checker_get_string_names_of(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected); VV_LOCAL_SYMBOL bool v__checker__Checker_check_same_module(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym); @@ -9222,6 +9243,8 @@ VV_LOCAL_SYMBOL bool v__checker__has_top_return(Array_v__ast__Stmt stmts); VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Checker* c, v__ast__FnDecl* node); VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts); VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr); +VV_LOCAL_SYMBOL int v__checker__imin(int a, int b); +VV_LOCAL_SYMBOL int v__checker__imax(int a, int b); u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp, v__ast__Type typ); v__ast__Type v__checker__Checker_string_inter_lit(v__checker__Checker* c, v__ast__StringInterLiteral* node); string _const_v__checker__unicode_lit_overflow_message; // a string literal, inited later @@ -9503,6 +9526,7 @@ string _const_v__gen__c__c_bare_headers; // str inited later string _const_v__gen__c__c_wyhash_headers; // a string literal, inited later void v__gen__c__Gen_gen_c_main(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_vlines_reset(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_only_header(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g); void v__gen__c__Gen_gen_c_main_footer(v__gen__c__Gen* g); @@ -9527,7 +9551,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_ctemp_var(v__gen__c__Gen* g, v__ast__CTe VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr(v__gen__c__Gen* g, v__ast__DumpExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g); VV_LOCAL_SYMBOL bool v__gen__c__Gen_writeln_fn_header(v__gen__c__Gen* g, string s, strings__Builder* sb); -VV_LOCAL_SYMBOL bool v__gen__c__Gen_embed_file_is_prod_mode(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL bool v__gen__c__Gen_should_really_embed_file(v__gen__c__Gen* g); +VV_LOCAL_SYMBOL void v__gen__c__Gen_handle_embedded_files_finish(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embed_file_init(v__gen__c__Gen* g, v__ast__ComptimeCall* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_data(v__gen__c__Gen* g); @@ -9788,6 +9813,8 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check(v__parser__Parser* p, v__token__Kin VV_LOCAL_SYMBOL string v__parser__Parser_check_js_name(v__parser__Parser* p); VV_LOCAL_SYMBOL string v__parser__Parser_check_name(v__parser__Parser* p); v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p); +VV_LOCAL_SYMBOL bool v__parser__comptime_if_expr_contains_top_stmt(v__ast__IfExpr if_expr); +VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_other_stmts(v__parser__Parser* p, v__ast__Stmt cur_stmt); v__ast__Comment v__parser__Parser_check_comment(v__parser__Parser* p); v__ast__Comment v__parser__Parser_comment(v__parser__Parser* p); v__ast__ExprStmt v__parser__Parser_comment_stmt(v__parser__Parser* p); @@ -9903,7 +9930,7 @@ VV_LOCAL_SYMBOL Array_string v__builder__error_context_lines(string text, string VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_os_cflags(v__builder__Builder* v); VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_rest_of_module_cflags(v__builder__Builder* v, v__cflag__CFlag* c); void v__builder__compile(string command, v__pref__Preferences* pref, void (*backend_cb)(v__builder__Builder* b)); -string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix); +VV_LOCAL_SYMBOL void v__builder__check_if_output_folder_is_writable(v__pref__Preferences* pref); VV_LOCAL_SYMBOL void v__builder__Builder_myfree(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_exit_on_invalid_syntax(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_run_compiled_executable_and_exit(v__builder__Builder* b); @@ -9936,9 +9963,19 @@ v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r); VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r); void v__builder__Builder_rebuild_modules(v__builder__Builder* b); +Array_string v__builder__Builder_find_invalidated_modules_by_files(v__builder__Builder* b, Array_string all_files); VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL string v__builder__Builder_rebuild_cached_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, string vexe); +bool v__builder__Builder_should_rebuild(v__builder__Builder* b); +VV_LOCAL_SYMBOL int compare_14016397514164073915_string(string* a, string* b) { + if (string__lt(*a, *b)) return -1; + else return 1; +} + +VV_LOCAL_SYMBOL i64 v__builder__most_recent_timestamp(Array_string files); +void v__builder__Builder_rebuild(v__builder__Builder* b, void (*backend_cb)(v__builder__Builder* b)); +string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix); void v__builder__cbuilder__start(void); void v__builder__cbuilder__compile_c(v__builder__Builder* b); string v__builder__cbuilder__gen_c(v__builder__Builder* b, Array_string v_files); @@ -9947,6 +9984,7 @@ Array_string _const_main__external_tools; // inited later Array_string _const_main__list_of_flags_that_allow_duplicates; // inited later VV_LOCAL_SYMBOL void main__main(void); VV_LOCAL_SYMBOL void main__invoke_help_and_exit(Array_string remaining); +VV_LOCAL_SYMBOL void main__rebuild(v__pref__Preferences* prefs); static string time__FormatTime_str(time__FormatTime it); // auto static string time__FormatDate_str(time__FormatDate it); // auto @@ -9962,6 +10000,7 @@ static string v__ast__Fn_str(v__ast__Fn it); // auto static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count); // auto static string v__ast__Language_str(v__ast__Language it); // auto static string v__ast__IdentKind_str(v__ast__IdentKind it); // auto +static string anon_fn_v__ast__constdecl_str(); // auto static string Array_v__ast__Attr_str(Array_v__ast__Attr a); // auto static string indent_Array_v__ast__Attr_str(Array_v__ast__Attr a, int indent_count); // auto static string v__token__Pos_str(v__token__Pos it); // auto @@ -10033,11 +10072,168 @@ static bool v__ast__Type_alias_eq(v__ast__Type a, v__ast__Type b); // auto static bool Array_string_arr_eq(Array_string a, Array_string b); // auto static bool v__token__Pos_struct_eq(v__token__Pos a, v__token__Pos b); // auto static bool Array_v__ast__Type_arr_eq(Array_v__ast__Type a, Array_v__ast__Type b); // auto -static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b); // auto -static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b); // auto -static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b); // auto +static bool v__ast__Stmt_sumtype_eq(v__ast__Stmt a, v__ast__Stmt b); // auto +static bool v__ast__AsmStmt_struct_eq(v__ast__AsmStmt a, v__ast__AsmStmt b); // auto +static bool Array_v__ast__AsmClobbered_arr_eq(Array_v__ast__AsmClobbered a, Array_v__ast__AsmClobbered b); // auto +static bool v__ast__AsmClobbered_struct_eq(v__ast__AsmClobbered a, v__ast__AsmClobbered b); // auto +static bool v__ast__AsmRegister_struct_eq(v__ast__AsmRegister a, v__ast__AsmRegister b); // auto +static bool Array_v__ast__Comment_arr_eq(Array_v__ast__Comment a, Array_v__ast__Comment b); // auto +static bool v__ast__Comment_struct_eq(v__ast__Comment a, v__ast__Comment b); // auto +static bool Array_v__ast__AsmTemplate_arr_eq(Array_v__ast__AsmTemplate a, Array_v__ast__AsmTemplate b); // auto +static bool v__ast__AsmTemplate_struct_eq(v__ast__AsmTemplate a, v__ast__AsmTemplate b); // auto +static bool Array_v__ast__AsmArg_arr_eq(Array_v__ast__AsmArg a, Array_v__ast__AsmArg b); // auto +static bool v__ast__AsmArg_sumtype_eq(v__ast__AsmArg a, v__ast__AsmArg b); // auto +static bool v__ast__AsmAddressing_struct_eq(v__ast__AsmAddressing a, v__ast__AsmAddressing b); // auto +static bool v__ast__AsmAlias_struct_eq(v__ast__AsmAlias a, v__ast__AsmAlias b); // auto +static bool v__ast__AsmDisp_struct_eq(v__ast__AsmDisp a, v__ast__AsmDisp b); // auto +static bool v__ast__BoolLiteral_struct_eq(v__ast__BoolLiteral a, v__ast__BoolLiteral b); // auto +static bool v__ast__CharLiteral_struct_eq(v__ast__CharLiteral a, v__ast__CharLiteral b); // auto +static bool v__ast__FloatLiteral_struct_eq(v__ast__FloatLiteral a, v__ast__FloatLiteral b); // auto +static bool v__ast__IntegerLiteral_struct_eq(v__ast__IntegerLiteral a, v__ast__IntegerLiteral b); // auto +static bool Array_v__ast__AsmIO_arr_eq(Array_v__ast__AsmIO a, Array_v__ast__AsmIO b); // auto +static bool v__ast__AsmIO_struct_eq(v__ast__AsmIO a, v__ast__AsmIO b); // auto +static bool v__ast__Expr_sumtype_eq(v__ast__Expr a, v__ast__Expr b); // auto +static bool v__ast__AnonFn_struct_eq(v__ast__AnonFn a, v__ast__AnonFn b); // auto +static bool v__ast__FnDecl_struct_eq(v__ast__FnDecl a, v__ast__FnDecl b); // auto +static bool v__ast__StructField_struct_eq(v__ast__StructField a, v__ast__StructField b); // auto +static bool Array_v__ast__Attr_arr_eq(Array_v__ast__Attr a, Array_v__ast__Attr b); // auto +static bool v__ast__Attr_struct_eq(v__ast__Attr a, v__ast__Attr b); // auto +static bool Array_v__ast__Param_arr_eq(Array_v__ast__Param a, Array_v__ast__Param b); // auto +static bool v__ast__Param_struct_eq(v__ast__Param a, v__ast__Param b); // auto +static bool Array_v__ast__Stmt_arr_eq(Array_v__ast__Stmt a, Array_v__ast__Stmt b); // auto +static bool Array_v__ast__DeferStmt_arr_eq(Array_v__ast__DeferStmt a, Array_v__ast__DeferStmt b); // auto +static bool v__ast__DeferStmt_struct_eq(v__ast__DeferStmt a, v__ast__DeferStmt b); // auto +static bool Array_v__ast__Ident_arr_eq(Array_v__ast__Ident a, Array_v__ast__Ident b); // auto +static bool v__ast__Ident_struct_eq(v__ast__Ident a, v__ast__Ident b); // auto +static bool v__ast__ScopeObject_sumtype_eq(v__ast__ScopeObject a, v__ast__ScopeObject b); // auto +static bool v__ast__ConstField_struct_eq(v__ast__ConstField a, v__ast__ConstField b); // auto +static bool v__ast__ComptTimeConstValue_sumtype_eq(v__ast__ComptTimeConstValue a, v__ast__ComptTimeConstValue b); // auto +static bool v__ast__EmptyExpr_struct_eq(v__ast__EmptyExpr a, v__ast__EmptyExpr b); // auto +static bool v__ast__GlobalField_struct_eq(v__ast__GlobalField a, v__ast__GlobalField b); // auto +static bool v__ast__Var_struct_eq(v__ast__Var a, v__ast__Var b); // auto +static bool v__ast__IdentInfo_sumtype_eq(v__ast__IdentInfo a, v__ast__IdentInfo b); // auto +static bool v__ast__IdentFn_struct_eq(v__ast__IdentFn a, v__ast__IdentFn b); // auto +static bool v__ast__IdentVar_struct_eq(v__ast__IdentVar a, v__ast__IdentVar b); // auto +static bool v__ast__ArrayDecompose_struct_eq(v__ast__ArrayDecompose a, v__ast__ArrayDecompose b); // auto +static bool v__ast__ArrayInit_struct_eq(v__ast__ArrayInit a, v__ast__ArrayInit b); // auto +static bool Array_Array_v__ast__Comment_arr_eq(Array_Array_v__ast__Comment a, Array_Array_v__ast__Comment b); // auto +static bool Array_v__ast__Expr_arr_eq(Array_v__ast__Expr a, Array_v__ast__Expr b); // auto +static bool v__ast__AsCast_struct_eq(v__ast__AsCast a, v__ast__AsCast b); // auto +static bool v__ast__Assoc_struct_eq(v__ast__Assoc a, v__ast__Assoc b); // auto +static bool v__ast__AtExpr_struct_eq(v__ast__AtExpr a, v__ast__AtExpr b); // auto +static bool v__ast__CTempVar_struct_eq(v__ast__CTempVar a, v__ast__CTempVar b); // auto +static bool v__ast__CallExpr_struct_eq(v__ast__CallExpr a, v__ast__CallExpr b); // auto +static bool v__ast__OrExpr_struct_eq(v__ast__OrExpr a, v__ast__OrExpr b); // auto +static bool Array_v__ast__CallArg_arr_eq(Array_v__ast__CallArg a, Array_v__ast__CallArg b); // auto +static bool v__ast__CallArg_struct_eq(v__ast__CallArg a, v__ast__CallArg b); // auto +static bool v__ast__CastExpr_struct_eq(v__ast__CastExpr a, v__ast__CastExpr b); // auto +static bool v__ast__ChanInit_struct_eq(v__ast__ChanInit a, v__ast__ChanInit b); // auto +static bool v__ast__ComptimeCall_struct_eq(v__ast__ComptimeCall a, v__ast__ComptimeCall b); // auto +static bool v__ast__File_struct_eq(v__ast__File a, v__ast__File b); // auto +static bool v__ast__Module_struct_eq(v__ast__Module a, v__ast__Module b); // auto +static bool Array_v__ast__Import_arr_eq(Array_v__ast__Import a, Array_v__ast__Import b); // auto +static bool v__ast__Import_struct_eq(v__ast__Import a, v__ast__Import b); // auto +static bool Array_v__ast__ImportSymbol_arr_eq(Array_v__ast__ImportSymbol a, Array_v__ast__ImportSymbol b); // auto +static bool v__ast__ImportSymbol_struct_eq(v__ast__ImportSymbol a, v__ast__ImportSymbol b); // auto +static bool Array_v__ast__EmbeddedFile_arr_eq(Array_v__ast__EmbeddedFile a, Array_v__ast__EmbeddedFile b); // auto static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__EmbeddedFile b); // auto static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b); // auto +static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b); // auto +static bool Array_v__errors__Error_arr_eq(Array_v__errors__Error a, Array_v__errors__Error b); // auto +static bool v__errors__Error_struct_eq(v__errors__Error a, v__errors__Error b); // auto +static bool Array_v__errors__Warning_arr_eq(Array_v__errors__Warning a, Array_v__errors__Warning b); // auto +static bool v__errors__Warning_struct_eq(v__errors__Warning a, v__errors__Warning b); // auto +static bool Array_v__errors__Notice_arr_eq(Array_v__errors__Notice a, Array_v__errors__Notice b); // auto +static bool v__errors__Notice_struct_eq(v__errors__Notice a, v__errors__Notice b); // auto +static bool Array_v__ast__FnDecl_ptr_arr_eq(Array_v__ast__FnDecl_ptr a, Array_v__ast__FnDecl_ptr b); // auto +static bool v__ast__ComptimeSelector_struct_eq(v__ast__ComptimeSelector a, v__ast__ComptimeSelector b); // auto +static bool v__ast__ComptimeType_struct_eq(v__ast__ComptimeType a, v__ast__ComptimeType b); // auto +static bool v__ast__ConcatExpr_struct_eq(v__ast__ConcatExpr a, v__ast__ConcatExpr b); // auto +static bool v__ast__DumpExpr_struct_eq(v__ast__DumpExpr a, v__ast__DumpExpr b); // auto +static bool v__ast__EnumVal_struct_eq(v__ast__EnumVal a, v__ast__EnumVal b); // auto +static bool v__ast__GoExpr_struct_eq(v__ast__GoExpr a, v__ast__GoExpr b); // auto +static bool v__ast__IfExpr_struct_eq(v__ast__IfExpr a, v__ast__IfExpr b); // auto +static bool Array_v__ast__IfBranch_arr_eq(Array_v__ast__IfBranch a, Array_v__ast__IfBranch b); // auto +static bool v__ast__IfBranch_struct_eq(v__ast__IfBranch a, v__ast__IfBranch b); // auto +static bool v__ast__IfGuardExpr_struct_eq(v__ast__IfGuardExpr a, v__ast__IfGuardExpr b); // auto +static bool Array_v__ast__IfGuardVar_arr_eq(Array_v__ast__IfGuardVar a, Array_v__ast__IfGuardVar b); // auto +static bool v__ast__IfGuardVar_struct_eq(v__ast__IfGuardVar a, v__ast__IfGuardVar b); // auto +static bool v__ast__IndexExpr_struct_eq(v__ast__IndexExpr a, v__ast__IndexExpr b); // auto +static bool v__ast__InfixExpr_struct_eq(v__ast__InfixExpr a, v__ast__InfixExpr b); // auto +static bool v__ast__IsRefType_struct_eq(v__ast__IsRefType a, v__ast__IsRefType b); // auto +static bool v__ast__Likely_struct_eq(v__ast__Likely a, v__ast__Likely b); // auto +static bool v__ast__LockExpr_struct_eq(v__ast__LockExpr a, v__ast__LockExpr b); // auto +static bool Array_bool_arr_eq(Array_bool a, Array_bool b); // auto +static bool v__ast__MapInit_struct_eq(v__ast__MapInit a, v__ast__MapInit b); // auto +static bool v__ast__MatchExpr_struct_eq(v__ast__MatchExpr a, v__ast__MatchExpr b); // auto +static bool Array_v__ast__MatchBranch_arr_eq(Array_v__ast__MatchBranch a, Array_v__ast__MatchBranch b); // auto +static bool v__ast__MatchBranch_struct_eq(v__ast__MatchBranch a, v__ast__MatchBranch b); // auto +static bool v__ast__NodeError_struct_eq(v__ast__NodeError a, v__ast__NodeError b); // auto +static bool v__ast__None_struct_eq(v__ast__None a, v__ast__None b); // auto +static bool v__ast__OffsetOf_struct_eq(v__ast__OffsetOf a, v__ast__OffsetOf b); // auto +static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b); // auto +static bool v__ast__PostfixExpr_struct_eq(v__ast__PostfixExpr a, v__ast__PostfixExpr b); // auto +static bool v__ast__PrefixExpr_struct_eq(v__ast__PrefixExpr a, v__ast__PrefixExpr b); // auto +static bool v__ast__RangeExpr_struct_eq(v__ast__RangeExpr a, v__ast__RangeExpr b); // auto +static bool v__ast__SelectExpr_struct_eq(v__ast__SelectExpr a, v__ast__SelectExpr b); // auto +static bool Array_v__ast__SelectBranch_arr_eq(Array_v__ast__SelectBranch a, Array_v__ast__SelectBranch b); // auto +static bool v__ast__SelectBranch_struct_eq(v__ast__SelectBranch a, v__ast__SelectBranch b); // auto +static bool v__ast__SelectorExpr_struct_eq(v__ast__SelectorExpr a, v__ast__SelectorExpr b); // auto +static bool v__ast__SizeOf_struct_eq(v__ast__SizeOf a, v__ast__SizeOf b); // auto +static bool v__ast__SqlExpr_struct_eq(v__ast__SqlExpr a, v__ast__SqlExpr b); // auto +static bool v__ast__TypeNode_struct_eq(v__ast__TypeNode a, v__ast__TypeNode b); // auto +static bool Array_v__ast__StructField_arr_eq(Array_v__ast__StructField a, Array_v__ast__StructField b); // auto +static bool Map_int_v__ast__SqlExpr_map_eq(Map_int_v__ast__SqlExpr a, Map_int_v__ast__SqlExpr b); // auto +static bool v__ast__StringInterLiteral_struct_eq(v__ast__StringInterLiteral a, v__ast__StringInterLiteral b); // auto +static bool Array_int_arr_eq(Array_int a, Array_int b); // auto +static bool Array_v__token__Pos_arr_eq(Array_v__token__Pos a, Array_v__token__Pos b); // auto +static bool v__ast__StringLiteral_struct_eq(v__ast__StringLiteral a, v__ast__StringLiteral b); // auto +static bool v__ast__StructInit_struct_eq(v__ast__StructInit a, v__ast__StructInit b); // auto +static bool Array_v__ast__StructInitField_arr_eq(Array_v__ast__StructInitField a, Array_v__ast__StructInitField b); // auto +static bool v__ast__StructInitField_struct_eq(v__ast__StructInitField a, v__ast__StructInitField b); // auto +static bool Array_v__ast__StructInitEmbed_arr_eq(Array_v__ast__StructInitEmbed a, Array_v__ast__StructInitEmbed b); // auto +static bool v__ast__StructInitEmbed_struct_eq(v__ast__StructInitEmbed a, v__ast__StructInitEmbed b); // auto +static bool v__ast__TypeOf_struct_eq(v__ast__TypeOf a, v__ast__TypeOf b); // auto +static bool v__ast__UnsafeExpr_struct_eq(v__ast__UnsafeExpr a, v__ast__UnsafeExpr b); // auto +static bool v__ast__AssertStmt_struct_eq(v__ast__AssertStmt a, v__ast__AssertStmt b); // auto +static bool v__ast__AssignStmt_struct_eq(v__ast__AssignStmt a, v__ast__AssignStmt b); // auto +static bool v__ast__Block_struct_eq(v__ast__Block a, v__ast__Block b); // auto +static bool v__ast__BranchStmt_struct_eq(v__ast__BranchStmt a, v__ast__BranchStmt b); // auto +static bool v__ast__ComptimeFor_struct_eq(v__ast__ComptimeFor a, v__ast__ComptimeFor b); // auto +static bool v__ast__ConstDecl_struct_eq(v__ast__ConstDecl a, v__ast__ConstDecl b); // auto +static bool Array_v__ast__ConstField_arr_eq(Array_v__ast__ConstField a, Array_v__ast__ConstField b); // auto +static bool v__ast__EmptyStmt_struct_eq(v__ast__EmptyStmt a, v__ast__EmptyStmt b); // auto +static bool v__ast__EnumDecl_struct_eq(v__ast__EnumDecl a, v__ast__EnumDecl b); // auto +static bool Array_v__ast__EnumField_arr_eq(Array_v__ast__EnumField a, Array_v__ast__EnumField b); // auto +static bool v__ast__EnumField_struct_eq(v__ast__EnumField a, v__ast__EnumField b); // auto +static bool v__ast__ExprStmt_struct_eq(v__ast__ExprStmt a, v__ast__ExprStmt b); // auto +static bool v__ast__ForCStmt_struct_eq(v__ast__ForCStmt a, v__ast__ForCStmt b); // auto +static bool v__ast__ForInStmt_struct_eq(v__ast__ForInStmt a, v__ast__ForInStmt b); // auto +static bool v__ast__ForStmt_struct_eq(v__ast__ForStmt a, v__ast__ForStmt b); // auto +static bool v__ast__GlobalDecl_struct_eq(v__ast__GlobalDecl a, v__ast__GlobalDecl b); // auto +static bool Array_v__ast__GlobalField_arr_eq(Array_v__ast__GlobalField a, Array_v__ast__GlobalField b); // auto +static bool v__ast__GotoLabel_struct_eq(v__ast__GotoLabel a, v__ast__GotoLabel b); // auto +static bool v__ast__GotoStmt_struct_eq(v__ast__GotoStmt a, v__ast__GotoStmt b); // auto +static bool v__ast__HashStmt_struct_eq(v__ast__HashStmt a, v__ast__HashStmt b); // auto +static bool v__ast__InterfaceDecl_struct_eq(v__ast__InterfaceDecl a, v__ast__InterfaceDecl b); // auto +static bool Array_v__ast__FnDecl_arr_eq(Array_v__ast__FnDecl a, Array_v__ast__FnDecl b); // auto +static bool Array_v__ast__InterfaceEmbedding_arr_eq(Array_v__ast__InterfaceEmbedding a, Array_v__ast__InterfaceEmbedding b); // auto +static bool v__ast__InterfaceEmbedding_struct_eq(v__ast__InterfaceEmbedding a, v__ast__InterfaceEmbedding b); // auto +static bool v__ast__Return_struct_eq(v__ast__Return a, v__ast__Return b); // auto +static bool v__ast__SqlStmt_struct_eq(v__ast__SqlStmt a, v__ast__SqlStmt b); // auto +static bool Array_v__ast__SqlStmtLine_arr_eq(Array_v__ast__SqlStmtLine a, Array_v__ast__SqlStmtLine b); // auto +static bool v__ast__SqlStmtLine_struct_eq(v__ast__SqlStmtLine a, v__ast__SqlStmtLine b); // auto +static bool Map_int_v__ast__SqlStmtLine_map_eq(Map_int_v__ast__SqlStmtLine a, Map_int_v__ast__SqlStmtLine b); // auto +static bool v__ast__StructDecl_struct_eq(v__ast__StructDecl a, v__ast__StructDecl b); // auto +static bool Array_v__ast__Embed_arr_eq(Array_v__ast__Embed a, Array_v__ast__Embed b); // auto +static bool v__ast__Embed_struct_eq(v__ast__Embed a, v__ast__Embed b); // auto +static bool v__ast__TypeDecl_sumtype_eq(v__ast__TypeDecl a, v__ast__TypeDecl b); // auto +static bool v__ast__AliasTypeDecl_struct_eq(v__ast__AliasTypeDecl a, v__ast__AliasTypeDecl b); // auto +static bool v__ast__FnTypeDecl_struct_eq(v__ast__FnTypeDecl a, v__ast__FnTypeDecl b); // auto +static bool v__ast__SumTypeDecl_struct_eq(v__ast__SumTypeDecl a, v__ast__SumTypeDecl b); // auto +static bool Array_v__ast__TypeNode_arr_eq(Array_v__ast__TypeNode a, Array_v__ast__TypeNode b); // auto +static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b); // auto +static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b); // auto void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it); // auto void Array_v__ast__Fn_free(Array_v__ast__Fn* it); // auto void v__ast__Fn_free(v__ast__Fn* it); // auto @@ -10671,6 +10867,7 @@ static string v__ast__IdentKind_str(v__ast__IdentKind it) { /* gen_str_for_enum default: return _SLIT("unknown enum value"); } } +static string anon_fn_v__ast__constdecl_str() { return _SLIT("fn (mut v.ast.ConstDecl)");} static string Array_v__ast__Attr_str(Array_v__ast__Attr a) { return indent_Array_v__ast__Attr_str(a, 0);} static string indent_Array_v__ast__Attr_str(Array_v__ast__Attr a, int indent_count) { strings__Builder sb = strings__new_builder(a.len * 10); @@ -10991,11 +11188,11 @@ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) { switch(x._typ) { - case 472: return str_intp(2, _MOV((StrIntpData[]){ + case 473: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Aggregate_str(*(v__ast__Aggregate*)x._v__ast__Aggregate, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 474: return str_intp(2, _MOV((StrIntpData[]){ + case 475: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Alias_str(*(v__ast__Alias*)x._v__ast__Alias, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11003,27 +11200,27 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Array_str(*(v__ast__Array*)x._v__ast__Array, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 482: return str_intp(2, _MOV((StrIntpData[]){ + case 483: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__ArrayFixed_str(*(v__ast__ArrayFixed*)x._v__ast__ArrayFixed, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 483: return str_intp(2, _MOV((StrIntpData[]){ + case 484: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Chan_str(*(v__ast__Chan*)x._v__ast__Chan, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 488: return str_intp(2, _MOV((StrIntpData[]){ + case 489: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Enum_str(*(v__ast__Enum*)x._v__ast__Enum, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 486: return str_intp(2, _MOV((StrIntpData[]){ + case 487: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__FnType_str(*(v__ast__FnType*)x._v__ast__FnType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 487: return str_intp(2, _MOV((StrIntpData[]){ + case 488: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__GenericInst_str(*(v__ast__GenericInst*)x._v__ast__GenericInst, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 477: return str_intp(2, _MOV((StrIntpData[]){ + case 478: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Interface_str(*(v__ast__Interface*)x._v__ast__Interface, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11031,7 +11228,7 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Map_str(*(v__ast__Map*)x._v__ast__Map, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 485: return str_intp(2, _MOV((StrIntpData[]){ + case 486: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__MultiReturn_str(*(v__ast__MultiReturn*)x._v__ast__MultiReturn, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11039,11 +11236,11 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Struct_str(*(v__ast__Struct*)x._v__ast__Struct, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 478: return str_intp(2, _MOV((StrIntpData[]){ + case 479: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__SumType_str(*(v__ast__SumType*)x._v__ast__SumType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 484: return str_intp(2, _MOV((StrIntpData[]){ + case 485: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Thread_str(*(v__ast__Thread*)x._v__ast__Thread, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11472,11 +11669,13 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ string _t75 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); string _t76 = v__ast__Type_str(it.default_expr_typ); string _t77 = v__ast__Type_str(it.typ); - string res = str_intp( 63, _MOV((StrIntpData[]){ + string res = str_intp( 75, _MOV((StrIntpData[]){ {_SLIT("v.ast.StructField{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_val: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.default_val}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" deprecation_msg: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.deprecation_msg}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" deprecated_after: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.deprecated_after}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t74}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11489,6 +11688,7 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_mut: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_mut ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_global: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_global ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_volatile: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_volatile ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_deprecated: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_deprecated ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t77); @@ -11624,12 +11824,12 @@ static inline v__ast__Expr v__ast__StructInit_to_sumtype_v__ast__Expr(v__ast__St static inline v__ast__TypeInfo v__ast__SumType_to_sumtype_v__ast__TypeInfo(v__ast__SumType* x) { v__ast__SumType* ptr = memdup(x, sizeof(v__ast__SumType)); - return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 478}; + return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 479}; } static inline v__ast__TypeInfo v__ast__Chan_to_sumtype_v__ast__TypeInfo(v__ast__Chan* x) { v__ast__Chan* ptr = memdup(x, sizeof(v__ast__Chan)); - return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 483}; + return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 484}; } static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__Map* x) { @@ -11639,7 +11839,7 @@ static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__M static inline v__ast__TypeInfo v__ast__Thread_to_sumtype_v__ast__TypeInfo(v__ast__Thread* x) { v__ast__Thread* ptr = memdup(x, sizeof(v__ast__Thread)); - return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 484}; + return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 485}; } static inline v__ast__TypeInfo v__ast__Struct_to_sumtype_v__ast__TypeInfo(v__ast__Struct* x) { @@ -11654,17 +11854,17 @@ static inline v__ast__TypeInfo v__ast__Array_to_sumtype_v__ast__TypeInfo(v__ast_ static inline v__ast__TypeInfo v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(v__ast__ArrayFixed* x) { v__ast__ArrayFixed* ptr = memdup(x, sizeof(v__ast__ArrayFixed)); - return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 482}; + return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 483}; } static inline v__ast__TypeInfo v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(v__ast__MultiReturn* x) { v__ast__MultiReturn* ptr = memdup(x, sizeof(v__ast__MultiReturn)); - return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 485}; + return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 486}; } static inline v__ast__TypeInfo v__ast__FnType_to_sumtype_v__ast__TypeInfo(v__ast__FnType* x) { v__ast__FnType* ptr = memdup(x, sizeof(v__ast__FnType)); - return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 486}; + return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 487}; } static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) { @@ -11674,7 +11874,7 @@ static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) static inline v__ast__TypeInfo v__ast__Interface_to_sumtype_v__ast__TypeInfo(v__ast__Interface* x) { v__ast__Interface* ptr = memdup(x, sizeof(v__ast__Interface)); - return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 477}; + return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 478}; } static inline v__ast__IdentInfo v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(v__ast__IdentVar* x) { @@ -11702,6 +11902,11 @@ static inline v__ast__ScopeObject v__ast__Var_to_sumtype_v__ast__ScopeObject(v__ return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 367, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; } +static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { + v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); + return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 365, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; +} + static inline v__ast__IdentInfo v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(v__ast__IdentFn* x) { v__ast__IdentFn* ptr = memdup(x, sizeof(v__ast__IdentFn)); return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 418}; @@ -11779,7 +11984,7 @@ static inline v__ast__Stmt v__ast__Return_to_sumtype_v__ast__Stmt(v__ast__Return static inline v__ast__TypeInfo v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(v__ast__Aggregate* x) { v__ast__Aggregate* ptr = memdup(x, sizeof(v__ast__Aggregate)); - return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 472}; + return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 473}; } static inline v__ast__Expr v__ast__Ident_to_sumtype_v__ast__Expr(v__ast__Ident* x) { @@ -12004,7 +12209,7 @@ static inline v__ast__Expr v__ast__RangeExpr_to_sumtype_v__ast__Expr(v__ast__Ran static inline v__ast__TypeInfo v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(v__ast__GenericInst* x) { v__ast__GenericInst* ptr = memdup(x, sizeof(v__ast__GenericInst)); - return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 487}; + return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 488}; } static inline v__ast__Stmt v__ast__Module_to_sumtype_v__ast__Stmt(v__ast__Module* x) { @@ -12132,11 +12337,6 @@ static inline v__ast__Expr v__ast__StringInterLiteral_to_sumtype_v__ast__Expr(v_ return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 332}; } -static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { - v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 365, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; -} - static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 366, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; @@ -12144,7 +12344,7 @@ static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeOb static inline v__ast__TypeInfo v__ast__Enum_to_sumtype_v__ast__TypeInfo(v__ast__Enum* x) { v__ast__Enum* ptr = memdup(x, sizeof(v__ast__Enum)); - return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 488}; + return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 489}; } static inline v__ast__TypeDecl v__ast__SumTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__SumTypeDecl* x) { @@ -12164,7 +12364,7 @@ static inline v__ast__TypeDecl v__ast__AliasTypeDecl_to_sumtype_v__ast__TypeDecl static inline v__ast__TypeInfo v__ast__Alias_to_sumtype_v__ast__TypeInfo(v__ast__Alias* x) { v__ast__Alias* ptr = memdup(x, sizeof(v__ast__Alias)); - return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 474}; + return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 475}; } static inline v__ast__Node v__ast__File_to_sumtype_v__ast__Node(v__ast__File* x) { @@ -12324,31 +12524,681 @@ static bool Array_v__ast__Type_arr_eq(Array_v__ast__Type a, Array_v__ast__Type b return true; } -static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b) { +static bool v__ast__AsmRegister_struct_eq(v__ast__AsmRegister a, v__ast__AsmRegister b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.size == b.size; +} + +static bool v__ast__Comment_struct_eq(v__ast__Comment a, v__ast__Comment b) { + return string__eq(a.text, b.text) + && a.is_multi == b.is_multi + && a.is_inline == b.is_inline + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__Comment_arr_eq(Array_v__ast__Comment a, Array_v__ast__Comment b) { if (a.len != b.len) { return false; } - for (int i = 0; i < a.key_values.len; ++i) { - if (!DenseArray_has_index(&a.key_values, i)) continue; - voidptr k = DenseArray_key(&a.key_values, i); - if (!map_exists(&b, k)) return false; - string v = *(string*)map_get(&a, k, &(string[]){ 0 }); - if (!fast_string_eq(*(string*)map_get(&b, k, &(string[]){_SLIT("")}), v)) { + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Comment_struct_eq(((v__ast__Comment*)a.data)[i], ((v__ast__Comment*)b.data)[i])) { return false; } } return true; } -static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b) { - return string__eq(a.styp, b.styp) +static bool v__ast__AsmClobbered_struct_eq(v__ast__AsmClobbered a, v__ast__AsmClobbered b) { + return v__ast__AsmRegister_struct_eq(a.reg, b.reg) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__AsmClobbered_arr_eq(Array_v__ast__AsmClobbered a, Array_v__ast__AsmClobbered b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmClobbered_struct_eq(((v__ast__AsmClobbered*)a.data)[i], ((v__ast__AsmClobbered*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmAddressing_struct_eq(v__ast__AsmAddressing a, v__ast__AsmAddressing b) { + return a.scale == b.scale + && a.mode == b.mode + && v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.segment, b.segment) + && v__ast__AsmArg_sumtype_eq(a.displacement, b.displacement) + && v__ast__AsmArg_sumtype_eq(a.base, b.base) + && v__ast__AsmArg_sumtype_eq(a.index, b.index); +} + +static bool v__ast__AsmAlias_struct_eq(v__ast__AsmAlias a, v__ast__AsmAlias b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.name, b.name); +} + +static bool v__ast__AsmDisp_struct_eq(v__ast__AsmDisp a, v__ast__AsmDisp b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__BoolLiteral_struct_eq(v__ast__BoolLiteral a, v__ast__BoolLiteral b) { + return a.val == b.val + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__CharLiteral_struct_eq(v__ast__CharLiteral a, v__ast__CharLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__FloatLiteral_struct_eq(v__ast__FloatLiteral a, v__ast__FloatLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__IntegerLiteral_struct_eq(v__ast__IntegerLiteral a, v__ast__IntegerLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__AsmArg_sumtype_eq(v__ast__AsmArg a, v__ast__AsmArg b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 439) { + return v__ast__AsmAddressing_struct_eq(*a._v__ast__AsmAddressing, *b._v__ast__AsmAddressing); + } + if (a._typ == 440) { + return v__ast__AsmAlias_struct_eq(*a._v__ast__AsmAlias, *b._v__ast__AsmAlias); + } + if (a._typ == 441) { + return v__ast__AsmDisp_struct_eq(*a._v__ast__AsmDisp, *b._v__ast__AsmDisp); + } + if (a._typ == 364) { + return v__ast__AsmRegister_struct_eq(*a._v__ast__AsmRegister, *b._v__ast__AsmRegister); + } + if (a._typ == 293) { + return v__ast__BoolLiteral_struct_eq(*a._v__ast__BoolLiteral, *b._v__ast__BoolLiteral); + } + if (a._typ == 298) { + return v__ast__CharLiteral_struct_eq(*a._v__ast__CharLiteral, *b._v__ast__CharLiteral); + } + if (a._typ == 307) { + return v__ast__FloatLiteral_struct_eq(*a._v__ast__FloatLiteral, *b._v__ast__FloatLiteral); + } + if (a._typ == 314) { + return v__ast__IntegerLiteral_struct_eq(*a._v__ast__IntegerLiteral, *b._v__ast__IntegerLiteral); + } + if (a._typ == 20) { + return string__eq(*a._string, *b._string); + } + return false; +} + +static bool Array_v__ast__AsmArg_arr_eq(Array_v__ast__AsmArg a, Array_v__ast__AsmArg b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmArg_sumtype_eq(((v__ast__AsmArg*)a.data)[i], ((v__ast__AsmArg*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmTemplate_struct_eq(v__ast__AsmTemplate a, v__ast__AsmTemplate b) { + return Array_v__ast__AsmArg_arr_eq(a.args, b.args) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_label == b.is_label + && a.is_directive == b.is_directive; +} + +static bool Array_v__ast__AsmTemplate_arr_eq(Array_v__ast__AsmTemplate a, Array_v__ast__AsmTemplate b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmTemplate_struct_eq(((v__ast__AsmTemplate*)a.data)[i], ((v__ast__AsmTemplate*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__Attr_struct_eq(v__ast__Attr a, v__ast__Attr b) { + return string__eq(a.name, b.name) + && string__eq(a.arg, b.arg) + && v__ast__Expr_sumtype_eq(a.ct_expr, b.ct_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind + && a.has_arg == b.has_arg + && a.ct_opt == b.ct_opt + && a.ct_evaled == b.ct_evaled + && a.ct_skip == b.ct_skip; +} + +static bool Array_v__ast__Attr_arr_eq(Array_v__ast__Attr a, Array_v__ast__Attr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Attr_struct_eq(((v__ast__Attr*)a.data)[i], ((v__ast__Attr*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructField_struct_eq(v__ast__StructField a, v__ast__StructField b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && string__eq(a.default_val, b.default_val) + && string__eq(a.deprecation_msg, b.deprecation_msg) + && string__eq(a.deprecated_after, b.deprecated_after) + && v__ast__Expr_sumtype_eq(a.default_expr, b.default_expr) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && a.i == b.i + && v__ast__Type_alias_eq(a.default_expr_typ, b.default_expr_typ) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_default_expr == b.has_default_expr + && a.is_pub == b.is_pub + && a.is_mut == b.is_mut + && a.is_global == b.is_global + && a.is_volatile == b.is_volatile + && a.is_deprecated == b.is_deprecated; +} + +static bool v__ast__Param_struct_eq(v__ast__Param a, v__ast__Param b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_mut == b.is_mut + && a.is_auto_rec == b.is_auto_rec + && a.is_hidden == b.is_hidden; +} + +static bool Array_v__ast__Param_arr_eq(Array_v__ast__Param a, Array_v__ast__Param b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Param_struct_eq(((v__ast__Param*)a.data)[i], ((v__ast__Param*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__Stmt_arr_eq(Array_v__ast__Stmt a, Array_v__ast__Stmt b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Stmt_sumtype_eq(((v__ast__Stmt*)a.data)[i], ((v__ast__Stmt*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__EmptyExpr_struct_eq(v__ast__EmptyExpr a, v__ast__EmptyExpr b) { + return a.x == b.x; +} + +static bool v__ast__ComptTimeConstValue_sumtype_eq(v__ast__ComptTimeConstValue a, v__ast__ComptTimeConstValue b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 305) { + return v__ast__EmptyExpr_struct_eq(*a._v__ast__EmptyExpr, *b._v__ast__EmptyExpr); + } + if (a._typ == 15) { + return *a._f32 == *b._f32; + } + if (a._typ == 16) { + return *a._f64 == *b._f64; + } + if (a._typ == 6) { + return *a._i16 == *b._i16; + } + if (a._typ == 8) { + return *a._i64 == *b._i64; + } + if (a._typ == 5) { + return *a._i8 == *b._i8; + } + if (a._typ == 7) { + return *a._int == *b._int; + } + if (a._typ == 21) { + return *a._rune == *b._rune; + } + if (a._typ == 20) { + return string__eq(*a._string, *b._string); + } + if (a._typ == 11) { + return *a._u16 == *b._u16; + } + if (a._typ == 12) { + return *a._u32 == *b._u32; + } + if (a._typ == 13) { + return *a._u64 == *b._u64; + } + if (a._typ == 10) { + return *a._u8 == *b._u8; + } + return false; +} + +static bool v__ast__ConstField_struct_eq(v__ast__ConstField a, v__ast__ConstField b) { + return string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && a.is_markused == b.is_markused + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && v__ast__ComptTimeConstValue_sumtype_eq(a.comptime_expr_value, b.comptime_expr_value); +} + +static bool v__ast__GlobalField_struct_eq(v__ast__GlobalField a, v__ast__GlobalField b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.typ_pos, b.typ_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_expr == b.has_expr + && a.is_markused == b.is_markused + && a.is_volatile == b.is_volatile; +} + +static bool v__ast__Var_struct_eq(v__ast__Var a, v__ast__Var b) { + return Array_v__ast__Type_arr_eq(a.smartcasts, b.smartcasts) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.orig_type, b.orig_type) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_autofree_tmp == b.is_autofree_tmp + && a.is_arg == b.is_arg + && a.is_auto_deref == b.is_auto_deref + && a.is_inherited == b.is_inherited + && a.is_used == b.is_used + && a.is_changed == b.is_changed + && a.is_or == b.is_or + && a.is_tmp == b.is_tmp + && a.is_auto_heap == b.is_auto_heap + && a.is_stack_obj == b.is_stack_obj; +} + +static bool v__ast__ScopeObject_sumtype_eq(v__ast__ScopeObject a, v__ast__ScopeObject b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 364) { + return v__ast__AsmRegister_struct_eq(*a._v__ast__AsmRegister, *b._v__ast__AsmRegister); + } + if (a._typ == 365) { + return v__ast__ConstField_struct_eq(*a._v__ast__ConstField, *b._v__ast__ConstField); + } + if (a._typ == 366) { + return v__ast__GlobalField_struct_eq(*a._v__ast__GlobalField, *b._v__ast__GlobalField); + } + if (a._typ == 367) { + return v__ast__Var_struct_eq(*a._v__ast__Var, *b._v__ast__Var); + } + return false; +} + +static bool v__ast__IdentFn_struct_eq(v__ast__IdentFn a, v__ast__IdentFn b) { + return v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__IdentVar_struct_eq(v__ast__IdentVar a, v__ast__IdentVar b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_static == b.is_static + && a.is_volatile == b.is_volatile + && a.is_optional == b.is_optional; +} + +static bool v__ast__IdentInfo_sumtype_eq(v__ast__IdentInfo a, v__ast__IdentInfo b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 418) { + return v__ast__IdentFn_struct_eq(*a._v__ast__IdentFn, *b._v__ast__IdentFn); + } + if (a._typ == 419) { + return v__ast__IdentVar_struct_eq(*a._v__ast__IdentVar, *b._v__ast__IdentVar); + } + return false; +} + +static bool v__ast__Ident_struct_eq(v__ast__Ident a, v__ast__Ident b) { + return v__ast__ScopeObject_sumtype_eq(a.obj, b.obj) + && string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && v__ast__IdentInfo_sumtype_eq(a.info, b.info) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mut_pos, b.mut_pos) + && a.tok_kind == b.tok_kind + && a.language == b.language + && a.kind == b.kind + && a.comptime == b.comptime + && a.is_mut == b.is_mut; +} + +static bool Array_v__ast__Ident_arr_eq(Array_v__ast__Ident a, Array_v__ast__Ident b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Ident_struct_eq(((v__ast__Ident*)a.data)[i], ((v__ast__Ident*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__DeferStmt_struct_eq(v__ast__DeferStmt a, v__ast__DeferStmt b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Ident_arr_eq(a.defer_vars, b.defer_vars) + && string__eq(a.ifdef, b.ifdef) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.idx_in_fn == b.idx_in_fn; +} + +static bool Array_v__ast__DeferStmt_arr_eq(Array_v__ast__DeferStmt a, Array_v__ast__DeferStmt b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__DeferStmt_struct_eq(((v__ast__DeferStmt*)a.data)[i], ((v__ast__DeferStmt*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__FnDecl_struct_eq(v__ast__FnDecl a, v__ast__FnDecl b) { + return v__ast__StructField_struct_eq(a.receiver, b.receiver) + && Array_string_arr_eq(a.generic_names, b.generic_names) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__Param_arr_eq(a.params, b.params) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__DeferStmt_arr_eq(a.defer_stmts, b.defer_stmts) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && Array_string_arr_eq(a.label_names, b.label_names) + && string__eq(a.name, b.name) + && string__eq(a.short_name, b.short_name) + && string__eq(a.mod, b.mod) + && string__eq(a.file, b.file) + && a.source_file == b.source_file + && a.scope == b.scope + && v__token__Pos_struct_eq(a.receiver_pos, b.receiver_pos) + && v__token__Pos_struct_eq(a.method_type_pos, b.method_type_pos) + && v__token__Pos_struct_eq(a.body_pos, b.body_pos) + && v__token__Pos_struct_eq(a.return_type_pos, b.return_type_pos) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.method_idx == b.method_idx + && a.ctdefine_idx == b.ctdefine_idx + && a.idx == b.idx + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && a.ninstances == b.ninstances + && a.language == b.language + && a.file_mode == b.file_mode + && a.rec_share == b.rec_share + && a.is_deprecated == b.is_deprecated + && a.is_pub == b.is_pub + && a.is_variadic == b.is_variadic + && a.is_anon == b.is_anon + && a.is_noreturn == b.is_noreturn + && a.is_manualfree == b.is_manualfree + && a.is_main == b.is_main + && a.is_test == b.is_test + && a.is_conditional == b.is_conditional + && a.is_exported == b.is_exported + && a.is_keep_alive == b.is_keep_alive + && a.is_unsafe == b.is_unsafe + && a.is_markused == b.is_markused + && a.is_method == b.is_method + && a.rec_mut == b.rec_mut + && a.no_body == b.no_body + && a.is_builtin == b.is_builtin + && a.is_direct_arr == b.is_direct_arr + && a.has_return == b.has_return + && a.should_be_skipped == b.should_be_skipped + && a.has_await == b.has_await; +} + +static bool v__ast__AnonFn_struct_eq(v__ast__AnonFn a, v__ast__AnonFn b) { + return v__ast__FnDecl_struct_eq(a.decl, b.decl) + && Array_v__ast__Param_arr_eq(a.inherited_vars, b.inherited_vars) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_gen == b.has_gen; +} + +static bool v__ast__ArrayDecompose_struct_eq(v__ast__ArrayDecompose a, v__ast__ArrayDecompose b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && v__ast__Type_alias_eq(a.arg_type, b.arg_type); +} + +static bool Array_Array_v__ast__Comment_arr_eq(Array_Array_v__ast__Comment a, Array_Array_v__ast__Comment b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!Array_v__ast__Comment_arr_eq(((Array_v__ast__Comment*)a.data)[i], ((Array_v__ast__Comment*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__Expr_arr_eq(Array_v__ast__Expr a, Array_v__ast__Expr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Expr_sumtype_eq(((v__ast__Expr*)a.data)[i], ((v__ast__Expr*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__ArrayInit_struct_eq(v__ast__ArrayInit a, v__ast__ArrayInit b) { + return Array_Array_v__ast__Comment_arr_eq(a.ecmnts, b.ecmnts) + && Array_v__ast__Comment_arr_eq(a.pre_cmnts, b.pre_cmnts) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.expr_types, b.expr_types) + && string__eq(a.mod, b.mod) + && v__ast__Expr_sumtype_eq(a.len_expr, b.len_expr) + && v__ast__Expr_sumtype_eq(a.cap_expr, b.cap_expr) + && v__ast__Expr_sumtype_eq(a.default_expr, b.default_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.elem_type_pos, b.elem_type_pos) + && v__ast__Type_alias_eq(a.elem_type, b.elem_type) + && v__ast__Type_alias_eq(a.default_type, b.default_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_fixed == b.is_fixed + && a.has_val == b.has_val + && a.has_len == b.has_len + && a.has_cap == b.has_cap + && a.has_default == b.has_default + && a.has_it == b.has_it; +} + +static bool v__ast__AsCast_struct_eq(v__ast__AsCast a, v__ast__AsCast b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__Assoc_struct_eq(v__ast__Assoc a, v__ast__Assoc b) { + return Array_string_arr_eq(a.fields, b.fields) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && string__eq(a.var_name, b.var_name) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) && v__ast__Type_alias_eq(a.typ, b.typ); } -static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b) { - return string__eq(a.fn_name, b.fn_name) - && v__ast__Type_alias_eq(a.got, b.got) - && v__ast__Type_alias_eq(a.exp, b.exp); +static bool v__ast__AtExpr_struct_eq(v__ast__AtExpr a, v__ast__AtExpr b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind + && string__eq(a.val, b.val); +} + +static bool v__ast__CTempVar_struct_eq(v__ast__CTempVar a, v__ast__CTempVar b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_ptr == b.is_ptr + && v__ast__Expr_sumtype_eq(a.orig, b.orig); +} + +static bool v__ast__OrExpr_struct_eq(v__ast__OrExpr a, v__ast__OrExpr b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__CallArg_struct_eq(v__ast__CallArg a, v__ast__CallArg b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.share == b.share + && a.is_mut == b.is_mut + && a.is_tmp_autofree == b.is_tmp_autofree; +} + +static bool Array_v__ast__CallArg_arr_eq(Array_v__ast__CallArg a, Array_v__ast__CallArg b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__CallArg_struct_eq(((v__ast__CallArg*)a.data)[i], ((v__ast__CallArg*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__CallExpr_struct_eq(v__ast__CallExpr a, v__ast__CallExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && Array_v__ast__CallArg_arr_eq(a.args, b.args) + && Array_v__ast__Type_arr_eq(a.expected_arg_types, b.expected_arg_types) + && Array_v__ast__Type_arr_eq(a.concrete_types, b.concrete_types) + && Array_v__ast__Type_arr_eq(a.raw_concrete_types, b.raw_concrete_types) + && Array_v__ast__Type_arr_eq(a.from_embed_types, b.from_embed_types) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && string__eq(a.mod, b.mod) + && string__eq(a.name, b.name) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__token__Pos_struct_eq(a.concrete_list_pos, b.concrete_list_pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.receiver_type, b.receiver_type) + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && v__ast__Type_alias_eq(a.fn_var_type, b.fn_var_type) + && a.language == b.language + && a.is_method == b.is_method + && a.is_field == b.is_field + && a.is_fn_var == b.is_fn_var + && a.is_keep_alive == b.is_keep_alive + && a.is_noreturn == b.is_noreturn + && a.is_ctor_new == b.is_ctor_new + && a.should_be_skipped == b.should_be_skipped + && a.free_receiver == b.free_receiver; +} + +static bool v__ast__CastExpr_struct_eq(v__ast__CastExpr a, v__ast__CastExpr b) { + return v__ast__Expr_sumtype_eq(a.arg, b.arg) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.typname, b.typname) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && a.has_arg == b.has_arg; +} + +static bool v__ast__ChanInit_struct_eq(v__ast__ChanInit a, v__ast__ChanInit b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_cap == b.has_cap + && v__ast__Expr_sumtype_eq(a.cap_expr, b.cap_expr) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.elem_type, b.elem_type); +} + +static bool v__ast__Module_struct_eq(v__ast__Module a, v__ast__Module b) { + return string__eq(a.name, b.name) + && string__eq(a.short_name, b.short_name) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && a.is_skipped == b.is_skipped; +} + +static bool v__ast__ImportSymbol_struct_eq(v__ast__ImportSymbol a, v__ast__ImportSymbol b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.name, b.name); +} + +static bool Array_v__ast__ImportSymbol_arr_eq(Array_v__ast__ImportSymbol a, Array_v__ast__ImportSymbol b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__ImportSymbol_struct_eq(((v__ast__ImportSymbol*)a.data)[i], ((v__ast__ImportSymbol*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__Import_struct_eq(v__ast__Import a, v__ast__Import b) { + return string__eq(a.mod, b.mod) + && string__eq(a.alias, b.alias) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mod_pos, b.mod_pos) + && v__token__Pos_struct_eq(a.alias_pos, b.alias_pos) + && v__token__Pos_struct_eq(a.syms_pos, b.syms_pos) + && Array_v__ast__ImportSymbol_arr_eq(a.syms, b.syms) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments); +} + +static bool Array_v__ast__Import_arr_eq(Array_v__ast__Import a, Array_v__ast__Import b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Import_struct_eq(((v__ast__Import*)a.data)[i], ((v__ast__Import*)b.data)[i])) { + return false; + } + } + return true; } static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b) { @@ -12372,6 +13222,1314 @@ static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__Embed && a.is_compressed == b.is_compressed; } +static bool Array_v__ast__EmbeddedFile_arr_eq(Array_v__ast__EmbeddedFile a, Array_v__ast__EmbeddedFile b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__EmbeddedFile_struct_eq(((v__ast__EmbeddedFile*)a.data)[i], ((v__ast__EmbeddedFile*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Map_string_string_map_eq(Map_string_string a, Map_string_string b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + string v = *(string*)map_get(&a, k, &(string[]){ 0 }); + if (!fast_string_eq(*(string*)map_get(&b, k, &(string[]){_SLIT("")}), v)) { + return false; + } + } + return true; +} + +static bool v__errors__Error_struct_eq(v__errors__Error a, v__errors__Error b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && string__eq(a.backtrace, b.backtrace) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Error_arr_eq(Array_v__errors__Error a, Array_v__errors__Error b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Error_struct_eq(((v__errors__Error*)a.data)[i], ((v__errors__Error*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__errors__Warning_struct_eq(v__errors__Warning a, v__errors__Warning b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Warning_arr_eq(Array_v__errors__Warning a, Array_v__errors__Warning b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Warning_struct_eq(((v__errors__Warning*)a.data)[i], ((v__errors__Warning*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__errors__Notice_struct_eq(v__errors__Notice a, v__errors__Notice b) { + return string__eq(a.message, b.message) + && string__eq(a.details, b.details) + && string__eq(a.file_path, b.file_path) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.reporter == b.reporter; +} + +static bool Array_v__errors__Notice_arr_eq(Array_v__errors__Notice a, Array_v__errors__Notice b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__errors__Notice_struct_eq(((v__errors__Notice*)a.data)[i], ((v__errors__Notice*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Array_v__ast__FnDecl_ptr_arr_eq(Array_v__ast__FnDecl_ptr a, Array_v__ast__FnDecl_ptr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((v__ast__FnDecl**)((byte*)a.data+(i*a.element_size))) != *((v__ast__FnDecl**)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool v__ast__File_struct_eq(v__ast__File a, v__ast__File b) { + return a.nr_lines == b.nr_lines + && a.nr_bytes == b.nr_bytes + && v__ast__Module_struct_eq(a.mod, b.mod) + && a.global_scope == b.global_scope + && a.is_test == b.is_test + && a.is_generated == b.is_generated + && a.is_translated == b.is_translated + && a.idx == b.idx + && string__eq(a.path, b.path) + && string__eq(a.path_base, b.path_base) + && a.scope == b.scope + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Import_arr_eq(a.imports, b.imports) + && Array_string_arr_eq(a.auto_imports, b.auto_imports) + && Array_v__ast__EmbeddedFile_arr_eq(a.embedded_files, b.embedded_files) + && Map_string_string_map_eq(a.imported_symbols, b.imported_symbols) + && Array_v__errors__Error_arr_eq(a.errors, b.errors) + && Array_v__errors__Warning_arr_eq(a.warnings, b.warnings) + && Array_v__errors__Notice_arr_eq(a.notices, b.notices) + && Array_v__ast__FnDecl_ptr_arr_eq(a.generic_fns, b.generic_fns) + && Array_string_arr_eq(a.global_labels, b.global_labels); +} + +static bool v__ast__ComptimeCall_struct_eq(v__ast__ComptimeCall a, v__ast__ComptimeCall b) { + return v__ast__File_struct_eq(a.vweb_tmpl, b.vweb_tmpl) + && v__ast__EmbeddedFile_struct_eq(a.embed_file, b.embed_file) + && Array_v__ast__CallArg_arr_eq(a.args, b.args) + && string__eq(a.method_name, b.method_name) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && string__eq(a.args_var, b.args_var) + && string__eq(a.env_value, b.env_value) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.method_pos, b.method_pos) + && v__token__Pos_struct_eq(a.env_pos, b.env_pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.result_type, b.result_type) + && a.has_parens == b.has_parens + && a.is_vweb == b.is_vweb + && a.is_embed == b.is_embed + && a.is_env == b.is_env + && a.is_pkgconfig == b.is_pkgconfig; +} + +static bool v__ast__ComptimeSelector_struct_eq(v__ast__ComptimeSelector a, v__ast__ComptimeSelector b) { + return v__ast__Expr_sumtype_eq(a.left, b.left) + && v__ast__Expr_sumtype_eq(a.field_expr, b.field_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.has_parens == b.has_parens; +} + +static bool v__ast__ComptimeType_struct_eq(v__ast__ComptimeType a, v__ast__ComptimeType b) { + return a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__ConcatExpr_struct_eq(v__ast__ConcatExpr a, v__ast__ConcatExpr b) { + return Array_v__ast__Expr_arr_eq(a.vals, b.vals) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.return_type, b.return_type); +} + +static bool v__ast__DumpExpr_struct_eq(v__ast__DumpExpr a, v__ast__DumpExpr b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.cname, b.cname) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__EnumVal_struct_eq(v__ast__EnumVal a, v__ast__EnumVal b) { + return string__eq(a.enum_name, b.enum_name) + && string__eq(a.val, b.val) + && string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__GoExpr_struct_eq(v__ast__GoExpr a, v__ast__GoExpr b) { + return v__ast__CallExpr_struct_eq(a.call_expr, b.call_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_expr == b.is_expr; +} + +static bool v__ast__IfBranch_struct_eq(v__ast__IfBranch a, v__ast__IfBranch b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.body_pos, b.body_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && a.pkg_exist == b.pkg_exist + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.scope == b.scope; +} + +static bool Array_v__ast__IfBranch_arr_eq(Array_v__ast__IfBranch a, Array_v__ast__IfBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__IfBranch_struct_eq(((v__ast__IfBranch*)a.data)[i], ((v__ast__IfBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__IfExpr_struct_eq(v__ast__IfExpr a, v__ast__IfExpr b) { + return Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && Array_v__ast__IfBranch_arr_eq(a.branches, b.branches) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.tok_kind == b.tok_kind + && a.is_comptime == b.is_comptime + && a.is_expr == b.is_expr + && a.has_else == b.has_else; +} + +static bool v__ast__IfGuardVar_struct_eq(v__ast__IfGuardVar a, v__ast__IfGuardVar b) { + return string__eq(a.name, b.name) + && a.is_mut == b.is_mut + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__IfGuardVar_arr_eq(Array_v__ast__IfGuardVar a, Array_v__ast__IfGuardVar b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__IfGuardVar_struct_eq(((v__ast__IfGuardVar*)a.data)[i], ((v__ast__IfGuardVar*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__IfGuardExpr_struct_eq(v__ast__IfGuardExpr a, v__ast__IfGuardExpr b) { + return Array_v__ast__IfGuardVar_arr_eq(a.vars, b.vars) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__IndexExpr_struct_eq(v__ast__IndexExpr a, v__ast__IndexExpr b) { + return v__ast__OrExpr_struct_eq(a.or_expr, b.or_expr) + && v__ast__Expr_sumtype_eq(a.index, b.index) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && a.is_setter == b.is_setter + && a.is_map == b.is_map + && a.is_array == b.is_array + && a.is_farray == b.is_farray + && a.is_option == b.is_option + && a.is_direct == b.is_direct + && a.is_gated == b.is_gated; +} + +static bool v__ast__InfixExpr_struct_eq(v__ast__InfixExpr a, v__ast__InfixExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && v__ast__Expr_sumtype_eq(a.left, b.left) + && v__ast__Expr_sumtype_eq(a.right, b.right) + && string__eq(a.auto_locked, b.auto_locked) + && v__ast__ComptTimeConstValue_sumtype_eq(a.ct_left_value, b.ct_left_value) + && v__ast__ComptTimeConstValue_sumtype_eq(a.ct_right_value, b.ct_right_value) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.left_type, b.left_type) + && v__ast__Type_alias_eq(a.right_type, b.right_type) + && a.op == b.op + && a.is_stmt == b.is_stmt + && a.ct_left_value_evaled == b.ct_left_value_evaled + && a.ct_right_value_evaled == b.ct_right_value_evaled; +} + +static bool v__ast__IsRefType_struct_eq(v__ast__IsRefType a, v__ast__IsRefType b) { + return a.is_type == b.is_type + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__Likely_struct_eq(v__ast__Likely a, v__ast__Likely b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_likely == b.is_likely + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool Array_bool_arr_eq(Array_bool a, Array_bool b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((bool*)((byte*)a.data+(i*a.element_size))) != *((bool*)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool v__ast__LockExpr_struct_eq(v__ast__LockExpr a, v__ast__LockExpr b) { + return Array_bool_arr_eq(a.is_rlock, b.is_rlock) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Expr_arr_eq(a.lockeds, b.lockeds) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.scope == b.scope; +} + +static bool v__ast__MapInit_struct_eq(v__ast__MapInit a, v__ast__MapInit b) { + return Array_Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.pre_cmnts, b.pre_cmnts) + && Array_v__ast__Expr_arr_eq(a.keys, b.keys) + && Array_v__ast__Expr_arr_eq(a.vals, b.vals) + && Array_v__ast__Type_arr_eq(a.val_types, b.val_types) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.key_type, b.key_type) + && v__ast__Type_alias_eq(a.value_type, b.value_type); +} + +static bool v__ast__MatchBranch_struct_eq(v__ast__MatchBranch a, v__ast__MatchBranch b) { + return Array_Array_v__ast__Comment_arr_eq(a.ecmnts, b.ecmnts) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_else == b.is_else + && Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && v__token__Pos_struct_eq(a.branch_pos, b.branch_pos) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && a.scope == b.scope; +} + +static bool Array_v__ast__MatchBranch_arr_eq(Array_v__ast__MatchBranch a, Array_v__ast__MatchBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__MatchBranch_struct_eq(((v__ast__MatchBranch*)a.data)[i], ((v__ast__MatchBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__MatchExpr_struct_eq(v__ast__MatchExpr a, v__ast__MatchExpr b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__MatchBranch_arr_eq(a.branches, b.branches) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.return_type, b.return_type) + && v__ast__Type_alias_eq(a.cond_type, b.cond_type) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type) + && a.tok_kind == b.tok_kind + && a.is_expr == b.is_expr + && a.is_sum_type == b.is_sum_type; +} + +static bool v__ast__NodeError_struct_eq(v__ast__NodeError a, v__ast__NodeError b) { + return a.idx == b.idx + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__None_struct_eq(v__ast__None a, v__ast__None b) { + return v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__OffsetOf_struct_eq(v__ast__OffsetOf a, v__ast__OffsetOf b) { + return string__eq(a.field, b.field) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.struct_type, b.struct_type); +} + +static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool v__ast__PostfixExpr_struct_eq(v__ast__PostfixExpr a, v__ast__PostfixExpr b) { + return a.op == b.op + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.auto_locked, b.auto_locked); +} + +static bool v__ast__PrefixExpr_struct_eq(v__ast__PrefixExpr a, v__ast__PrefixExpr b) { + return v__ast__OrExpr_struct_eq(a.or_block, b.or_block) + && v__ast__Expr_sumtype_eq(a.right, b.right) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.right_type, b.right_type) + && a.op == b.op + && a.is_option == b.is_option; +} + +static bool v__ast__RangeExpr_struct_eq(v__ast__RangeExpr a, v__ast__RangeExpr b) { + return v__ast__Expr_sumtype_eq(a.low, b.low) + && v__ast__Expr_sumtype_eq(a.high, b.high) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_high == b.has_high + && a.has_low == b.has_low + && a.is_gated == b.is_gated; +} + +static bool v__ast__SelectBranch_struct_eq(v__ast__SelectBranch a, v__ast__SelectBranch b) { + return v__ast__Comment_struct_eq(a.comment, b.comment) + && Array_v__ast__Comment_arr_eq(a.post_comments, b.post_comments) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && v__ast__Stmt_sumtype_eq(a.stmt, b.stmt) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_else == b.is_else + && a.is_timeout == b.is_timeout; +} + +static bool Array_v__ast__SelectBranch_arr_eq(Array_v__ast__SelectBranch a, Array_v__ast__SelectBranch b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__SelectBranch_struct_eq(((v__ast__SelectBranch*)a.data)[i], ((v__ast__SelectBranch*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SelectExpr_struct_eq(v__ast__SelectExpr a, v__ast__SelectExpr b) { + return Array_v__ast__SelectBranch_arr_eq(a.branches, b.branches) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.has_exception == b.has_exception + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.expected_type, b.expected_type); +} + +static bool v__ast__SelectorExpr_struct_eq(v__ast__SelectorExpr a, v__ast__SelectorExpr b) { + return Array_v__ast__Type_arr_eq(a.from_embed_types, b.from_embed_types) + && string__eq(a.field_name, b.field_name) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.mut_pos, b.mut_pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.name_type, b.name_type) + && a.next_token == b.next_token + && a.gkind_field == b.gkind_field + && a.is_mut == b.is_mut + && a.has_hidden_receiver == b.has_hidden_receiver; +} + +static bool v__ast__SizeOf_struct_eq(v__ast__SizeOf a, v__ast__SizeOf b) { + return a.is_type == b.is_type + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__TypeNode_struct_eq(v__ast__TypeNode a, v__ast__TypeNode b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__StructField_arr_eq(Array_v__ast__StructField a, Array_v__ast__StructField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructField_struct_eq(((v__ast__StructField*)a.data)[i], ((v__ast__StructField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool Map_int_v__ast__SqlExpr_map_eq(Map_int_v__ast__SqlExpr a, Map_int_v__ast__SqlExpr b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + v__ast__SqlExpr v = *(v__ast__SqlExpr*)map_get(&a, k, &(v__ast__SqlExpr[]){ 0 }); + if (!v__ast__SqlExpr_struct_eq(*(v__ast__SqlExpr*)map_get(&b, k, &(v__ast__SqlExpr[]){ 0 }), v)) { + return false; + } + } + return true; +} + +static bool v__ast__SqlExpr_struct_eq(v__ast__SqlExpr a, v__ast__SqlExpr b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && a.is_count == b.is_count + && a.has_where == b.has_where + && a.has_order == b.has_order + && a.has_limit == b.has_limit + && a.has_offset == b.has_offset + && a.has_desc == b.has_desc + && a.is_array == b.is_array + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.db_expr, b.db_expr) + && v__ast__Expr_sumtype_eq(a.where_expr, b.where_expr) + && v__ast__Expr_sumtype_eq(a.order_expr, b.order_expr) + && v__ast__Expr_sumtype_eq(a.limit_expr, b.limit_expr) + && v__ast__Expr_sumtype_eq(a.offset_expr, b.offset_expr) + && v__ast__TypeNode_struct_eq(a.table_expr, b.table_expr) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Map_int_v__ast__SqlExpr_map_eq(a.sub_structs, b.sub_structs); +} + +static bool Array_int_arr_eq(Array_int a, Array_int b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (*((int*)((byte*)a.data+(i*a.element_size))) != *((int*)((byte*)b.data+(i*b.element_size)))) { + return false; + } + } + return true; +} + +static bool Array_v__token__Pos_arr_eq(Array_v__token__Pos a, Array_v__token__Pos b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__token__Pos_struct_eq(((v__token__Pos*)a.data)[i], ((v__token__Pos*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StringInterLiteral_struct_eq(v__ast__StringInterLiteral a, v__ast__StringInterLiteral b) { + return Array_string_arr_eq(a.vals, b.vals) + && Array_int_arr_eq(a.fwidths, b.fwidths) + && Array_int_arr_eq(a.precisions, b.precisions) + && Array_bool_arr_eq(a.pluss, b.pluss) + && Array_bool_arr_eq(a.fills, b.fills) + && Array_v__token__Pos_arr_eq(a.fmt_poss, b.fmt_poss) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.expr_types, b.expr_types) + && Array_u8_arr_eq(a.fmts, b.fmts) + && Array_bool_arr_eq(a.need_fmts, b.need_fmts); +} + +static bool v__ast__StringLiteral_struct_eq(v__ast__StringLiteral a, v__ast__StringLiteral b) { + return string__eq(a.val, b.val) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.language == b.language + && a.is_raw == b.is_raw; +} + +static bool v__ast__StructInitField_struct_eq(v__ast__StructInitField a, v__ast__StructInitField b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type) + && v__ast__Type_alias_eq(a.parent_type, b.parent_type); +} + +static bool Array_v__ast__StructInitField_arr_eq(Array_v__ast__StructInitField a, Array_v__ast__StructInitField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructInitField_struct_eq(((v__ast__StructInitField*)a.data)[i], ((v__ast__StructInitField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructInitEmbed_struct_eq(v__ast__StructInitEmbed a, v__ast__StructInitEmbed b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.expected_type, b.expected_type); +} + +static bool Array_v__ast__StructInitEmbed_arr_eq(Array_v__ast__StructInitEmbed a, Array_v__ast__StructInitEmbed b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__StructInitEmbed_struct_eq(((v__ast__StructInitEmbed*)a.data)[i], ((v__ast__StructInitEmbed*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructInit_struct_eq(v__ast__StructInit a, v__ast__StructInit b) { + return Array_v__ast__Comment_arr_eq(a.pre_comments, b.pre_comments) + && Array_v__ast__Comment_arr_eq(a.update_expr_comments, b.update_expr_comments) + && Array_v__ast__StructInitField_arr_eq(a.fields, b.fields) + && Array_v__ast__StructInitEmbed_arr_eq(a.embeds, b.embeds) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && string__eq(a.typ_str, b.typ_str) + && v__ast__Expr_sumtype_eq(a.update_expr, b.update_expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__ast__Type_alias_eq(a.update_expr_type, b.update_expr_type) + && a.is_short == b.is_short + && a.is_short_syntax == b.is_short_syntax + && a.unresolved == b.unresolved + && a.is_update_embed == b.is_update_embed + && a.has_update_expr == b.has_update_expr; +} + +static bool v__ast__TypeOf_struct_eq(v__ast__TypeOf a, v__ast__TypeOf b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.expr_type, b.expr_type); +} + +static bool v__ast__UnsafeExpr_struct_eq(v__ast__UnsafeExpr a, v__ast__UnsafeExpr b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool v__ast__Expr_sumtype_eq(v__ast__Expr a, v__ast__Expr b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 287) { + return v__ast__AnonFn_struct_eq(*a._v__ast__AnonFn, *b._v__ast__AnonFn); + } + if (a._typ == 288) { + return v__ast__ArrayDecompose_struct_eq(*a._v__ast__ArrayDecompose, *b._v__ast__ArrayDecompose); + } + if (a._typ == 289) { + return v__ast__ArrayInit_struct_eq(*a._v__ast__ArrayInit, *b._v__ast__ArrayInit); + } + if (a._typ == 290) { + return v__ast__AsCast_struct_eq(*a._v__ast__AsCast, *b._v__ast__AsCast); + } + if (a._typ == 291) { + return v__ast__Assoc_struct_eq(*a._v__ast__Assoc, *b._v__ast__Assoc); + } + if (a._typ == 292) { + return v__ast__AtExpr_struct_eq(*a._v__ast__AtExpr, *b._v__ast__AtExpr); + } + if (a._typ == 293) { + return v__ast__BoolLiteral_struct_eq(*a._v__ast__BoolLiteral, *b._v__ast__BoolLiteral); + } + if (a._typ == 294) { + return v__ast__CTempVar_struct_eq(*a._v__ast__CTempVar, *b._v__ast__CTempVar); + } + if (a._typ == 295) { + return v__ast__CallExpr_struct_eq(*a._v__ast__CallExpr, *b._v__ast__CallExpr); + } + if (a._typ == 296) { + return v__ast__CastExpr_struct_eq(*a._v__ast__CastExpr, *b._v__ast__CastExpr); + } + if (a._typ == 297) { + return v__ast__ChanInit_struct_eq(*a._v__ast__ChanInit, *b._v__ast__ChanInit); + } + if (a._typ == 298) { + return v__ast__CharLiteral_struct_eq(*a._v__ast__CharLiteral, *b._v__ast__CharLiteral); + } + if (a._typ == 299) { + return v__ast__Comment_struct_eq(*a._v__ast__Comment, *b._v__ast__Comment); + } + if (a._typ == 300) { + return v__ast__ComptimeCall_struct_eq(*a._v__ast__ComptimeCall, *b._v__ast__ComptimeCall); + } + if (a._typ == 301) { + return v__ast__ComptimeSelector_struct_eq(*a._v__ast__ComptimeSelector, *b._v__ast__ComptimeSelector); + } + if (a._typ == 302) { + return v__ast__ComptimeType_struct_eq(*a._v__ast__ComptimeType, *b._v__ast__ComptimeType); + } + if (a._typ == 303) { + return v__ast__ConcatExpr_struct_eq(*a._v__ast__ConcatExpr, *b._v__ast__ConcatExpr); + } + if (a._typ == 304) { + return v__ast__DumpExpr_struct_eq(*a._v__ast__DumpExpr, *b._v__ast__DumpExpr); + } + if (a._typ == 305) { + return v__ast__EmptyExpr_struct_eq(*a._v__ast__EmptyExpr, *b._v__ast__EmptyExpr); + } + if (a._typ == 306) { + return v__ast__EnumVal_struct_eq(*a._v__ast__EnumVal, *b._v__ast__EnumVal); + } + if (a._typ == 307) { + return v__ast__FloatLiteral_struct_eq(*a._v__ast__FloatLiteral, *b._v__ast__FloatLiteral); + } + if (a._typ == 308) { + return v__ast__GoExpr_struct_eq(*a._v__ast__GoExpr, *b._v__ast__GoExpr); + } + if (a._typ == 309) { + return v__ast__Ident_struct_eq(*a._v__ast__Ident, *b._v__ast__Ident); + } + if (a._typ == 310) { + return v__ast__IfExpr_struct_eq(*a._v__ast__IfExpr, *b._v__ast__IfExpr); + } + if (a._typ == 311) { + return v__ast__IfGuardExpr_struct_eq(*a._v__ast__IfGuardExpr, *b._v__ast__IfGuardExpr); + } + if (a._typ == 312) { + return v__ast__IndexExpr_struct_eq(*a._v__ast__IndexExpr, *b._v__ast__IndexExpr); + } + if (a._typ == 313) { + return v__ast__InfixExpr_struct_eq(*a._v__ast__InfixExpr, *b._v__ast__InfixExpr); + } + if (a._typ == 314) { + return v__ast__IntegerLiteral_struct_eq(*a._v__ast__IntegerLiteral, *b._v__ast__IntegerLiteral); + } + if (a._typ == 315) { + return v__ast__IsRefType_struct_eq(*a._v__ast__IsRefType, *b._v__ast__IsRefType); + } + if (a._typ == 316) { + return v__ast__Likely_struct_eq(*a._v__ast__Likely, *b._v__ast__Likely); + } + if (a._typ == 317) { + return v__ast__LockExpr_struct_eq(*a._v__ast__LockExpr, *b._v__ast__LockExpr); + } + if (a._typ == 318) { + return v__ast__MapInit_struct_eq(*a._v__ast__MapInit, *b._v__ast__MapInit); + } + if (a._typ == 319) { + return v__ast__MatchExpr_struct_eq(*a._v__ast__MatchExpr, *b._v__ast__MatchExpr); + } + if (a._typ == 320) { + return v__ast__NodeError_struct_eq(*a._v__ast__NodeError, *b._v__ast__NodeError); + } + if (a._typ == 321) { + return v__ast__None_struct_eq(*a._v__ast__None, *b._v__ast__None); + } + if (a._typ == 322) { + return v__ast__OffsetOf_struct_eq(*a._v__ast__OffsetOf, *b._v__ast__OffsetOf); + } + if (a._typ == 323) { + return v__ast__OrExpr_struct_eq(*a._v__ast__OrExpr, *b._v__ast__OrExpr); + } + if (a._typ == 324) { + return v__ast__ParExpr_struct_eq(*a._v__ast__ParExpr, *b._v__ast__ParExpr); + } + if (a._typ == 325) { + return v__ast__PostfixExpr_struct_eq(*a._v__ast__PostfixExpr, *b._v__ast__PostfixExpr); + } + if (a._typ == 326) { + return v__ast__PrefixExpr_struct_eq(*a._v__ast__PrefixExpr, *b._v__ast__PrefixExpr); + } + if (a._typ == 327) { + return v__ast__RangeExpr_struct_eq(*a._v__ast__RangeExpr, *b._v__ast__RangeExpr); + } + if (a._typ == 328) { + return v__ast__SelectExpr_struct_eq(*a._v__ast__SelectExpr, *b._v__ast__SelectExpr); + } + if (a._typ == 329) { + return v__ast__SelectorExpr_struct_eq(*a._v__ast__SelectorExpr, *b._v__ast__SelectorExpr); + } + if (a._typ == 330) { + return v__ast__SizeOf_struct_eq(*a._v__ast__SizeOf, *b._v__ast__SizeOf); + } + if (a._typ == 331) { + return v__ast__SqlExpr_struct_eq(*a._v__ast__SqlExpr, *b._v__ast__SqlExpr); + } + if (a._typ == 332) { + return v__ast__StringInterLiteral_struct_eq(*a._v__ast__StringInterLiteral, *b._v__ast__StringInterLiteral); + } + if (a._typ == 333) { + return v__ast__StringLiteral_struct_eq(*a._v__ast__StringLiteral, *b._v__ast__StringLiteral); + } + if (a._typ == 334) { + return v__ast__StructInit_struct_eq(*a._v__ast__StructInit, *b._v__ast__StructInit); + } + if (a._typ == 335) { + return v__ast__TypeNode_struct_eq(*a._v__ast__TypeNode, *b._v__ast__TypeNode); + } + if (a._typ == 336) { + return v__ast__TypeOf_struct_eq(*a._v__ast__TypeOf, *b._v__ast__TypeOf); + } + if (a._typ == 337) { + return v__ast__UnsafeExpr_struct_eq(*a._v__ast__UnsafeExpr, *b._v__ast__UnsafeExpr); + } + return false; +} + +static bool v__ast__AsmIO_struct_eq(v__ast__AsmIO a, v__ast__AsmIO b) { + return string__eq(a.alias, b.alias) + && string__eq(a.constraint, b.constraint) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool Array_v__ast__AsmIO_arr_eq(Array_v__ast__AsmIO a, Array_v__ast__AsmIO b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__AsmIO_struct_eq(((v__ast__AsmIO*)a.data)[i], ((v__ast__AsmIO*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__AsmStmt_struct_eq(v__ast__AsmStmt a, v__ast__AsmStmt b) { + return Array_v__ast__AsmClobbered_arr_eq(a.clobbered, b.clobbered) + && Array_v__ast__AsmTemplate_arr_eq(a.templates, b.templates) + && Array_v__ast__AsmIO_arr_eq(a.output, b.output) + && Array_v__ast__AsmIO_arr_eq(a.input, b.input) + && Array_string_arr_eq(a.global_labels, b.global_labels) + && Array_string_arr_eq(a.local_labels, b.local_labels) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.arch == b.arch + && a.is_basic == b.is_basic + && a.is_volatile == b.is_volatile + && a.is_goto == b.is_goto; +} + +static bool v__ast__AssertStmt_struct_eq(v__ast__AssertStmt a, v__ast__AssertStmt b) { + return v__ast__Expr_sumtype_eq(a.expr, b.expr) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_used == b.is_used; +} + +static bool v__ast__AssignStmt_struct_eq(v__ast__AssignStmt a, v__ast__AssignStmt b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Expr_arr_eq(a.right, b.right) + && Array_v__ast__Expr_arr_eq(a.left, b.left) + && Array_v__ast__Type_arr_eq(a.left_types, b.left_types) + && Array_v__ast__Type_arr_eq(a.right_types, b.right_types) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.op == b.op + && a.is_static == b.is_static + && a.is_volatile == b.is_volatile + && a.is_simple == b.is_simple + && a.has_cross_var == b.has_cross_var; +} + +static bool v__ast__Block_struct_eq(v__ast__Block a, v__ast__Block b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.is_unsafe == b.is_unsafe + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__BranchStmt_struct_eq(v__ast__BranchStmt a, v__ast__BranchStmt b) { + return string__eq(a.label, b.label) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.kind == b.kind; +} + +static bool v__ast__ComptimeFor_struct_eq(v__ast__ComptimeFor a, v__ast__ComptimeFor b) { + return string__eq(a.val_var, b.val_var) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.typ_pos, b.typ_pos) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool Array_v__ast__ConstField_arr_eq(Array_v__ast__ConstField a, Array_v__ast__ConstField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__ConstField_struct_eq(((v__ast__ConstField*)a.data)[i], ((v__ast__ConstField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__ConstDecl_struct_eq(v__ast__ConstDecl a, v__ast__ConstDecl b) { + return Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__ConstField_arr_eq(a.fields, b.fields) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_pub == b.is_pub + && a.is_block == b.is_block; +} + +static bool v__ast__EmptyStmt_struct_eq(v__ast__EmptyStmt a, v__ast__EmptyStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__EnumField_struct_eq(v__ast__EnumField a, v__ast__EnumField b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Comment_arr_eq(a.next_comments, b.next_comments) + && a.has_expr == b.has_expr + && v__ast__Expr_sumtype_eq(a.expr, b.expr); +} + +static bool Array_v__ast__EnumField_arr_eq(Array_v__ast__EnumField a, Array_v__ast__EnumField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__EnumField_struct_eq(((v__ast__EnumField*)a.data)[i], ((v__ast__EnumField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__EnumDecl_struct_eq(v__ast__EnumDecl a, v__ast__EnumDecl b) { + return Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__EnumField_arr_eq(a.fields, b.fields) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_pub == b.is_pub + && a.is_flag == b.is_flag + && a.is_multi_allowed == b.is_multi_allowed; +} + +static bool v__ast__ExprStmt_struct_eq(v__ast__ExprStmt a, v__ast__ExprStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Expr_sumtype_eq(a.expr, b.expr) + && a.is_expr == b.is_expr + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__ast__ForCStmt_struct_eq(v__ast__ForCStmt a, v__ast__ForCStmt b) { + return a.has_init == b.has_init + && a.has_cond == b.has_cond + && a.has_inc == b.has_inc + && a.is_multi == b.is_multi + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Stmt_sumtype_eq(a.init, b.init) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && v__ast__Stmt_sumtype_eq(a.inc, b.inc) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.label, b.label) + && a.scope == b.scope; +} + +static bool v__ast__ForInStmt_struct_eq(v__ast__ForInStmt a, v__ast__ForInStmt b) { + return Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.key_var, b.key_var) + && string__eq(a.val_var, b.val_var) + && v__ast__Expr_sumtype_eq(a.high, b.high) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && string__eq(a.label, b.label) + && a.scope == b.scope + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.key_type, b.key_type) + && v__ast__Type_alias_eq(a.val_type, b.val_type) + && v__ast__Type_alias_eq(a.cond_type, b.cond_type) + && v__ast__Type_alias_eq(a.high_type, b.high_type) + && a.kind == b.kind + && a.is_range == b.is_range + && a.val_is_mut == b.val_is_mut; +} + +static bool v__ast__ForStmt_struct_eq(v__ast__ForStmt a, v__ast__ForStmt b) { + return a.is_inf == b.is_inf + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.cond, b.cond) + && Array_v__ast__Stmt_arr_eq(a.stmts, b.stmts) + && string__eq(a.label, b.label) + && a.scope == b.scope; +} + +static bool Array_v__ast__GlobalField_arr_eq(Array_v__ast__GlobalField a, Array_v__ast__GlobalField b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__GlobalField_struct_eq(((v__ast__GlobalField*)a.data)[i], ((v__ast__GlobalField*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__GlobalDecl_struct_eq(v__ast__GlobalDecl a, v__ast__GlobalDecl b) { + return string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.is_block == b.is_block + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__GlobalField_arr_eq(a.fields, b.fields) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments); +} + +static bool v__ast__GotoLabel_struct_eq(v__ast__GotoLabel a, v__ast__GotoLabel b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__GotoStmt_struct_eq(v__ast__GotoStmt a, v__ast__GotoStmt b) { + return string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos); +} + +static bool v__ast__HashStmt_struct_eq(v__ast__HashStmt a, v__ast__HashStmt b) { + return string__eq(a.mod, b.mod) + && v__token__Pos_struct_eq(a.pos, b.pos) + && string__eq(a.source_file, b.source_file) + && string__eq(a.val, b.val) + && string__eq(a.kind, b.kind) + && string__eq(a.main, b.main) + && string__eq(a.msg, b.msg) + && Array_v__ast__Expr_arr_eq(a.ct_conds, b.ct_conds); +} + +static bool Array_v__ast__FnDecl_arr_eq(Array_v__ast__FnDecl a, Array_v__ast__FnDecl b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__FnDecl_struct_eq(((v__ast__FnDecl*)a.data)[i], ((v__ast__FnDecl*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__InterfaceEmbedding_struct_eq(v__ast__InterfaceEmbedding a, v__ast__InterfaceEmbedding b) { + return string__eq(a.name, b.name) + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__InterfaceEmbedding_arr_eq(Array_v__ast__InterfaceEmbedding a, Array_v__ast__InterfaceEmbedding b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__InterfaceEmbedding_struct_eq(((v__ast__InterfaceEmbedding*)a.data)[i], ((v__ast__InterfaceEmbedding*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__InterfaceDecl_struct_eq(v__ast__InterfaceDecl a, v__ast__InterfaceDecl b) { + return Array_string_arr_eq(a.field_names, b.field_names) + && Array_v__ast__Comment_arr_eq(a.pre_comments, b.pre_comments) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__FnDecl_arr_eq(a.methods, b.methods) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Array_v__ast__InterfaceEmbedding_arr_eq(a.embeds, b.embeds) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Type_alias_eq(a.typ, b.typ) + && a.mut_pos == b.mut_pos + && a.language == b.language + && a.is_pub == b.is_pub + && a.are_embeds_expanded == b.are_embeds_expanded; +} + +static bool v__ast__Return_struct_eq(v__ast__Return a, v__ast__Return b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Expr_arr_eq(a.exprs, b.exprs) + && Array_v__ast__Type_arr_eq(a.types, b.types); +} + +static bool Map_int_v__ast__SqlStmtLine_map_eq(Map_int_v__ast__SqlStmtLine a, Map_int_v__ast__SqlStmtLine b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.key_values.len; ++i) { + if (!DenseArray_has_index(&a.key_values, i)) continue; + voidptr k = DenseArray_key(&a.key_values, i); + if (!map_exists(&b, k)) return false; + v__ast__SqlStmtLine v = *(v__ast__SqlStmtLine*)map_get(&a, k, &(v__ast__SqlStmtLine[]){ 0 }); + if (!v__ast__SqlStmtLine_struct_eq(*(v__ast__SqlStmtLine*)map_get(&b, k, &(v__ast__SqlStmtLine[]){ 0 }), v)) { + return false; + } + } + return true; +} + +static bool v__ast__SqlStmtLine_struct_eq(v__ast__SqlStmtLine a, v__ast__SqlStmtLine b) { + return a.kind == b.kind + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.where_expr, b.where_expr) + && Array_v__ast__Expr_arr_eq(a.update_exprs, b.update_exprs) + && string__eq(a.object_var_name, b.object_var_name) + && Array_string_arr_eq(a.updated_columns, b.updated_columns) + && v__ast__TypeNode_struct_eq(a.table_expr, b.table_expr) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && Map_int_v__ast__SqlStmtLine_map_eq(a.sub_structs, b.sub_structs); +} + +static bool Array_v__ast__SqlStmtLine_arr_eq(Array_v__ast__SqlStmtLine a, Array_v__ast__SqlStmtLine b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__SqlStmtLine_struct_eq(((v__ast__SqlStmtLine*)a.data)[i], ((v__ast__SqlStmtLine*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SqlStmt_struct_eq(v__ast__SqlStmt a, v__ast__SqlStmt b) { + return v__token__Pos_struct_eq(a.pos, b.pos) + && v__ast__Expr_sumtype_eq(a.db_expr, b.db_expr) + && Array_v__ast__SqlStmtLine_arr_eq(a.lines, b.lines); +} + +static bool v__ast__Embed_struct_eq(v__ast__Embed a, v__ast__Embed b) { + return v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool Array_v__ast__Embed_arr_eq(Array_v__ast__Embed a, Array_v__ast__Embed b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__Embed_struct_eq(((v__ast__Embed*)a.data)[i], ((v__ast__Embed*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__StructDecl_struct_eq(v__ast__StructDecl a, v__ast__StructDecl b) { + return Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__Comment_arr_eq(a.end_comments, b.end_comments) + && Array_v__ast__Embed_arr_eq(a.embeds, b.embeds) + && Array_v__ast__StructField_arr_eq(a.fields, b.fields) + && string__eq(a.name, b.name) + && v__token__Pos_struct_eq(a.pos, b.pos) + && a.mut_pos == b.mut_pos + && a.pub_pos == b.pub_pos + && a.pub_mut_pos == b.pub_mut_pos + && a.global_pos == b.global_pos + && a.module_pos == b.module_pos + && a.language == b.language + && a.is_pub == b.is_pub + && a.is_union == b.is_union; +} + +static bool v__ast__AliasTypeDecl_struct_eq(v__ast__AliasTypeDecl a, v__ast__AliasTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__ast__Type_alias_eq(a.parent_type, b.parent_type) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments); +} + +static bool v__ast__FnTypeDecl_struct_eq(v__ast__FnTypeDecl a, v__ast__FnTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__ast__Type_alias_eq(a.typ, b.typ) + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.type_pos, b.type_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs); +} + +static bool Array_v__ast__TypeNode_arr_eq(Array_v__ast__TypeNode a, Array_v__ast__TypeNode b) { + if (a.len != b.len) { + return false; + } + for (int i = 0; i < a.len; ++i) { + if (!v__ast__TypeNode_struct_eq(((v__ast__TypeNode*)a.data)[i], ((v__ast__TypeNode*)b.data)[i])) { + return false; + } + } + return true; +} + +static bool v__ast__SumTypeDecl_struct_eq(v__ast__SumTypeDecl a, v__ast__SumTypeDecl b) { + return string__eq(a.name, b.name) + && a.is_pub == b.is_pub + && v__token__Pos_struct_eq(a.pos, b.pos) + && v__token__Pos_struct_eq(a.name_pos, b.name_pos) + && Array_v__ast__Comment_arr_eq(a.comments, b.comments) + && v__ast__Type_alias_eq(a.typ, b.typ) + && Array_v__ast__Type_arr_eq(a.generic_types, b.generic_types) + && Array_v__ast__Attr_arr_eq(a.attrs, b.attrs) + && Array_v__ast__TypeNode_arr_eq(a.variants, b.variants); +} + +static bool v__ast__TypeDecl_sumtype_eq(v__ast__TypeDecl a, v__ast__TypeDecl b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 283) { + return v__ast__AliasTypeDecl_struct_eq(*a._v__ast__AliasTypeDecl, *b._v__ast__AliasTypeDecl); + } + if (a._typ == 284) { + return v__ast__FnTypeDecl_struct_eq(*a._v__ast__FnTypeDecl, *b._v__ast__FnTypeDecl); + } + if (a._typ == 285) { + return v__ast__SumTypeDecl_struct_eq(*a._v__ast__SumTypeDecl, *b._v__ast__SumTypeDecl); + } + return false; +} + +static bool v__ast__Stmt_sumtype_eq(v__ast__Stmt a, v__ast__Stmt b) { + if (a._typ != b._typ) { return false; } + if (a._typ == 339) { + return v__ast__AsmStmt_struct_eq(*a._v__ast__AsmStmt, *b._v__ast__AsmStmt); + } + if (a._typ == 340) { + return v__ast__AssertStmt_struct_eq(*a._v__ast__AssertStmt, *b._v__ast__AssertStmt); + } + if (a._typ == 341) { + return v__ast__AssignStmt_struct_eq(*a._v__ast__AssignStmt, *b._v__ast__AssignStmt); + } + if (a._typ == 342) { + return v__ast__Block_struct_eq(*a._v__ast__Block, *b._v__ast__Block); + } + if (a._typ == 343) { + return v__ast__BranchStmt_struct_eq(*a._v__ast__BranchStmt, *b._v__ast__BranchStmt); + } + if (a._typ == 344) { + return v__ast__ComptimeFor_struct_eq(*a._v__ast__ComptimeFor, *b._v__ast__ComptimeFor); + } + if (a._typ == 345) { + return v__ast__ConstDecl_struct_eq(*a._v__ast__ConstDecl, *b._v__ast__ConstDecl); + } + if (a._typ == 346) { + return v__ast__DeferStmt_struct_eq(*a._v__ast__DeferStmt, *b._v__ast__DeferStmt); + } + if (a._typ == 347) { + return v__ast__EmptyStmt_struct_eq(*a._v__ast__EmptyStmt, *b._v__ast__EmptyStmt); + } + if (a._typ == 348) { + return v__ast__EnumDecl_struct_eq(*a._v__ast__EnumDecl, *b._v__ast__EnumDecl); + } + if (a._typ == 349) { + return v__ast__ExprStmt_struct_eq(*a._v__ast__ExprStmt, *b._v__ast__ExprStmt); + } + if (a._typ == 220) { + return v__ast__FnDecl_struct_eq(*a._v__ast__FnDecl, *b._v__ast__FnDecl); + } + if (a._typ == 350) { + return v__ast__ForCStmt_struct_eq(*a._v__ast__ForCStmt, *b._v__ast__ForCStmt); + } + if (a._typ == 351) { + return v__ast__ForInStmt_struct_eq(*a._v__ast__ForInStmt, *b._v__ast__ForInStmt); + } + if (a._typ == 352) { + return v__ast__ForStmt_struct_eq(*a._v__ast__ForStmt, *b._v__ast__ForStmt); + } + if (a._typ == 353) { + return v__ast__GlobalDecl_struct_eq(*a._v__ast__GlobalDecl, *b._v__ast__GlobalDecl); + } + if (a._typ == 354) { + return v__ast__GotoLabel_struct_eq(*a._v__ast__GotoLabel, *b._v__ast__GotoLabel); + } + if (a._typ == 355) { + return v__ast__GotoStmt_struct_eq(*a._v__ast__GotoStmt, *b._v__ast__GotoStmt); + } + if (a._typ == 356) { + return v__ast__HashStmt_struct_eq(*a._v__ast__HashStmt, *b._v__ast__HashStmt); + } + if (a._typ == 357) { + return v__ast__Import_struct_eq(*a._v__ast__Import, *b._v__ast__Import); + } + if (a._typ == 358) { + return v__ast__InterfaceDecl_struct_eq(*a._v__ast__InterfaceDecl, *b._v__ast__InterfaceDecl); + } + if (a._typ == 359) { + return v__ast__Module_struct_eq(*a._v__ast__Module, *b._v__ast__Module); + } + if (a._typ == 320) { + return v__ast__NodeError_struct_eq(*a._v__ast__NodeError, *b._v__ast__NodeError); + } + if (a._typ == 360) { + return v__ast__Return_struct_eq(*a._v__ast__Return, *b._v__ast__Return); + } + if (a._typ == 361) { + return v__ast__SqlStmt_struct_eq(*a._v__ast__SqlStmt, *b._v__ast__SqlStmt); + } + if (a._typ == 362) { + return v__ast__StructDecl_struct_eq(*a._v__ast__StructDecl, *b._v__ast__StructDecl); + } + if (a._typ == 286) { + return v__ast__TypeDecl_sumtype_eq(*a._v__ast__TypeDecl, *b._v__ast__TypeDecl); + } + return false; +} + +static bool v__gen__c__StrType_struct_eq(v__gen__c__StrType a, v__gen__c__StrType b) { + return string__eq(a.styp, b.styp) + && v__ast__Type_alias_eq(a.typ, b.typ); +} + +static bool v__gen__c__SumtypeCastingFn_struct_eq(v__gen__c__SumtypeCastingFn a, v__gen__c__SumtypeCastingFn b) { + return string__eq(a.fn_name, b.fn_name) + && v__ast__Type_alias_eq(a.got, b.got) + && v__ast__Type_alias_eq(a.exp, b.exp); +} + void v__ast__Param_free(v__ast__Param* it) { string_free(&(it->name)); v__token__Pos_free(&(it->pos)); @@ -12454,15 +14612,15 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_Error_index) return 85; if (sidx == _IError_MessageError_index) return 86; if (sidx == _IError_time__TimeParseError_index) return 259; - if (sidx == _IError_flag__UnkownFlagError_index) return 66133; - if (sidx == _IError_flag__ArgsCountError_index) return 66134; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66145; - if (sidx == _IError_semver__EmptyInputError_index) return 66147; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66148; - if (sidx == _IError_os__FileNotOpenedError_index) return 65659; - if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65660; - if (sidx == _IError_os__ExecutableNotFoundError_index) return 65674; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 542; + if (sidx == _IError_flag__UnkownFlagError_index) return 66134; + if (sidx == _IError_flag__ArgsCountError_index) return 66135; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66146; + if (sidx == _IError_semver__EmptyInputError_index) return 66148; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66149; + if (sidx == _IError_os__FileNotOpenedError_index) return 65660; + if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65661; + if (sidx == _IError_os__ExecutableNotFoundError_index) return 65675; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 543; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -12830,43 +14988,43 @@ static int v_typeof_sumtype_idx_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ } static char * v_typeof_sumtype_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 489: return "v.ast.TypeInfo"; - case 472: return "v.ast.Aggregate"; - case 474: return "v.ast.Alias"; + case 490: return "v.ast.TypeInfo"; + case 473: return "v.ast.Aggregate"; + case 475: return "v.ast.Alias"; case 454: return "v.ast.Array"; - case 482: return "v.ast.ArrayFixed"; - case 483: return "v.ast.Chan"; - case 488: return "v.ast.Enum"; - case 486: return "v.ast.FnType"; - case 487: return "v.ast.GenericInst"; - case 477: return "v.ast.Interface"; + case 483: return "v.ast.ArrayFixed"; + case 484: return "v.ast.Chan"; + case 489: return "v.ast.Enum"; + case 487: return "v.ast.FnType"; + case 488: return "v.ast.GenericInst"; + case 478: return "v.ast.Interface"; case 455: return "v.ast.Map"; - case 485: return "v.ast.MultiReturn"; + case 486: return "v.ast.MultiReturn"; case 459: return "v.ast.Struct"; - case 478: return "v.ast.SumType"; - case 484: return "v.ast.Thread"; + case 479: return "v.ast.SumType"; + case 485: return "v.ast.Thread"; default: return "unknown v.ast.TypeInfo"; } } static int v_typeof_sumtype_idx_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 489: return 489; - case 472: return 472; - case 474: return 474; + case 490: return 490; + case 473: return 473; + case 475: return 475; case 454: return 454; - case 482: return 482; case 483: return 483; - case 488: return 488; - case 486: return 486; - case 487: return 487; - case 477: return 477; - case 455: return 455; - case 485: return 485; - case 459: return 459; - case 478: return 478; case 484: return 484; - default: return 489; + case 489: return 489; + case 487: return 487; + case 488: return 488; + case 478: return 478; + case 455: return 455; + case 486: return 486; + case 459: return 459; + case 479: return 479; + case 485: return 485; + default: return 490; } } static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ @@ -12874,21 +15032,21 @@ static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ } static int v_typeof_interface_idx_hash__Hasher(int sidx) { /* hash.Hasher */ - return 537; + return 538; } static char * v_typeof_interface_hash__Hash32er(int sidx) { /* hash.Hash32er */ return "unknown hash.Hash32er"; } static int v_typeof_interface_idx_hash__Hash32er(int sidx) { /* hash.Hash32er */ - return 538; + return 539; } static char * v_typeof_interface_hash__Hash64er(int sidx) { /* hash.Hash64er */ return "unknown hash.Hash64er"; } static int v_typeof_interface_idx_hash__Hash64er(int sidx) { /* hash.Hash64er */ - return 539; + return 540; } static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return "v.ast.walker.Inspector"; @@ -12897,9 +15055,9 @@ static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.wa } static int v_typeof_interface_idx_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ - if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 572; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66066; - return 570; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 573; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66067; + return 571; } // << typeof() support for sum types @@ -13264,70 +15422,56 @@ string strings__find_between_pair_string(string input, string start, string end) } int math__bits__leading_zeros_8(u8 x) { - int _t1 = 8 - math__bits__len_8(x); - return _t1; + return 8 - math__bits__len_8(x); } int math__bits__leading_zeros_16(u16 x) { - int _t1 = 16 - math__bits__len_16(x); - return _t1; + return 16 - math__bits__len_16(x); } int math__bits__leading_zeros_32(u32 x) { - int _t1 = 32 - math__bits__len_32(x); - return _t1; + return 32 - math__bits__len_32(x); } int math__bits__leading_zeros_64(u64 x) { - int _t1 = 64 - math__bits__len_64(x); - return _t1; + return 64 - math__bits__len_64(x); } int math__bits__trailing_zeros_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__ntz_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__ntz_8_tab, x)))); } int math__bits__trailing_zeros_16(u16 x) { if (x == 0U) { - int _t1 = 16; - return _t1; + return 16; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((u32)((x & -x))) * _const_math__bits__de_bruijn32 >> (27))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((u32)((x & -x))) * _const_math__bits__de_bruijn32 >> (27))))); } int math__bits__trailing_zeros_32(u32 x) { if (x == 0U) { - int _t1 = 32; - return _t1; + return 32; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((x & -x)) * _const_math__bits__de_bruijn32 >> (27))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn32tab, ((x & -x)) * _const_math__bits__de_bruijn32 >> (27))))); } int math__bits__trailing_zeros_64(u64 x) { if (x == 0U) { - int _t1 = 64; - return _t1; + return 64; } - int _t2 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn64tab, ((x & -x)) * _const_math__bits__de_bruijn64 >> (58))))); - return _t2; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__de_bruijn64tab, ((x & -x)) * _const_math__bits__de_bruijn64 >> (58))))); } int math__bits__ones_count_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x)))); } int math__bits__ones_count_16(u16 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 8U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u16)(0xffU))))))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 8U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u16)(0xffU))))))); } int math__bits__ones_count_32(u32 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 24U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 16U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 8U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u32)(0xffU))))))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, x >> 24U)) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 16U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x >> 8U & 0xffU))) + (*(u8*)/*ee elem_sym */array_get(_const_math__bits__pop_8_tab, (x & ((u32)(0xffU))))))); } int math__bits__ones_count_64(u64 x) { @@ -13337,52 +15481,41 @@ int math__bits__ones_count_64(u64 x) { y += y >> 8U; y += y >> 16U; y += y >> 32U; - int _t1 = (((int)(y)) & ((128) - 1)); - return _t1; + return (((int)(y)) & ((128) - 1)); } // Attr: [inline] inline u8 math__bits__rotate_left_8(u8 x, int k) { - u8 n = ((u8)(8)); - u8 s = (((u8)(k)) & (n - ((u8)(1)))); - u8 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u8 s = (((u8)(k)) & (_const_math__bits__n8 - ((u8)(1)))); + return ((x << s) | (x >> (_const_math__bits__n8 - s))); } // Attr: [inline] inline u16 math__bits__rotate_left_16(u16 x, int k) { - u16 n = ((u16)(16U)); - u16 s = (((u16)(k)) & (n - ((u16)(1U)))); - u16 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u16 s = (((u16)(k)) & (_const_math__bits__n16 - ((u16)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n16 - s))); } // Attr: [inline] inline u32 math__bits__rotate_left_32(u32 x, int k) { - u32 n = ((u32)(32U)); - u32 s = (((u32)(k)) & (n - ((u32)(1U)))); - u32 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u32 s = (((u32)(k)) & (_const_math__bits__n32 - ((u32)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n32 - s))); } // Attr: [inline] inline u64 math__bits__rotate_left_64(u64 x, int k) { - u64 n = ((u64)(64U)); - u64 s = (((u64)(k)) & (n - ((u64)(1U)))); - u64 _t1 = ((x << s) | (x >> (n - s))); - return _t1; + u64 s = (((u64)(k)) & (_const_math__bits__n64 - ((u64)(1U)))); + return ((x << s) | (x >> (_const_math__bits__n64 - s))); } // Attr: [inline] inline u8 math__bits__reverse_8(u8 x) { - u8 _t1 = (*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x)); - return _t1; + return (*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x)); } // Attr: [inline] inline u16 math__bits__reverse_16(u16 x) { - u16 _t1 = (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x >> 8U)))) | (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, (x & ((u16)(0xffU))))))) << 8U)); - return _t1; + return (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, x >> 8U)))) | (((u16)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__rev_8_tab, (x & ((u16)(0xffU))))))) << 8U)); } // Attr: [inline] @@ -13390,8 +15523,7 @@ inline u32 math__bits__reverse_32(u32 x) { u64 y = ((((x >> ((u32)(1U)) & ((_const_math__bits__m0 & _const_math__bits__max_u32)))) | (((x & ((_const_math__bits__m0 & _const_math__bits__max_u32)))) << 1U))); y = ((((y >> ((u32)(2U)) & ((_const_math__bits__m1 & _const_math__bits__max_u32)))) | (((y & ((_const_math__bits__m1 & _const_math__bits__max_u32)))) << ((u32)(2U))))); y = ((((y >> ((u32)(4U)) & ((_const_math__bits__m2 & _const_math__bits__max_u32)))) | (((y & ((_const_math__bits__m2 & _const_math__bits__max_u32)))) << ((u32)(4U))))); - u32 _t1 = math__bits__reverse_bytes_32(((u32)(y))); - return _t1; + return math__bits__reverse_bytes_32(((u32)(y))); } // Attr: [inline] @@ -13399,34 +15531,29 @@ inline u64 math__bits__reverse_64(u64 x) { u64 y = ((((x >> ((u64)(1U)) & ((_const_math__bits__m0 & _const_math__bits__max_u64)))) | (((x & ((_const_math__bits__m0 & _const_math__bits__max_u64)))) << 1U))); y = ((((y >> ((u64)(2U)) & ((_const_math__bits__m1 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m1 & _const_math__bits__max_u64)))) << 2U))); y = ((((y >> ((u64)(4U)) & ((_const_math__bits__m2 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m2 & _const_math__bits__max_u64)))) << 4U))); - u64 _t1 = math__bits__reverse_bytes_64(y); - return _t1; + return math__bits__reverse_bytes_64(y); } // Attr: [inline] inline u16 math__bits__reverse_bytes_16(u16 x) { - u16 _t1 = ((x >> 8U) | (x << 8U)); - return _t1; + return ((x >> 8U) | (x << 8U)); } // Attr: [inline] inline u32 math__bits__reverse_bytes_32(u32 x) { u64 y = ((((x >> ((u32)(8U)) & ((_const_math__bits__m3 & _const_math__bits__max_u32)))) | (((x & ((_const_math__bits__m3 & _const_math__bits__max_u32)))) << ((u32)(8U))))); - u32 _t1 = ((u32)(((y >> 16U) | (y << 16U)))); - return _t1; + return ((u32)(((y >> 16U) | (y << 16U)))); } // Attr: [inline] inline u64 math__bits__reverse_bytes_64(u64 x) { u64 y = ((((x >> ((u64)(8U)) & ((_const_math__bits__m3 & _const_math__bits__max_u64)))) | (((x & ((_const_math__bits__m3 & _const_math__bits__max_u64)))) << ((u64)(8U))))); y = ((((y >> ((u64)(16U)) & ((_const_math__bits__m4 & _const_math__bits__max_u64)))) | (((y & ((_const_math__bits__m4 & _const_math__bits__max_u64)))) << ((u64)(16U))))); - u64 _t1 = ((y >> 32U) | (y << 32U)); - return _t1; + return ((y >> 32U) | (y << 32U)); } int math__bits__len_8(u8 x) { - int _t1 = ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, x)))); - return _t1; + return ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, x)))); } int math__bits__len_16(u16 x) { @@ -13436,8 +15563,7 @@ int math__bits__len_16(u16 x) { y >>= 8U; n = 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } int math__bits__len_32(u32 x) { @@ -13451,8 +15577,7 @@ int math__bits__len_32(u32 x) { y >>= 8U; n += 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } int math__bits__len_64(u64 x) { @@ -13470,8 +15595,7 @@ int math__bits__len_64(u64 x) { y >>= 8U; n += 8; } - int _t1 = n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); - return _t1; + return n + ((int)((*(u8*)/*ee elem_sym */array_get(_const_math__bits__len_8_tab, y)))); } multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry) { @@ -13583,15 +15707,13 @@ multi_return_u64_u64 math__bits__div_64(u64 hi, u64 lo, u64 y1) { } u32 math__bits__rem_32(u32 hi, u32 lo, u32 y) { - u32 _t1 = ((u32)((((((u64)(hi)) << 32U) | ((u64)(lo)))) % ((u64)(y)))); - return _t1; + return ((u32)((((((u64)(hi)) << 32U) | ((u64)(lo)))) % ((u64)(y)))); } u64 math__bits__rem_64(u64 hi, u64 lo, u64 y) { - multi_return_u64_u64 mr_16589 = math__bits__div_64(hi % y, lo, y); - u64 rem = mr_16589.arg1; - u64 _t1 = rem; - return _t1; + multi_return_u64_u64 mr_16658 = math__bits__div_64(hi % y, lo, y); + u64 rem = mr_16658.arg1; + return rem; } multi_return_f64_int math__bits__normalize(f64 x) { @@ -14931,7 +17053,7 @@ void strconv__format_dec_sb(u64 d, strconv__BF_param p, strings__Builder* res) { // Attr: [direct_array_access] // Attr: [manualfree] -VV_LOCAL_SYMBOL string strconv__f64_to_str_lnd1(f64 f, int dec_digit) { +string strconv__f64_to_str_lnd1(f64 f, int dec_digit) { { // Unsafe block string s = strconv__f64_to_str(f + ((f64*)_const_strconv__dec_round.data)[dec_digit], 18); if (s.len > 2 && (s.str[ 0] == 'n' || s.str[ 1] == 'i')) { @@ -17405,16 +19527,28 @@ VV_LOCAL_SYMBOL void _write_buf_to_fd(int fd, u8* buf, int buf_len) { if (buf_len <= 0) { return; } - { // Unsafe block - u8* ptr = buf; - int remaining_bytes = buf_len; - for (;;) { - if (!(remaining_bytes > 0)) break; - int x = write(fd, ptr, remaining_bytes); - ptr += x; - remaining_bytes -= x; + u8* ptr = buf; + isize remaining_bytes = ((isize)(buf_len)); + isize x = ((isize)(0)); + #if defined(_VFREESTANDING) || defined(__vinix__) + { + } + #else + { + voidptr stream = ((voidptr)(stdout)); + if (fd == 2) { + stream = ((voidptr)(stderr)); + } + { // Unsafe block + for (;;) { + if (!(remaining_bytes > 0)) break; + x = ((isize)(fwrite(ptr, 1, remaining_bytes, stream))); + ptr += x; + remaining_bytes -= x; + } } } + #endif } // Attr: [unsafe] @@ -28043,6 +30177,53 @@ string os__norm_path(string path) { return _t8; } +_option_string os__existing_path(string path) { + IError err = _v_error(_SLIT("path does not exist")); + if (path.len == 0) { + return (_option_string){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (os__exists(path)) { + _option_string _t2; + opt_ok2(&(string[]) { path }, (_option*)(&_t2), sizeof(string)); + return _t2; + } + int volume_len = 0; + volume_len = os__win_volume_len(path); + if (volume_len > 0 && os__is_slash(string_at(path, volume_len - 1))) { + volume_len++; + } + strings__textscanner__TextScanner sc = strings__textscanner__new(string_substr(path, volume_len, (path).len)); + string recent_path = string_substr(path, 0, volume_len); + for (;;) { + if (!(strings__textscanner__TextScanner_next(&sc) != -1)) break; + u8 curr = ((u8)(strings__textscanner__TextScanner_current(&sc))); + int peek = strings__textscanner__TextScanner_peek(&sc); + int back = strings__textscanner__TextScanner_peek_back(&sc); + if (os__is_curr_dir_ref(back, curr, peek)) { + continue; + } + int range = sc.ilen - strings__textscanner__TextScanner_remaining(&sc) + volume_len; + if (os__is_slash(curr) && !os__is_slash(((u8)(peek)))) { + recent_path = string_substr(path, 0, range); + continue; + } + if (!os__is_slash(curr) && (peek == -1 || os__is_slash(((u8)(peek))))) { + string curr_path = string_substr(path, 0, range); + if (os__exists(curr_path)) { + recent_path = curr_path; + continue; + } + if (recent_path.len == 0) { + break; + } + _option_string _t3; + opt_ok2(&(string[]) { recent_path }, (_option*)(&_t3), sizeof(string)); + return _t3; + } + } + return (_option_string){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; +} + VV_LOCAL_SYMBOL string os__clean_path(string path) { if (path.len == 0) { string _t1 = _const_os__empty_str; @@ -28058,7 +30239,7 @@ VV_LOCAL_SYMBOL string os__clean_path(string path) { if (back != -1 && os__is_slash(((u8)(back))) && os__is_slash(curr)) { continue; } - if ((back == -1 || os__is_slash(((u8)(back)))) && curr == _const_os__dot && (peek == -1 || os__is_slash(((u8)(peek))))) { + if (os__is_curr_dir_ref(back, curr, peek)) { if (peek != -1 && os__is_slash(((u8)(peek)))) { strings__textscanner__TextScanner_skip_n(&sc, 1); } @@ -28162,6 +30343,15 @@ VV_LOCAL_SYMBOL bool os__is_normal_path(string path) { return _t2; } +VV_LOCAL_SYMBOL bool os__is_curr_dir_ref(int byte_one, int byte_two, int byte_three) { + if (((u8)(byte_two)) != _const_os__dot) { + bool _t1 = false; + return _t1; + } + bool _t2 = (byte_one < 0 || os__is_slash(((u8)(byte_one)))) && (byte_three < 0 || os__is_slash(((u8)(byte_three)))); + return _t2; +} + u32 os__FilePermission_bitmask(os__FilePermission p) { u32 mask = ((u32)(0U)); if (p.read) { @@ -29539,16 +31729,24 @@ bool os__is_dir_empty(string path) { } string os__file_ext(string path) { - _option_int _t1 = string_last_index(path, _SLIT(".")); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - string _t2 = _SLIT(""); - return _t2; + if (path.len < 3) { + string _t1 = _const_os__empty_str; + return _t1; + } + _option_int _t2 = string_last_index(path, _const_os__dot_str); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + string _t3 = _const_os__empty_str; + return _t3; } - int pos = (*(int*)_t1.data); - string _t3 = string_substr(path, pos, (path).len); - return _t3; + int pos = (*(int*)_t2.data); + if (pos + 1 >= path.len || pos == 0) { + string _t4 = _const_os__empty_str; + return _t4; + } + string _t5 = string_substr(path, pos, (path).len); + return _t5; } string os__dir(string opath) { @@ -31691,10 +33889,12 @@ string term__highlight_command(string command) { void term__set_cursor_position(term__Coord c) { print(string__plus( str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = c.y}}, {_SLIT(";"), /*100 &int*/0xfe07, {.d_i32 = c.x}}, {_SLIT0, 0, { .d_c = 0 }}})), _SLIT("H"))); + flush_stdout(); } void term__move(int n, string direction) { print( str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = direction}}, {_SLIT0, 0, { .d_c = 0 }}}))); + flush_stdout(); } void term__cursor_up(int n) { @@ -31715,6 +33915,7 @@ void term__cursor_back(int n) { void term__erase_display(string t) { print(string__plus(string__plus(_SLIT("\033["), t), _SLIT("J"))); + flush_stdout(); } void term__erase_toend(void) { @@ -31727,6 +33928,7 @@ void term__erase_tobeg(void) { void term__erase_clear(void) { print(_SLIT("\033[H\033[J")); + flush_stdout(); } void term__erase_del_clear(void) { @@ -31735,6 +33937,7 @@ void term__erase_del_clear(void) { void term__erase_line(string t) { print(string__plus(string__plus(_SLIT("\033["), t), _SLIT("K"))); + flush_stdout(); } void term__erase_line_toend(void) { @@ -31751,14 +33954,17 @@ void term__erase_line_clear(void) { void term__show_cursor(void) { print(_SLIT("\033[?25h")); + flush_stdout(); } void term__hide_cursor(void) { print(_SLIT("\033[?25l")); + flush_stdout(); } void term__clear_previous_line(void) { print(_SLIT("\r\033[1A\033[2K")); + flush_stdout(); } bool term__can_show_color_on_stdout(void) { @@ -34557,7 +36763,7 @@ f64 rand__exponential(f64 lambda) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -34625,7 +36831,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { if ((p->third_party_option).len == 0) { p->third_party_option = p->cflags; } - string vhash = _SLIT("585cb9ec2"); + string vhash = _SLIT("3bc50721e"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), /*115 &v.pref.OS*/0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), /*115 &string*/0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -35053,7 +37259,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); ; #if defined(TARGET_IS_64BIT) { @@ -35529,6 +37735,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->custom_prelude = prelude; i++; } + else if (string__eq(arg, _SLIT("-cmain"))) { + res->cmain = os__cmdline__option(current_args, _SLIT("-cmain"), _SLIT("")); + i++; + } else { if (string__eq(command, _SLIT("build")) && v__pref__is_source_file(arg)) { eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Use `v "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT("` instead."), 0, { .d_c = 0 }}}))); @@ -35544,7 +37754,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if ((command).len == 0) { command = arg; command_pos = i; - if (string__eq(command, _SLIT("run"))) { + if (string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("crun"))) { break; } } else if (v__pref__is_source_file(command) && v__pref__is_source_file(arg) && !Array_string_contains(known_external_commands, command)) { @@ -35571,6 +37781,12 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if (res->is_debug) { v__pref__Preferences_parse_define(res, _SLIT("debug")); } + if (string__eq(command, _SLIT("crun"))) { + res->is_crun = true; + } + if (string__eq(command, _SLIT("run"))) { + res->is_run = true; + } if (string__eq(command, _SLIT("run")) && res->is_prod && os__is_atty(1) > 0) { v__pref__eprintln_cond(show_output, _SLIT("Note: building an optimized binary takes much longer. It shouldn't be used with `v run`.")); v__pref__eprintln_cond(show_output, _SLIT("Use `v run` without optimization, or build an optimized binary with -prod first, then run it separately.")); @@ -35580,8 +37796,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors _v_exit(1); VUNREACHABLE(); } - if (string__eq(command, _SLIT("run"))) { - res->is_run = true; + if (res->is_run || res->is_crun) { if (command_pos + 2 > args.len) { eprintln(_SLIT("v run: no v files listed")); _v_exit(1); @@ -35648,7 +37863,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors v__pref__eprintln_cond(show_output, _SLIT("`-bare-builtin-dir` must be used with `-freestanding`")); } if (string_ends_with(command, _SLIT(".vsh"))) { - res->is_run = true; + res->is_crun = true; res->path = command; Array_string _t38; res->run_args = (_t38 = args, array_slice(_t38, command_pos + 1, _t38.len)); @@ -35865,6 +38080,7 @@ v__pref__Arch v__pref__get_host_arch(void) { VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define) { Array_string define_parts = string_split(define, _SLIT("=")); + v__pref__Preferences_diagnose_deprecated_defines(prefs, define_parts); if (!(prefs->is_debug && string__eq(define, _SLIT("debug")))) { array_push((array*)&prefs->build_options, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-d "), /*115 &string*/0xfe10, {.d_s = define}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } @@ -35894,6 +38110,12 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* pre VUNREACHABLE(); } +VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__Preferences* prefs, Array_string define_parts) { + if (string__eq((*(string*)/*ee elem_sym */array_get(define_parts, 0)), _SLIT("force_embed_file"))) { + eprintln(_SLIT("-d force_embed_file was deprecated in 2022/06/01. Now $embed_file(file) always embeds the file, unless you pass `-d embed_only_metadata`.")); + } +} + Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) { Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); Array_string files = array_clone_to_depth(&files_, 0); @@ -37929,7 +40151,7 @@ string v__util__skip_bom(string file_content) { } bool v__util__module_is_builtin(string mod) { - bool _t1 = Array_string_contains(_const_v__util__builtin_module_names, mod); + bool _t1 = Array_string_contains(_const_v__util__builtin_module_parts, mod); return _t1; } @@ -38371,9 +40593,9 @@ void v__util__prepare_tool_when_needed(string source_name) { string vexe = os__getenv(_SLIT("VEXE")); string vroot = os__dir(vexe); string stool = os__join_path(vroot, new_array_from_c_array(3, 3, sizeof(string), _MOV((string[3]){_SLIT("cmd"), _SLIT("tools"), source_name}))); - multi_return_string_string mr_14964 = v__util__tool_source2name_and_exe(stool); - string tool_name = mr_14964.arg0; - string tool_exe = mr_14964.arg1; + multi_return_string_string mr_14763 = v__util__tool_source2name_and_exe(stool); + string tool_name = mr_14763.arg0; + string tool_exe = mr_14763.arg1; if (v__util__should_recompile_tool(vexe, stool, tool_name, tool_exe)) { time__sleep(1001 * _const_time__millisecond); v__util__recompile_file(vexe, stool); @@ -38987,8 +41209,8 @@ bool v__ast__Expr_is_expr(v__ast__Expr expr) { return _t5; } -bool v__ast__Expr_is_lit(v__ast__Expr expr) { - bool _t1 = ((expr._typ == 293 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 298 /* v.ast.CharLiteral */)? (true) : (expr._typ == 333 /* v.ast.StringLiteral */)? (true) : (expr._typ == 314 /* v.ast.IntegerLiteral */)? (true) : (false)); +bool v__ast__Expr_is_pure_literal(v__ast__Expr expr) { + bool _t1 = ((expr._typ == 293 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 298 /* v.ast.CharLiteral */)? (true) : (expr._typ == 307 /* v.ast.FloatLiteral */)? (true) : (expr._typ == 333 /* v.ast.StringLiteral */)? (true) : (expr._typ == 314 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } @@ -41324,7 +43546,7 @@ string v__ast__Expr_str(v__ast__Expr x) { } else if (x._typ == 295 /* v.ast.CallExpr */) { string sargs = v__ast__args2str((*x._v__ast__CallExpr).args); - string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT(" ?")) : (_SLIT(""))); + string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT("?")) : (*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_result ? (_SLIT("!")) : (_SLIT(""))); if ((*x._v__ast__CallExpr).is_method) { string _t14 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__CallExpr).left)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = propagate_suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t14; @@ -41407,24 +43629,26 @@ string v__ast__Expr_str(v__ast__Expr x) { } if (i < (*x._v__ast__IfExpr).branches.len - 1 || !(*x._v__ast__IfExpr).has_else) { array_push((array*)&parts, _MOV((string[]){ string_clone(string__plus(string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT(" "), /*115 &string*/0xfe10, {.d_s = dollar}}, {_SLIT("if "), 0, { .d_c = 0 }}})), v__ast__Expr_str(branch.cond)), _SLIT(" { "))) })); + } else if ((*x._v__ast__IfExpr).has_else && i == (*x._v__ast__IfExpr).branches.len - 1) { + array_push((array*)&parts, _MOV((string[]){ string_clone(_SLIT("{ ")) })); } - for (int _t33 = 0; _t33 < branch.stmts.len; ++_t33) { - v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t33]; + for (int _t34 = 0; _t34 < branch.stmts.len; ++_t34) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t34]; array_push((array*)&parts, _MOV((string[]){ string_clone(v__ast__Stmt_str(stmt)) })); } } array_push((array*)&parts, _MOV((string[]){ string_clone(_SLIT(" }")) })); - string _t36 = Array_string_join(parts, _SLIT("")); - return _t36; - } - else if (x._typ == 312 /* v.ast.IndexExpr */) { - string _t37 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); + string _t37 = Array_string_join(parts, _SLIT("")); return _t37; } - else if (x._typ == 313 /* v.ast.InfixExpr */) { - string _t38 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); + else if (x._typ == 312 /* v.ast.IndexExpr */) { + string _t38 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); return _t38; } + else if (x._typ == 313 /* v.ast.InfixExpr */) { + string _t39 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t39; + } else if (x._typ == 318 /* v.ast.MapInit */) { Array_string pairs = __new_array_with_default(0, 0, sizeof(string), 0); for (int ik = 0; ik < (*x._v__ast__MapInit).keys.len; ++ik) { @@ -41432,24 +43656,24 @@ string v__ast__Expr_str(v__ast__Expr x) { string mv = v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get((*x._v__ast__MapInit).vals, ik))); array_push((array*)&pairs, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(kv)}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = mv}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } - string _t40 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t40; + string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t41; } else if (x._typ == 324 /* v.ast.ParExpr */) { - string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t41; + string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t42; } else if (x._typ == 325 /* v.ast.PostfixExpr */) { if ((*x._v__ast__PostfixExpr).op == v__token__Kind__question) { - string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); - return _t42; + string _t43 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); + return _t43; } - string _t43 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t43; + string _t44 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t44; } else if (x._typ == 326 /* v.ast.PrefixExpr */) { - string _t44 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); - return _t44; + string _t45 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); + return _t45; } else if (x._typ == 327 /* v.ast.RangeExpr */) { string s = _SLIT(".."); @@ -41459,28 +43683,28 @@ string v__ast__Expr_str(v__ast__Expr x) { if ((*x._v__ast__RangeExpr).has_high) { s = string__plus(s, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__RangeExpr).high)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - string _t45 = s; - return _t45; - } - else if (x._typ == 328 /* v.ast.SelectExpr */) { - string _t46 = _SLIT("ast.SelectExpr"); + string _t46 = s; return _t46; } - else if (x._typ == 329 /* v.ast.SelectorExpr */) { - string _t47 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); + else if (x._typ == 328 /* v.ast.SelectExpr */) { + string _t47 = _SLIT("ast.SelectExpr"); return _t47; } + else if (x._typ == 329 /* v.ast.SelectorExpr */) { + string _t48 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t48; + } else if (x._typ == 330 /* v.ast.SizeOf */) { if ((*x._v__ast__SizeOf).is_type) { - string _t48 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t48; + string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t49; } - string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t49; + string _t50 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t50; } else if (x._typ == 322 /* v.ast.OffsetOf */) { - string _t50 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); - return _t50; + string _t51 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + return _t51; } else if (x._typ == 332 /* v.ast.StringInterLiteral */) { strings__Builder res = strings__new_builder(50); @@ -41492,9 +43716,9 @@ string v__ast__Expr_str(v__ast__Expr x) { break; } strings__Builder_write_string(&res, _SLIT("$")); - multi_return_string_bool mr_10139 = v__ast__StringInterLiteral_get_fspec_braces(&(*x._v__ast__StringInterLiteral), i); - string fspec_str = mr_10139.arg0; - bool needs_braces = mr_10139.arg1; + multi_return_string_bool mr_10285 = v__ast__StringInterLiteral_get_fspec_braces(&(*x._v__ast__StringInterLiteral), i); + string fspec_str = mr_10285.arg0; + bool needs_braces = mr_10285.arg1; if (needs_braces) { strings__Builder_write_string(&res, _SLIT("{")); strings__Builder_write_string(&res, v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get((*x._v__ast__StringInterLiteral).exprs, i)))); @@ -41505,37 +43729,37 @@ string v__ast__Expr_str(v__ast__Expr x) { } } strings__Builder_write_string(&res, _SLIT("'")); - string _t51 = strings__Builder_str(&res); - return _t51; - } - else if (x._typ == 333 /* v.ast.StringLiteral */) { - string _t52 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); + string _t52 = strings__Builder_str(&res); return _t52; } - else if (x._typ == 335 /* v.ast.TypeNode */) { - string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 333 /* v.ast.StringLiteral */) { + string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); return _t53; } - else if (x._typ == 336 /* v.ast.TypeOf */) { - string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 335 /* v.ast.TypeNode */) { + string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t54; } - else if (x._typ == 316 /* v.ast.Likely */) { - string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + else if (x._typ == 336 /* v.ast.TypeOf */) { + string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t55; } - else if (x._typ == 337 /* v.ast.UnsafeExpr */) { - string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + else if (x._typ == 316 /* v.ast.Likely */) { + string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t56; } - else if (x._typ == 321 /* v.ast.None */) { - string _t57 = _SLIT("none"); + else if (x._typ == 337 /* v.ast.UnsafeExpr */) { + string _t57 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t57; } - else if (x._typ == 315 /* v.ast.IsRefType */) { - string _t58 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); + else if (x._typ == 321 /* v.ast.None */) { + string _t58 = _SLIT("none"); return _t58; } + else if (x._typ == 315 /* v.ast.IsRefType */) { + string _t59 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); + return _t59; + } else if (x._typ == 311 /* v.ast.IfGuardExpr */) { string s = _SLIT(""); for (int i = 0; i < (*x._v__ast__IfGuardExpr).vars.len; ++i) { @@ -41545,57 +43769,57 @@ string v__ast__Expr_str(v__ast__Expr x) { s = /*f*/string__plus(s, _SLIT(", ")); } } - string _t59 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); - return _t59; + string _t60 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); + return _t60; } else if (x._typ == 334 /* v.ast.StructInit */) { string sname = v__ast__Table_sym(global_table, (*x._v__ast__StructInit).typ)->name; - string _t60 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); - return _t60; - } - else if (x._typ == 288 /* v.ast.ArrayDecompose */) { - string _t61 = _SLIT("ast.ArrayDecompose"); + string _t61 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); return _t61; } - else if (x._typ == 291 /* v.ast.Assoc */) { - string _t62 = _SLIT("ast.Assoc"); + else if (x._typ == 288 /* v.ast.ArrayDecompose */) { + string _t62 = _SLIT("ast.ArrayDecompose"); return _t62; } - else if (x._typ == 297 /* v.ast.ChanInit */) { - string _t63 = _SLIT("ast.ChanInit"); + else if (x._typ == 291 /* v.ast.Assoc */) { + string _t63 = _SLIT("ast.Assoc"); return _t63; } - else if (x._typ == 300 /* v.ast.ComptimeCall */) { - string _t64 = _SLIT("ast.ComptimeCall"); + else if (x._typ == 297 /* v.ast.ChanInit */) { + string _t64 = _SLIT("ast.ChanInit"); return _t64; } - else if (x._typ == 305 /* v.ast.EmptyExpr */) { - string _t65 = _SLIT("ast.EmptyExpr"); + else if (x._typ == 300 /* v.ast.ComptimeCall */) { + string _t65 = _SLIT("ast.ComptimeCall"); return _t65; } - else if (x._typ == 317 /* v.ast.LockExpr */) { - string _t66 = _SLIT("ast.LockExpr"); + else if (x._typ == 305 /* v.ast.EmptyExpr */) { + string _t66 = _SLIT("ast.EmptyExpr"); return _t66; } - else if (x._typ == 319 /* v.ast.MatchExpr */) { - string _t67 = _SLIT("ast.MatchExpr"); + else if (x._typ == 317 /* v.ast.LockExpr */) { + string _t67 = _SLIT("ast.LockExpr"); return _t67; } - else if (x._typ == 320 /* v.ast.NodeError */) { - string _t68 = _SLIT("ast.NodeError"); + else if (x._typ == 319 /* v.ast.MatchExpr */) { + string _t68 = _SLIT("ast.MatchExpr"); return _t68; } - else if (x._typ == 323 /* v.ast.OrExpr */) { - string _t69 = _SLIT("ast.OrExpr"); + else if (x._typ == 320 /* v.ast.NodeError */) { + string _t69 = _SLIT("ast.NodeError"); return _t69; } - else if (x._typ == 331 /* v.ast.SqlExpr */) { - string _t70 = _SLIT("ast.SqlExpr"); + else if (x._typ == 323 /* v.ast.OrExpr */) { + string _t70 = _SLIT("ast.OrExpr"); return _t70; } + else if (x._typ == 331 /* v.ast.SqlExpr */) { + string _t71 = _SLIT("ast.SqlExpr"); + return _t71; + } ; - string _t71 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[unhandled expr type "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (x)._typ ))}}, {_SLIT("]"), 0, { .d_c = 0 }}})); - return _t71; + string _t72 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[unhandled expr type "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (x)._typ ))}}, {_SLIT("]"), 0, { .d_c = 0 }}})); + return _t72; } string v__ast__CallArg_str(v__ast__CallArg a) { @@ -41808,7 +44032,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; + return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -41832,7 +44056,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.cached_type_to_str = new_map(sizeof(u64), sizeof(string), &map_hash_int_8, &map_eq_int_8, &map_clone_int_8, &map_free_nop),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -42012,7 +44236,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__Fn new_fn = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -42075,7 +44299,7 @@ _option_v__ast__Fn v__ast__Table_find_method(v__ast__Table* t, v__ast__TypeSymbo Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, v__ast__GetEmbedsOptions options) { Array_Array_v__ast__Type embeds = __new_array_with_default(0, 0, sizeof(Array_v__ast__Type), 0); - v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 474 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); + v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 475 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); if ((unalias_sym->info)._typ == 459 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*unalias_sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*unalias_sym->info._v__ast__Struct).embeds.data)[_t1]; @@ -42112,9 +44336,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12461 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12461.arg0; - Array_v__ast__Type types = mr_12461.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12536 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12536.arg0; + Array_v__ast__Type types = mr_12536.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t8, Array_v__ast__Type); @@ -42127,7 +44351,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 477 /* v.ast.Interface */) { + } else if ((sym->info)._typ == 478 /* v.ast.Interface */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t11 = 0; _t11 < (*sym->info._v__ast__Interface).embeds.len; ++_t11) { @@ -42146,9 +44370,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13119 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_13119.arg0; - Array_v__ast__Type types = mr_13119.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13194 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13194.arg0; + Array_v__ast__Type types = mr_13194.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t18, Array_v__ast__Type); @@ -42161,7 +44385,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 472 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 473 /* v.ast.Aggregate */) { for (int _t21 = 0; _t21 < (*sym->info._v__ast__Aggregate).types.len; ++_t21) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t21]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -42171,9 +44395,9 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13582 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13582.arg0; - Array_v__ast__Type embed_types = mr_13582.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13657 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13657.arg0; + Array_v__ast__Type embed_types = mr_13657.arg1; if (embed_types.len != 0) { _option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok2(&(multi_return_v__ast__Fn_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=method, .arg1=embed_types} }, (_option*)(&_t23), sizeof(multi_return_v__ast__Fn_Array_v__ast__Type)); @@ -42200,8 +44424,8 @@ _option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__as return (_option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_14043 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14043.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14118 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14118.arg0; _option_v__ast__Fn _t5; opt_ok2(&(v__ast__Fn[]) { func }, (_option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -42227,9 +44451,9 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { v__ast__Type typ = ((v__ast__Type*)agg_info.types.data)[_t1]; v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); @@ -42242,7 +44466,7 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie } else if (!v__ast__Type_alias_eq(new_field.typ, type_field.typ)) { return (_option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` type is different"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,}); + new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.deprecation_msg,new_field.deprecated_after,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,new_field.is_deprecated,}); } else { IError err = _t2.err; return (_option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("` has no field or method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -42293,7 +44517,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t2; } } - else if (ts->info._typ == 472 /* v.ast.Aggregate */) { + else if (ts->info._typ == 473 /* v.ast.Aggregate */) { _option_v__ast__StructField _t3; if (_t3 = v__ast__Aggregate_find_field(&(*ts->info._v__ast__Aggregate), name), _t3.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t3.data; @@ -42312,7 +44536,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t7), sizeof(v__ast__StructField)); return _t7; } - else if (ts->info._typ == 477 /* v.ast.Interface */) { + else if (ts->info._typ == 478 /* v.ast.Interface */) { _option_v__ast__StructField _t8; if (_t8 = v__ast__Interface_find_field(&(*ts->info._v__ast__Interface), name), _t8.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t8.data; @@ -42321,7 +44545,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t9; } } - else if (ts->info._typ == 478 /* v.ast.SumType */) { + else if (ts->info._typ == 479 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, ts); _option_v__ast__StructField _t10; if (_t10 = v__ast__SumType_find_field(&(*ts->info._v__ast__SumType), name), _t10.state == 0) { @@ -42364,9 +44588,9 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17290 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17290.arg0; - Array_v__ast__Type types = mr_17290.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17365 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17365.arg0; + Array_v__ast__Type types = mr_17365.arg1; array_push((array*)&found_fields, _MOV((v__ast__StructField[]){ field })); array_push((array*)&embeds_of_found_fields, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embeds_of_found_fields, (types), _t8, Array_v__ast__Type); @@ -42379,7 +44603,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f } else if (found_fields.len > 1) { return (_option_multi_return_v__ast__StructField_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 472 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 473 /* v.ast.Aggregate */) { for (int _t11 = 0; _t11 < (*sym->info._v__ast__Aggregate).types.len; ++_t11) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t11]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -42389,16 +44613,16 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17743 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17743.arg0; - Array_v__ast__Type embed_types = mr_17743.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17818 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17818.arg0; + Array_v__ast__Type embed_types = mr_17818.arg1; if (embed_types.len > 0) { _option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok2(&(multi_return_v__ast__StructField_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=field, .arg1=embed_types} }, (_option*)(&_t13), sizeof(multi_return_v__ast__StructField_Array_v__ast__Type)); return _t13; } } - } else if ((sym->info)._typ == 474 /* v.ast.Alias */) { + } else if ((sym->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* unalias_sym = v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type); _option_multi_return_v__ast__StructField_Array_v__ast__Type _t14 = v__ast__Table_find_field_from_embeds(t, unalias_sym, field_name); return _t14; @@ -42422,8 +44646,8 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* return (_option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18341 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18341.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18416 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18416.arg0; _option_v__ast__StructField _t5; opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -42433,7 +44657,7 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeSymbol* sym_) { v__ast__TypeSymbol* sym = sym_; - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; if (info.found_fields) { return; } @@ -42448,7 +44672,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS if (v_sym->info._typ == 459 /* v.ast.Struct */) { _t2 = v__ast__Table_struct_fields(t, v_sym); } - else if (v_sym->info._typ == 478 /* v.ast.SumType */) { + else if (v_sym->info._typ == 479 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, v_sym); _t2 = (*v_sym->info._v__ast__SumType).fields; } @@ -42460,9 +44684,9 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS for (int _t3 = 0; _t3 < fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)fields.data)[_t3]; if (!_IN_MAP(ADDR(string, field.name), ADDR(map, field_map))) { - (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) = field; + (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })) = field; (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; - } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })))) { + } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })))) { (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; } } @@ -42480,7 +44704,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS field = string_clone(field); int nr_definitions = (*(int*)DenseArray_value(&field_usages.key_values, _t4)); if (nr_definitions == info.variants.len) { - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,} })) })); } } info.found_fields = true; @@ -42536,7 +44760,7 @@ inline v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Typ if (idx > 0) { v__ast__TypeSymbol* current_symbol = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); if (current_symbol->kind == v__ast__Kind__alias) { - idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); } v__ast__TypeSymbol* _t1 = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); return _t1; @@ -42557,7 +44781,7 @@ inline string v__ast__Table_get_type_name(v__ast__Table* t, v__ast__Type typ) { inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; if (pt <= _const_v__ast__char_type && pt >= _const_v__ast__void_type) { v__ast__Type _t1 = pt; return _t1; @@ -42571,7 +44795,7 @@ inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Typ inline v__ast__Type v__ast__Table_unaliased_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; v__ast__Type _t1 = pt; return _t1; } @@ -42664,7 +44888,7 @@ bool v__ast__Table_known_type_idx(v__ast__Table* t, v__ast__Type typ) { return _t3; } else if (sym->kind == (v__ast__Kind__array_fixed)) { - bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type); + bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type); return _t4; } else if (sym->kind == (v__ast__Kind__map)) { @@ -42919,9 +45143,9 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ for (int i = 0; i < mr_typs.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)mr_typs.data)[i]; v__ast__TypeSymbol* mr_type_sym = v__ast__Table_sym(t, v__ast__mktyp(mr_typ)); - multi_return_string_string mr_31400 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); - string ref = mr_31400.arg0; - string cref = mr_31400.arg1; + multi_return_string_string mr_31475 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); + string ref = mr_31475.arg0; + string cref = mr_31475.arg1; name = /*f*/string__plus(name, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = mr_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); cname = /*f*/string__plus(cname, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = cref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = mr_type_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i < mr_typs.len - 1) { @@ -42976,7 +45200,7 @@ inline v__ast__Type v__ast__Table_value_type(v__ast__Table* t, v__ast__Type typ) return _t2; } if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__ast__Type _t3 = info.elem_type; return _t3; } @@ -43034,7 +45258,7 @@ bool v__ast__Table_register_fn_concrete_types(v__ast__Table* t, string fn_name, bool v__ast__Table_sumtype_has_variant(v__ast__Table* t, v__ast__Type parent, v__ast__Type variant, bool is_as) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent); if (parent_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; v__ast__TypeSymbol* var_sym = v__ast__Table_sym(t, variant); if (var_sym->kind == (v__ast__Kind__aggregate)) { @@ -43067,7 +45291,7 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_variant_in_type(v__ast__Table* } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type* aggregate_type, bool is_as) { - v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; + v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ; for (int _t1 = 0; _t1 < aggregate_sym.types.len; ++_t1) { v__ast__Type var_type = ((v__ast__Type*)aggregate_sym.types.data)[_t1]; if (!v__ast__Table_sumtype_has_variant(t, parent_type, var_type, is_as)) { @@ -43080,9 +45304,9 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_alias_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type alias_type, bool is_as) { - v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; if (!v__ast__Table_sumtype_check_variant_in_type(t, parent_sym, alias_type, is_as)) { - v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; bool _t1 = v__ast__Type_alias_eq(parent_type, alias_info.parent_type) || v__ast__Table_sumtype_has_variant(t, parent_type, alias_info.parent_type, is_as); return _t1; } @@ -43230,7 +45454,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t5 = false; return _t5; } - if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 478 /* v.ast.Interface */) { Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; @@ -43346,7 +45570,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 483 /* v.ast.ArrayFixed */) { _option_v__ast__Type _t9; if (_t9 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types), _t9.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t9.data; @@ -43362,7 +45586,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 483 /* v.ast.Chan */) { + else if (sym->info._typ == 484 /* v.ast.Chan */) { _option_v__ast__Type _t12; if (_t12 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__Chan).elem_type, generic_names, concrete_types), _t12.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t12.data; @@ -43378,7 +45602,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 486 /* v.ast.FnType */) { + else if (sym->info._typ == 487 /* v.ast.FnType */) { v__ast__Fn func = (*sym->info._v__ast__FnType).func; bool has_generic = false; if (v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic)) { @@ -43417,7 +45641,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t19; } } - else if (sym->info._typ == 485 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 486 /* v.ast.MultiReturn */) { Array_v__ast__Type types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool type_changed = false; for (int _t20 = 0; _t20 < (*sym->info._v__ast__MultiReturn).types.len; ++_t20) { @@ -43508,7 +45732,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t33; } } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { @@ -43532,7 +45756,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t35; } } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { @@ -43585,13 +45809,13 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t1 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t1; } - else if (ts->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 483 /* v.ast.ArrayFixed */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_array_fixed(t, unwrap_typ, (*ts->info._v__ast__ArrayFixed).size, v__ast__None_to_sumtype_v__ast__Expr(ADDR(v__ast__None, (((v__ast__None){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}))))); v__ast__Type _t2 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t2; } - else if (ts->info._typ == 483 /* v.ast.Chan */) { + else if (ts->info._typ == 484 /* v.ast.Chan */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_chan(t, unwrap_typ, v__ast__Type_nr_muls(unwrap_typ) > 0); v__ast__Type _t3 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); @@ -43672,7 +45896,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 477 /* v.ast.Interface */) { + else if (ts->info._typ == 478 /* v.ast.Interface */) { if (!(*ts->info._v__ast__Interface).is_generic) { v__ast__Type _t14 = typ; return _t14; @@ -43740,7 +45964,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 478 /* v.ast.SumType */) { + else if (ts->info._typ == 479 /* v.ast.SumType */) { if (!(*ts->info._v__ast__SumType).is_generic) { v__ast__Type _t23 = typ; return _t23; @@ -43826,7 +46050,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t33 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t33; } - else if (ts->info._typ == 478 /* v.ast.SumType */) { + else if (ts->info._typ == 479 /* v.ast.SumType */) { Array_v__ast__Type variants = array_clone_to_depth(&(*ts->info._v__ast__SumType).variants, 0); for (int i = 0; i < variants.len; ++i) { if (v__ast__Type_has_flag((*(v__ast__Type*)/*ee elem_sym */array_get(variants, i)), v__ast__TypeFlag__generic)) { @@ -43856,7 +46080,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t36 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t36; } - else if (ts->info._typ == 477 /* v.ast.Interface */) { + else if (ts->info._typ == 478 /* v.ast.Interface */) { Array_v__ast__Fn imethods = array_clone_to_depth(&(*ts->info._v__ast__Interface).methods, 0); for (int _t37 = 0; _t37 < imethods.len; ++_t37) { v__ast__Fn* method = ((v__ast__Fn*)imethods.data) + _t37; @@ -43921,10 +46145,10 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } v__ast__Table_replace_generic_type(t, elem_type, generic_types); } - else if (ts->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 483 /* v.ast.ArrayFixed */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_types); } - else if (ts->info._typ == 483 /* v.ast.Chan */) { + else if (ts->info._typ == 484 /* v.ast.Chan */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_types); } else if (ts->info._typ == 455 /* v.ast.Map */) { @@ -43954,7 +46178,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Struct).generic_types = generic_types; } - else if (ts->info._typ == 477 /* v.ast.Interface */) { + else if (ts->info._typ == 478 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*ts->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -43977,7 +46201,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Interface).generic_types = generic_types; } - else if (ts->info._typ == 478 /* v.ast.SumType */) { + else if (ts->info._typ == 479 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*ts->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -44010,7 +46234,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { for (int _t1 = 0; _t1 < t->type_symbols.len; ++_t1) { v__ast__TypeSymbol** typ = ((v__ast__TypeSymbol**)t->type_symbols.data) + _t1; if ((*typ)->kind == v__ast__Kind__generic_inst) { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 487) /*expected idx: 487, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 488) /*expected idx: 488, name: v.ast.GenericInst */ ; v__ast__TypeSymbol* parent = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, info.parent_idx)); if (parent->kind == v__ast__Kind__placeholder) { (*typ)->kind = v__ast__Kind__placeholder; @@ -44067,7 +46291,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 477 /* v.ast.Interface */) { + else if (parent->info._typ == 478 /* v.ast.Interface */) { v__ast__Interface parent_info = (*parent->info._v__ast__Interface); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -44133,7 +46357,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 478 /* v.ast.SumType */) { + else if (parent->info._typ == 479 /* v.ast.SumType */) { v__ast__SumType parent_info = (*parent->info._v__ast__SumType); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -44691,13 +46915,13 @@ VNORETURN VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymb // Attr: [inline] inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 488 /* v.ast.Enum */) { + if ((t->info)._typ == 489 /* v.ast.Enum */) { v__ast__Enum _t1 = (*t->info._v__ast__Enum); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 488 /* v.ast.Enum */) { + if ((fsym->info)._typ == 489 /* v.ast.Enum */) { v__ast__Enum _t2 = (*fsym->info._v__ast__Enum); return _t2; } @@ -44709,13 +46933,13 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 485 /* v.ast.MultiReturn */) { + if ((t->info)._typ == 486 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t1 = (*t->info._v__ast__MultiReturn); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 485 /* v.ast.MultiReturn */) { + if ((fsym->info)._typ == 486 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t2 = (*fsym->info._v__ast__MultiReturn); return _t2; } @@ -44731,7 +46955,7 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { v__ast__Array _t1 = (*t->info._v__ast__Array); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 454 /* v.ast.Array */) { v__ast__Array _t2 = (*fsym->info._v__ast__Array); @@ -44745,13 +46969,13 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 482 /* v.ast.ArrayFixed */) { + if ((t->info)._typ == 483 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t1 = (*t->info._v__ast__ArrayFixed); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 482 /* v.ast.ArrayFixed */) { + if ((fsym->info)._typ == 483 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t2 = (*fsym->info._v__ast__ArrayFixed); return _t2; } @@ -44763,13 +46987,13 @@ inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol // Attr: [inline] inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 483 /* v.ast.Chan */) { + if ((t->info)._typ == 484 /* v.ast.Chan */) { v__ast__Chan _t1 = (*t->info._v__ast__Chan); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 483 /* v.ast.Chan */) { + if ((fsym->info)._typ == 484 /* v.ast.Chan */) { v__ast__Chan _t2 = (*fsym->info._v__ast__Chan); return _t2; } @@ -44781,13 +47005,13 @@ inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 484 /* v.ast.Thread */) { + if ((t->info)._typ == 485 /* v.ast.Thread */) { v__ast__Thread _t1 = (*t->info._v__ast__Thread); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 484 /* v.ast.Thread */) { + if ((fsym->info)._typ == 485 /* v.ast.Thread */) { v__ast__Thread _t2 = (*fsym->info._v__ast__Thread); return _t2; } @@ -44803,7 +47027,7 @@ inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { v__ast__Map _t1 = (*t->info._v__ast__Map); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 455 /* v.ast.Map */) { v__ast__Map _t2 = (*fsym->info._v__ast__Map); @@ -44821,7 +47045,7 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { v__ast__Struct _t1 = (*t->info._v__ast__Struct); return _t1; } - if ((t->info)._typ == 474 /* v.ast.Alias */) { + if ((t->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); if ((fsym->info)._typ == 459 /* v.ast.Struct */) { v__ast__Struct _t2 = (*fsym->info._v__ast__Struct); @@ -44835,13 +47059,13 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 478 /* v.ast.SumType */) { + if ((t->info)._typ == 479 /* v.ast.SumType */) { v__ast__SumType _t1 = (*t->info._v__ast__SumType); return _t1; } - if ((t->info)._typ == 478 /* v.ast.SumType */) { + if ((t->info)._typ == 479 /* v.ast.SumType */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__SumType).parent_type); - if ((fsym->info)._typ == 478 /* v.ast.SumType */) { + if ((fsym->info)._typ == 479 /* v.ast.SumType */) { v__ast__SumType _t2 = (*fsym->info._v__ast__SumType); return _t2; } @@ -44907,7 +47131,7 @@ inline bool v__ast__TypeSymbol_is_pointer(v__ast__TypeSymbol* t) { inline bool v__ast__TypeSymbol_is_int(v__ast__TypeSymbol* t) { bool res = (t->kind == v__ast__Kind__i8 || t->kind == v__ast__Kind__i16 || t->kind == v__ast__Kind__int || t->kind == v__ast__Kind__i64 || t->kind == v__ast__Kind__isize || t->kind == v__ast__Kind__u8 || t->kind == v__ast__Kind__u16 || t->kind == v__ast__Kind__u32 || t->kind == v__ast__Kind__u64 || t->kind == v__ast__Kind__usize || t->kind == v__ast__Kind__int_literal || t->kind == v__ast__Kind__rune); if (!res && t->kind == v__ast__Kind__alias) { - bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); return _t1; } bool _t2 = res; @@ -45017,7 +47241,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__alias: { - multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); size = mr_21365.arg0; align = mr_21365.arg1; break; @@ -45042,7 +47266,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } _t4 =_t5; } else { - _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ).types; } Array_v__ast__Type types = _t4; for (int _t7 = 0; _t7 < types.len; ++_t7) { @@ -45063,15 +47287,15 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) case v__ast__Kind__interface_: case v__ast__Kind__aggregate: { - if (sym->info._typ == 478 /* v.ast.SumType */) { + if (sym->info._typ == 479 /* v.ast.SumType */) { size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 472 /* v.ast.Aggregate */) { + else if (sym->info._typ == 473 /* v.ast.Aggregate */) { size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { @@ -45089,7 +47313,7 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; multi_return_int_int mr_22434 = v__ast__Table_type_size(t, info.elem_type); int elem_size = mr_22434.arg0; int elem_align = mr_22434.arg1; @@ -45365,8 +47589,28 @@ string v__ast__Table_clean_generics_type_str(v__ast__Table* t, v__ast__Type typ) } string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type typ, Map_string_string import_aliases) { +bool v__ast__Table_type_to_str_using_aliases_defer_0 = false; +v__ast__Table* mt; +u64 cache_key; +string res; + cache_key = ((((u64)(import_aliases.len)) << 32U) | ((u64)(typ))); + string* _t2 = (string*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, t->cached_type_to_str), &(u64[]){cache_key})); + _option_string _t1 = {0}; + if (_t2) { + *((string*)&_t1.data) = *((string*)_t2); + } else { + _t1.state = 2; _t1.err = _v_error(_SLIT("array index out of range")); + } + + if (_t1.state == 0) { + string cached_res = *(string*)_t1.data; + string _t3 = cached_res; + return _t3; + } v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); - string res = sym->name; + res = sym->name; + mt = ((v__ast__Table*)(t)); + v__ast__Table_type_to_str_using_aliases_defer_0 = true; switch (sym->kind) { case v__ast__Kind__int_literal: case v__ast__Kind__float_literal: @@ -45400,8 +47644,14 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__array: { if (v__ast__Type_alias_eq(typ, _const_v__ast__array_type)) { - string _t1 = _SLIT("array"); - return _t1; + res = _SLIT("array"); + string _t4 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t4; } if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { res = v__ast__Table_type_to_str_using_aliases(t, v__ast__Table_value_type(t, typ), import_aliases); @@ -45417,7 +47667,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; string elem_str = v__ast__Table_type_to_str_using_aliases(t, info.elem_type, import_aliases); if ((info.size_expr)._typ == 305 /* v.ast.EmptyExpr */) { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -45429,7 +47679,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__chan: { if (!string__eq(sym->mod, _SLIT("builtin")) && !string__eq(sym->name, _SLIT("chan"))) { - v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ; + v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.Chan */ ; v__ast__Type elem_type = info.elem_type; string mut_str = _SLIT(""); if (info.is_mut) { @@ -45443,22 +47693,22 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__function: { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; if (!t->is_fmt) { res = v__ast__Table_fn_signature(t, (voidptr)&/*qq*/info.func, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = true,})); } else { if (string_starts_with(res, _SLIT("fn ("))) { - bool _t2 = false; - Array_v__ast__Param _t2_orig = info.func.params; - int _t2_len = _t2_orig.len; - for (int _t3 = 0; _t3 < _t2_len; ++_t3) { - v__ast__Param it = ((v__ast__Param*) _t2_orig.data)[_t3]; + bool _t5 = false; + Array_v__ast__Param _t5_orig = info.func.params; + int _t5_len = _t5_orig.len; + for (int _t6 = 0; _t6 < _t5_len; ++_t6) { + v__ast__Param it = ((v__ast__Param*) _t5_orig.data)[_t6]; if (it.name.len > 0) { - _t2 = true; + _t5 = true; break; } } - bool has_names =_t2; + bool has_names =_t5; res = v__ast__Table_fn_signature_using_aliases(t, (voidptr)&/*qq*/info.func, import_aliases, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = !has_names,})); } else { res = v__ast__Table_shorten_user_defined_typenames(t, res, import_aliases); @@ -45469,8 +47719,14 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__map: { if (((int)(typ)) == _const_v__ast__map_type_idx) { - string _t4 = _SLIT("map"); - return _t4; + res = _SLIT("map"); + string _t7 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t7; } v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; string key_str = v__ast__Table_type_to_str_using_aliases(t, info.key_type, import_aliases); @@ -45481,7 +47737,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__multi_return: { res = _SLIT("("); - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; for (int i = 0; i < info.types.len; ++i) { v__ast__Type typ2 = ((v__ast__Type*)info.types.data)[i]; if (i > 0) { @@ -45508,7 +47764,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).generic_types.data)[i]; @@ -45519,7 +47775,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__SumType).generic_types.data)[i]; @@ -45534,18 +47790,18 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty else { } ; - } else if ((sym->info)._typ == 478 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).is_anon) { - Array_string _t5 = {0}; - Array_v__ast__Type _t5_orig = (*sym->info._v__ast__SumType).variants; - int _t5_len = _t5_orig.len; - _t5 = __new_array(0, _t5_len, sizeof(string)); + } else if ((sym->info)._typ == 479 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ).is_anon) { + Array_string _t8 = {0}; + Array_v__ast__Type _t8_orig = (*sym->info._v__ast__SumType).variants; + int _t8_len = _t8_orig.len; + _t8 = __new_array(0, _t8_len, sizeof(string)); - for (int _t6 = 0; _t6 < _t5_len; ++_t6) { - v__ast__Type it = ((v__ast__Type*) _t5_orig.data)[_t6]; + for (int _t9 = 0; _t9 < _t8_len; ++_t9) { + v__ast__Type it = ((v__ast__Type*) _t8_orig.data)[_t9]; string ti = v__ast__Table_shorten_user_defined_typenames(t, v__ast__Table_sym(t, it)->name, import_aliases); - array_push((array*)&_t5, &ti); + array_push((array*)&_t8, &ti); } - Array_string variant_names =_t5; + Array_string variant_names =_t8; res = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT(" | "))}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { res = v__ast__Table_shorten_user_defined_typenames(t, res, import_aliases); @@ -45554,7 +47810,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__generic_inst: { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 488) /*expected idx: 488, name: v.ast.GenericInst */ ; res = v__ast__Table_shorten_user_defined_typenames(t, string_all_before(sym->name, _SLIT("<")), import_aliases); res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < info.concrete_types.len; ++i) { @@ -45570,15 +47826,33 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__void: { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { - string _t7 = _SLIT("?"); - return _t7; + res = _SLIT("?"); + string _t10 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t10; } if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) { - string _t8 = _SLIT("!"); - return _t8; + res = _SLIT("!"); + string _t11 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t11; } - string _t9 = _SLIT("void"); - return _t9; + res = _SLIT("void"); + string _t12 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t12; break; } case v__ast__Kind__thread: @@ -45621,8 +47895,13 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) { res = str_intp(2, _MOV((StrIntpData[]){{_SLIT("!"), /*115 &string*/0xfe10, {.d_s = res}}, {_SLIT0, 0, { .d_c = 0 }}})); } - string _t10 = res; - return _t10; + string _t13 = res; + // Defer begin + if (v__ast__Table_type_to_str_using_aliases_defer_0) { + map_set(&mt->cached_type_to_str, &(u64[]){cache_key}, &(string[]) { res }); + } + // Defer end + return _t13; } VV_LOCAL_SYMBOL string v__ast__Table_shorten_user_defined_typenames(v__ast__Table* t, string originalname, Map_string_string import_aliases) { @@ -45819,7 +48098,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t9), sizeof(v__ast__Fn)); return _t9; } - else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 478 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t10 = {0}; Array_v__ast__Type _t10_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -45855,7 +48134,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t15), sizeof(v__ast__Fn)); return _t15; } - else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 479 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t16 = {0}; Array_v__ast__Type _t16_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -45898,7 +48177,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 477 /* v.ast.Interface */) { + else if (t->info._typ == 478 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*t->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Interface).parent_type); _option_v__ast__Fn _t22; @@ -45940,7 +48219,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t28), sizeof(v__ast__Fn)); return _t28; } - else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 478 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t29 = {0}; Array_v__ast__Type _t29_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -45976,7 +48255,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t34), sizeof(v__ast__Fn)); return _t34; } - else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 479 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t35 = {0}; Array_v__ast__Type _t35_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -46019,7 +48298,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 478 /* v.ast.SumType */) { + else if (t->info._typ == 479 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*t->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__SumType).parent_type); _option_v__ast__Fn _t41; @@ -46061,7 +48340,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t47), sizeof(v__ast__Fn)); return _t47; } - else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 478 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t48 = {0}; Array_v__ast__Type _t48_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -46097,7 +48376,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t53), sizeof(v__ast__Fn)); return _t53; } - else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 479 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t54 = {0}; Array_v__ast__Type _t54_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -46161,7 +48440,7 @@ bool v__ast__TypeSymbol_is_js_compatible(v__ast__TypeSymbol* t) { bool _t3 = true; return _t3; } - if (t->info._typ == 478 /* v.ast.SumType */) { + if (t->info._typ == 479 /* v.ast.SumType */) { for (int _t4 = 0; _t4 < (*t->info._v__ast__SumType).variants.len; ++_t4) { v__ast__Type variant = ((v__ast__Type*)(*t->info._v__ast__SumType).variants.data)[_t4]; v__ast__TypeSymbol* sym = v__ast__Table_final_sym(table, variant); @@ -46199,7 +48478,7 @@ multi_return_bool_bool_int v__ast__TypeSymbol_str_method_info(v__ast__TypeSymbol } _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, string name) { - if (t->info._typ == 472 /* v.ast.Aggregate */) { + if (t->info._typ == 473 /* v.ast.Aggregate */) { _option_v__ast__StructField _t1 = v__ast__Aggregate_find_field(&(*t->info._v__ast__Aggregate), name); return _t1; } @@ -46207,11 +48486,11 @@ _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, _option_v__ast__StructField _t2 = v__ast__Struct_find_field(&(*t->info._v__ast__Struct), name); return _t2; } - else if (t->info._typ == 477 /* v.ast.Interface */) { + else if (t->info._typ == 478 /* v.ast.Interface */) { _option_v__ast__StructField _t3 = v__ast__Interface_find_field(&(*t->info._v__ast__Interface), name); return _t3; } - else if (t->info._typ == 478 /* v.ast.SumType */) { + else if (t->info._typ == 479 /* v.ast.SumType */) { _option_v__ast__StructField _t4 = v__ast__SumType_find_field(&(*t->info._v__ast__SumType), name); return _t4; } @@ -46297,7 +48576,7 @@ v__ast__StructField v__ast__Struct_get_field(v__ast__Struct* s, string name) { } _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown field `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); - return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}; + return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}; } _option_v__ast__StructField v__ast__SumType_find_field(v__ast__SumType* s, string name) { @@ -46613,7 +48892,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } ; - v__ast__Type left_type_unwrapped = v__checker__Checker_unwrap_generic(c, left_type); + v__ast__Type left_type_unwrapped = v__checker__Checker_unwrap_generic(c, v__ast__mktyp(left_type)); v__ast__Type right_type_unwrapped = v__checker__Checker_unwrap_generic(c, right_type); if (right_type_unwrapped == 0) { continue; @@ -46639,7 +48918,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 309 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 309 /* v.ast.Ident */) { - if ((right_sym->info)._typ == 482 /* v.ast.ArrayFixed */) { + if ((right_sym->info)._typ == 483 /* v.ast.ArrayFixed */) { if (v__ast__Type_is_ptr((*right_sym->info._v__ast__ArrayFixed).elem_type)) { v__checker__Checker_error(c, _SLIT("assignment from one fixed array to another with a pointer element type is prohibited outside of `unsafe`"), node->pos); } @@ -46908,11 +49187,11 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v return _t8; } } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t10 = true; return _t10; } @@ -46932,7 +49211,7 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v bool _t13 = true; return _t13; } else if (got_sym->kind == v__ast__Kind__array) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { bool _t14 = true; @@ -47078,17 +49357,18 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, return (_option_void){0}; } } - v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); - string got_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); - v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); - string expected_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); if (v__checker__Checker_check_types(c, got, expected)) { if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { return (_option_void){0}; } } else { + v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); + v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { + multi_return_string_string mr_8384 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8384.arg0; + string expected_typ_str = mr_8384.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } return (_option_void){0}; @@ -47096,14 +49376,27 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, if (v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(arg.expr)}}, {_SLIT("` (no value) used as value"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } + multi_return_string_string mr_8632 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8632.arg0; + string expected_typ_str = mr_8632.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } if (!v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { + multi_return_string_string mr_8802 = v__checker__Checker_get_string_names_of(/*rec*/*c, got, expected); + string got_typ_str = mr_8802.arg0; + string expected_typ_str = mr_8802.arg1; return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } return (_option_void){0}; } +VV_LOCAL_SYMBOL multi_return_string_string v__checker__Checker_get_string_names_of(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected) { +v__checker__Checker* c = HEAP(v__checker__Checker, _v_toheap_c); + string got_typ_str = v__ast__Table_type_to_str((*(c)).table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); + string expected_typ_str = v__ast__Table_type_to_str((*(c)).table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); + return (multi_return_string_string){.arg0=got_typ_str, .arg1=expected_typ_str}; +} + VV_LOCAL_SYMBOL bool v__checker__Checker_check_same_module(v__checker__Checker _v_toheap_c, v__ast__Type got, v__ast__Type expected) { v__checker__Checker* c = HEAP(v__checker__Checker, _v_toheap_c); string clean_got_typ = string_all_before(v__ast__Table_clean_generics_type_str((*(c)).table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)), _SLIT("<")); @@ -47206,8 +49499,8 @@ bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v } bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym) { - v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; - v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; + v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; v__ast__Fn got_fn = got_info.func; v__ast__Fn exp_fn = exp_info.func; if (got_fn.params.len != exp_fn.params.len) { @@ -47248,7 +49541,7 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker* c, v__ast__InfixExpr* node, v__ast__Type left_type, v__ast__Type right_type) { if (!v__ast__Type_is_int(left_type)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); - if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)) { + if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type)) { v__ast__Type _t1 = left_type; return _t1; } @@ -47375,10 +49668,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_promote_num(v__checker__Checker v__ast__Type type_hi = left_type; v__ast__Type type_lo = right_type; if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { - v__ast__Type _var_18748 = type_hi; - v__ast__Type _var_18757 = type_lo; - type_hi = _var_18757; - type_lo = _var_18748; + v__ast__Type _var_19097 = type_hi; + v__ast__Type _var_19106 = type_lo; + type_hi = _var_19106; + type_lo = _var_19097; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -47471,7 +49764,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (node->is_method && v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->receiver_type); if (sym->info._typ == 459 /* v.ast.Struct */) { - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -47494,8 +49787,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 477 /* v.ast.Interface */) { - if (c->table->cur_fn->generic_names.len > 0) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -47518,8 +49811,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 478 /* v.ast.SumType */) { - if (c->table->cur_fn->generic_names.len > 0) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); typ = (*(v__ast__Type*)/*ee elem_sym */array_get(c->table->cur_concrete_types, idx)); @@ -47557,7 +49850,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && string__eq(param_type_sym->name, gt_name)) { to_set = v__ast__mktyp(arg.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, arg.typ); - if ((sym->info)._typ == 486 /* v.ast.FnType */) { + if ((sym->info)._typ == 487 /* v.ast.FnType */) { v__ast__Fn func_ = (*sym->info._v__ast__FnType).func; func_.name = _SLIT(""); int idx = v__ast__Table_find_or_register_fn_type(c->table, c->mod, func_, true, false); @@ -47582,7 +49875,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { - if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { + if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; @@ -47595,15 +49888,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__array_fixed && param_type_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; - v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { - if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { + arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -47622,8 +49915,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ typ = arg_map_info.value_type; } } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { - v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; - v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ).func; if (param_type_func.params.len == arg_type_func.params.len) { for (int n = 0; n < param_type_func.params.len; ++n) { v__ast__Param fn_param = ((v__ast__Param*)param_type_func.params.data)[n]; @@ -47642,11 +49935,11 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ generic_types = (*arg_sym->info._v__ast__Struct).generic_types; concrete_types = (*arg_sym->info._v__ast__Struct).concrete_types; } - else if (arg_sym->info._typ == 477 /* v.ast.Interface */) { + else if (arg_sym->info._typ == 478 /* v.ast.Interface */) { generic_types = (*arg_sym->info._v__ast__Interface).generic_types; concrete_types = (*arg_sym->info._v__ast__Interface).concrete_types; } - else if (arg_sym->info._typ == 478 /* v.ast.SumType */) { + else if (arg_sym->info._typ == 479 /* v.ast.SumType */) { generic_types = (*arg_sym->info._v__ast__SumType).generic_types; concrete_types = (*arg_sym->info._v__ast__SumType).concrete_types; } @@ -47715,14 +50008,14 @@ VV_LOCAL_SYMBOL Array_string v__checker__all_valid_comptime_idents(void) { v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Preferences* pref) { bool timers_should_print = false; - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.const_var = ((voidptr)(0)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); return _t1; } VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_file(v__checker__Checker* c) { c->expected_type = _const_v__ast__void_type; c->expected_or_type = _const_v__ast__void_type; - c->const_decl = _SLIT(""); + c->const_var = ((voidptr)(0)); c->in_for_count = 0; c->returns = false; c->scope_returns = false; @@ -47876,7 +50169,7 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ if (c->pref->is_script && !c->pref->is_test) { v__ast__File* the_main_file = (*(v__ast__File**)array_last(files_from_main_module)); array_push((array*)&the_main_file->stmts, _MOV((v__ast__Stmt[]){ v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = __new_array(0, 0, sizeof(v__ast__Param)), @@ -48079,7 +50372,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy if (typ_sym->kind == v__ast__Kind__placeholder || typ_sym->kind == v__ast__Kind__int_literal || typ_sym->kind == v__ast__Kind__float_literal) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__alias) { - v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_str(typ_sym)}}, {_SLIT("` is an alias, use the original alias type `"), /*115 &string*/0xfe10, {.d_s = orig_sym->name}}, {_SLIT("` instead"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__chan) { v__checker__Checker_error(c, _SLIT("aliases of `chan` types are not allowed."), node.type_pos); @@ -48089,7 +50382,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy void v__checker__Checker_fn_type_decl(v__checker__Checker* c, v__ast__FnTypeDecl node) { v__checker__Checker_check_valid_pascal_case(c, node.name, _SLIT("fn type"), node.pos); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, node.typ); - v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; v__ast__Fn fn_info = fn_typ_info.func; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, fn_info.return_type, fn_info.return_type_pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -48286,7 +50579,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im elem_type = (*left_sym->info._v__ast__Array).elem_type; kind = _SLIT("array"); } - else if (left_sym->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (left_sym->info._typ == 483 /* v.ast.ArrayFixed */) { elem_type = (*left_sym->info._v__ast__ArrayFixed).elem_type; kind = _SLIT("fixed array"); } @@ -48301,19 +50594,19 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (v__ast__Type_has_flag(elem_type, v__ast__TypeFlag__shared_f)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("you have to create a handle and `lock` it to modify `shared` "), /*115 &string*/0xfe10, {.d_s = kind}}, {_SLIT(" element"), 0, { .d_c = 0 }}})), v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos)); } - multi_return_string_v__token__Pos mr_21955 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_21955.arg0; - pos = mr_21955.arg1; + multi_return_string_v__token__Pos mr_22155 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_22155.arg0; + pos = mr_22155.arg1; } else if (expr._typ == 324 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_22024 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_22024.arg0; - pos = mr_22024.arg1; + multi_return_string_v__token__Pos mr_22224 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_22224.arg0; + pos = mr_22224.arg1; } else if (expr._typ == 326 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_22096 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_22096.arg0; - pos = mr_22096.arg1; + multi_return_string_v__token__Pos mr_22296 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_22296.arg0; + pos = mr_22296.arg1; } else if (expr._typ == 329 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -48335,7 +50628,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (_t6.state != 0) { /*or block*/ IError err = _t6.err; has_field = false; - *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); } v__ast__StructField field_info = (*(v__ast__StructField*)_t6.data); @@ -48363,9 +50656,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im string type_str = v__ast__Table_type_to_str(c->table, (*expr._v__ast__SelectorExpr).expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT("` of struct `"), /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT("` is immutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__SelectorExpr).pos); } - multi_return_string_v__token__Pos mr_23560 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_23560.arg0; - pos = mr_23560.arg1; + multi_return_string_v__token__Pos mr_23760 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_23760.arg0; + pos = mr_23760.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -48374,7 +50667,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__interface_: { - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; _option_v__ast__StructField _t9 = v__ast__Interface_find_field(&interface_info, (*expr._v__ast__SelectorExpr).field_name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -48394,7 +50687,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__sum_type: { - v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; _option_v__ast__StructField _t12 = v__ast__SumType_find_field(&sumtype_info, (*expr._v__ast__SelectorExpr).field_name); if (_t12.state != 0) { /*or block*/ IError err = _t12.err; @@ -48471,9 +50764,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_25383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_25383.arg0; - pos = mr_25383.arg1; + multi_return_string_v__token__Pos mr_25583 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_25583.arg0; + pos = mr_25583.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -48491,7 +50784,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else { - if (!v__ast__Expr_is_lit(expr)) { + if (!v__ast__Expr_is_pure_literal(expr)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected expression `"), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (expr)._typ ))}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -48516,12 +50809,12 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t2 = true; return _t2; } - if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 478 /* v.ast.Interface */) { v__ast__Type generic_type = interface_type; v__ast__Interface generic_info = (*inter_sym->info._v__ast__Interface); if (v__ast__Type_has_flag((*inter_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*inter_sym->info._v__ast__Interface).parent_type); - if ((parent_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((parent_sym->info)._typ == 478 /* v.ast.Interface */) { generic_type = (*inter_sym->info._v__ast__Interface).parent_type; generic_info = (*parent_sym->info._v__ast__Interface); } @@ -48543,7 +50836,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, return _t5; } } - if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 478 /* v.ast.Interface */) { for (int _t6 = 0; _t6 < (*inter_sym->info._v__ast__Interface).types.len; ++_t6) { v__ast__Type t = ((v__ast__Type*)(*inter_sym->info._v__ast__Interface).types.data)[_t6]; if (v__ast__Type_idx(t) == v__ast__Type_idx(utyp)) { @@ -48552,7 +50845,6 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - string styp = v__ast__Table_type_to_str(c->table, utyp); if (v__ast__Type_idx(utyp) == v__ast__Type_idx(interface_type)) { bool _t8 = true; return _t8; @@ -48561,10 +50853,11 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t9 = true; return _t9; } + string styp = v__ast__Table_type_to_str(c->table, utyp); if (typ_sym->kind == v__ast__Kind__interface_ && inter_sym->kind == v__ast__Kind__interface_ && !string_starts_with(styp, _SLIT("JS.")) && !string_starts_with(inter_sym->name, _SLIT("JS."))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot implement interface `"), /*115 &string*/0xfe10, {.d_s = inter_sym->name}}, {_SLIT("` with a different interface `"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); + Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); if (!v__ast__Type_alias_eq(utyp, _const_v__ast__voidptr_type)) { for (int _t10 = 0; _t10 < imethods.len; ++_t10) { v__ast__Fn imethod = ((v__ast__Fn*)imethods.data)[_t10]; @@ -48598,7 +50891,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 478 /* v.ast.Interface */) { for (int _t14 = 0; _t14 < (*inter_sym->info._v__ast__Interface).fields.len; ++_t14) { v__ast__StructField ifield = ((v__ast__StructField*)(*inter_sym->info._v__ast__Interface).fields.data)[_t14]; _option_v__ast__StructField _t15; @@ -48662,7 +50955,7 @@ v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr node, v__ast__Type ret_type, v__ast__Type expr_return_type) { if (node.kind == v__ast__OrKind__propagate_option) { - if (!v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { + if (!isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__optional)) { @@ -48675,7 +50968,7 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no return; } if (node.kind == v__ast__OrKind__propagate_result) { - if (!v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__result) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { + if (!isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__result) && !string__eq(c->table->cur_fn->name, _SLIT("main.main")) && !c->inside_const) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an result type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__result)) { @@ -48706,7 +50999,6 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* if (type_fits || is_noreturn) { return; } - string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__void_type)) { if (((*stmt._v__ast__ExprStmt).expr)._typ == 310 /* v.ast.IfExpr */) { for (int _t1 = 0; _t1 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t1) { @@ -48721,9 +51013,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* } return; } + string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`or` block must provide a default value of type `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`, or return/continue/break or call a [noreturn] function like panic(err) or exit(1)"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } else { string type_name = v__ast__Table_type_to_str(c->table, last_stmt_typ); + string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("wrong return type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` in the `or {}` block, expected `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } } @@ -48783,7 +51077,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S int name_type = 0; if (node->expr._typ == 309 /* v.ast.Ident */) { string name = (*node->expr._v__ast__Ident).name; - bool valid_generic = v__util__is_generic_type_name(name) && Array_string_contains(c->table->cur_fn->generic_names, name); + bool valid_generic = v__util__is_generic_type_name(name) && !isnil(c->table->cur_fn) && Array_string_contains(c->table->cur_fn->generic_names, name); if (valid_generic) { name_type = v__ast__Type_set_flag(((v__ast__Table_find_type_idx(c->table, name))), v__ast__TypeFlag__generic); } @@ -48859,7 +51153,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; - v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 459 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; @@ -48887,12 +51181,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_39652 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_39652.arg0; - embed_types = mr_39652.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40023 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_40023.arg0; + embed_types = mr_40023.arg1; node->from_embed_types = embed_types; if (sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__sum_type) { unknown_field_msg = IError_name_table[err._typ]._method_msg(err._object); @@ -48923,12 +51217,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_40483 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40483.arg0; - embed_types = mr_40483.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40854 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40854.arg0; + embed_types = mr_40854.arg1; node->from_embed_types = embed_types; } } @@ -48948,33 +51242,49 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S return _t18; } if (has_field) { - if (!string__eq(sym->mod, c->mod) && !field.is_pub && sym->language != v__ast__Language__c) { + bool is_used_outside = !string__eq(sym->mod, c->mod); + if (is_used_outside && !field.is_pub && sym->language != v__ast__Language__c) { v__ast__TypeSymbol* unwrapped_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("` is not public"), 0, { .d_c = 0 }}})), node->pos); } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); + if (field.is_deprecated && is_used_outside) { + time__Time now = time__now(); + time__Time after_time = now; + if ((field.deprecated_after).len != 0) { + _option_time__Time _t19 = time__parse_iso8601(field.deprecated_after); + if (_t19.state != 0) { /*or block*/ + IError err = _t19.err; + v__checker__Checker_error(c, _SLIT("invalid time format"), field.pos); + *(time__Time*) _t19.data = now; + } + + after_time = (*(time__Time*)_t19.data); + } + v__checker__Checker_deprecate(c, _SLIT("field"), field_name, field.deprecation_msg, now, after_time, node->pos); + } if (field_sym->kind == v__ast__Kind__sum_type || field_sym->kind == v__ast__Kind__interface_) { if (!prevent_sum_type_unwrapping_once) { - _option_v__ast__ScopeStructField _t19; - if (_t19 = v__ast__Scope_find_struct_field(node->scope, v__ast__Expr_str(node->expr), typ, field_name), _t19.state == 0) { - v__ast__ScopeStructField scope_field = *(v__ast__ScopeStructField*)_t19.data; - v__ast__Type _t20 = (*(v__ast__Type*)array_last(scope_field.smartcasts)); - return _t20; + _option_v__ast__ScopeStructField _t20; + if (_t20 = v__ast__Scope_find_struct_field(node->scope, v__ast__Expr_str(node->expr), typ, field_name), _t20.state == 0) { + v__ast__ScopeStructField scope_field = *(v__ast__ScopeStructField*)_t20.data; + v__ast__Type _t21 = (*(v__ast__Type*)array_last(scope_field.smartcasts)); + return _t21; } } } node->typ = field.typ; - v__ast__Type _t21 = field.typ; - return _t21; + v__ast__Type _t22 = field.typ; + return _t22; } - _option_v__ast__Fn _t22; - if (_t22 = v__ast__Table_find_method(c->table, sym, field_name), _t22.state == 0) { - v__ast__Fn method = *(v__ast__Fn*)_t22.data; + _option_v__ast__Fn _t23; + if (_t23 = v__ast__Table_find_method(c->table, sym, field_name), _t23.state == 0) { + v__ast__Fn method = *(v__ast__Fn*)_t23.data; if (c->expected_type != 0 && !v__ast__Type_alias_eq(c->expected_type, _const_v__ast__none_type)) { v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, c->mod, method, false, true)); if (v__checker__Checker_check_types(c, fn_type, c->expected_type)) { - v__ast__Type _t23 = fn_type; - return _t23; + v__ast__Type _t24 = fn_type; + return _t24; } } v__ast__Type receiver = (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).typ; @@ -48987,21 +51297,21 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } } } - Array_v__ast__Param _t24; - method.params = (_t24 = method.params, array_slice(_t24, 1, _t24.len)); + Array_v__ast__Param _t25; + method.params = (_t25 = method.params, array_slice(_t25, 1, _t25.len)); node->has_hidden_receiver = true; method.name = _SLIT(""); v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, c->mod, method, false, true)); - v__ast__Type _t25 = fn_type; - return _t25; + v__ast__Type _t26 = fn_type; + return _t26; } if (!(sym->kind == v__ast__Kind__struct_ || sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__interface_ || sym->kind == v__ast__Kind__sum_type)) { if (sym->kind != v__ast__Kind__placeholder) { v__ast__TypeSymbol* unwrapped_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (unwrapped_sym->kind == v__ast__Kind__array_fixed && string__eq(node->field_name, _SLIT("len"))) { node->typ = _const_v__ast__int_type; - v__ast__Type _t26 = _const_v__ast__int_type; - return _t26; + v__ast__Type _t27 = _const_v__ast__int_type; + return _t27; } v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("` has no property `"), /*115 &string*/0xfe10, {.d_s = node->field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -49010,20 +51320,20 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); } - Array_string _t27 = {0}; - Array_v__ast__StructField _t27_orig = (*sym->info._v__ast__Struct).fields; - int _t27_len = _t27_orig.len; - _t27 = __new_array(0, _t27_len, sizeof(string)); + Array_string _t28 = {0}; + Array_v__ast__StructField _t28_orig = (*sym->info._v__ast__Struct).fields; + int _t28_len = _t28_orig.len; + _t28 = __new_array(0, _t28_len, sizeof(string)); - for (int _t28 = 0; _t28 < _t27_len; ++_t28) { - v__ast__StructField it = ((v__ast__StructField*) _t27_orig.data)[_t28]; + for (int _t29 = 0; _t29 < _t28_len; ++_t29) { + v__ast__StructField it = ((v__ast__StructField*) _t28_orig.data)[_t29]; string ti = it.name; - array_push((array*)&_t27, &ti); + array_push((array*)&_t28, &ti); } - v__util__Suggestion suggestion = v__util__new_suggestion(field_name,_t27); + v__util__Suggestion suggestion = v__util__new_suggestion(field_name,_t28); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_field_msg), node->pos); - v__ast__Type _t29 = _const_v__ast__void_type; - return _t29; + v__ast__Type _t30 = _const_v__ast__void_type; + return _t30; } if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); @@ -49033,8 +51343,8 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } v__checker__Checker_error(c, unknown_field_msg, node->pos); } - v__ast__Type _t30 = _const_v__ast__void_type; - return _t30; + v__ast__Type _t31 = _const_v__ast__void_type; + return _t31; } void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* node) { @@ -49051,8 +51361,9 @@ void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* n } for (int i = 0; i < node->fields.len; ++i) { v__ast__ConstField* field = ((v__ast__ConstField*)node->fields.data) + i; - c->const_decl = field->name; array_push((array*)&c->const_deps, _MOV((string[]){ string_clone(field->name) })); + v__ast__ConstField* prev_const_var = c->const_var; + c->const_var = field; v__ast__Type typ = v__checker__Checker_check_expr_opt_call(c, field->expr, v__checker__Checker_expr(c, field->expr)); _option_v__ast__ComptTimeConstValue _t4; if (_t4 = v__checker__Checker_eval_comptime_const_expr(c, field->expr, 0), _t4.state == 0) { @@ -49064,6 +51375,7 @@ void v__checker__Checker_const_decl(v__checker__Checker* c, v__ast__ConstDecl* n } (*(v__ast__ConstField*)/*ee elem_sym */array_get(node->fields, i)).typ = v__ast__mktyp(typ); c->const_deps = __new_array_with_default(0, 0, sizeof(string), 0); + c->const_var = prev_const_var; } } @@ -49175,7 +51487,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St c->inside_const = false; } else if (node._typ == 346 /* v.ast.DeferStmt */) { - if ((*node._v__ast__DeferStmt).idx_in_fn < 0) { + if ((*node._v__ast__DeferStmt).idx_in_fn < 0 && !isnil(c->table->cur_fn)) { (*node._v__ast__DeferStmt).idx_in_fn = c->table->cur_fn->defer_stmts.len; array_push((array*)&c->table->cur_fn->defer_stmts, _MOV((v__ast__DeferStmt[]){ *&(*node._v__ast__DeferStmt) })); } @@ -49261,7 +51573,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St if (!c->inside_unsafe) { v__checker__Checker_warn(c, _SLIT("`goto` requires `unsafe` (consider using labelled break/continue)"), (*node._v__ast__GotoStmt).pos); } - if (!Array_string_contains(c->table->cur_fn->label_names, (*node._v__ast__GotoStmt).name)) { + if (!isnil(c->table->cur_fn) && !Array_string_contains(c->table->cur_fn->label_names, (*node._v__ast__GotoStmt).name)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown label `"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__GotoStmt).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__GotoStmt).pos); } } @@ -49736,7 +52048,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmts_ending_with_expression(v__checker } v__ast__Type v__checker__Checker_unwrap_generic(v__checker__Checker* c, v__ast__Type typ) { - if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { + if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn)) { _option_v__ast__Type _t1; if (_t1 = v__ast__Table_resolve_generic_to_concrete(c->table, typ, c->table->cur_fn->generic_names, c->table->cur_concrete_types), _t1.state == 0) { v__ast__Type t_typ = *(v__ast__Type*)_t1.data; @@ -50050,8 +52362,7 @@ bool v__checker__Checker_expr_defer_0 = false; return _t27; } else if (node._typ == 309 /* v.ast.Ident */) { - v__ast__Type res = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); - v__ast__Type _t28 = res; + v__ast__Type _t28 = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); // Defer begin if (v__checker__Checker_expr_defer_0) { c->expr_level--; @@ -50412,7 +52723,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - } else if ((to_sym->info)._typ == 474 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { + } else if ((to_sym->info)._typ == 475 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { if (!v__checker__Checker_check_types(c, from_type, (*to_sym->info._v__ast__Alias).parent_type) && !(v__ast__TypeSymbol_is_int(final_to_sym) && (final_from_sym->kind == v__ast__Kind__enum_ || final_from_sym->kind == v__ast__Kind__bool || final_from_sym->kind == v__ast__Kind__i8 || final_from_sym->kind == v__ast__Kind__char))) { string ft = v__ast__Table_type_to_str(c->table, from_type); string tt = v__ast__Table_type_to_str(c->table, to_type); @@ -50435,7 +52746,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE if (!v__ast__Type_is_ptr(from_type) && !v__ast__Type_is_pointer(from_type) && from_sym->kind != v__ast__Kind__interface_ && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->expr, true); } - if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).is_generic) { + if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ).is_generic) { v__ast__Type inferred_type = v__checker__Checker_resolve_generic_interface(c, from_type, to_type, node->pos); if (inferred_type != 0) { to_type = inferred_type; @@ -50573,11 +52884,19 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, switch (node->kind) { case v__token__AtKind__fn_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t1 = _const_v__ast__void_type; + return _t1; + } node->val = string_all_after_last(c->table->cur_fn->name, _SLIT(".")); break; } case v__token__AtKind__method_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t2 = _const_v__ast__void_type; + return _t2; + } string fname = string_all_after_last(c->table->cur_fn->name, _SLIT(".")); if (c->table->cur_fn->is_method) { node->val = string__plus(string__plus(string_all_after_last(v__ast__Table_type_to_str(c->table, c->table->cur_fn->receiver.typ), _SLIT(".")), _SLIT(".")), fname); @@ -50588,6 +52907,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, } case v__token__AtKind__mod_name: { + if (isnil(c->table->cur_fn)) { + v__ast__Type _t3 = _const_v__ast__void_type; + return _t3; + } node->val = c->table->cur_fn->mod; break; } @@ -50633,13 +52956,13 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, if (vmod_file_location.vmod_file.len == 0) { v__checker__Checker_error(c, _SLIT("@VMOD_FILE can be used only in projects, that have v.mod file"), node->pos); } - _option_string _t1 = os__read_file(vmod_file_location.vmod_file); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - *(string*) _t1.data = _SLIT(""); + _option_string _t4 = os__read_file(vmod_file_location.vmod_file); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(string*) _t4.data = _SLIT(""); } - string vmod_content = (*(string*)_t1.data); + string vmod_content = (*(string*)_t4.data); c->vmod_file_content = string_replace(vmod_content, _SLIT("\r\n"), _SLIT("\n")); } node->val = c->vmod_file_content; @@ -50669,8 +52992,8 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_at_expr(v__checker__Checker* c, } } ; - v__ast__Type _t2 = _const_v__ast__string_type; - return _t2; + v__ast__Type _t5 = _const_v__ast__string_type; + return _t5; } v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* node) { @@ -50679,10 +53002,21 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no if (!string_contains(name, _SLIT(".")) && !string__eq(node->mod, _SLIT("builtin"))) { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = node->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}})); } - if (string__eq(name, c->const_decl)) { - v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cycle in constant `"), /*115 &string*/0xfe10, {.d_s = c->const_decl}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t1 = _const_v__ast__void_type; - return _t1; + if (c->const_var != 0 && string__eq(name, c->const_var->name)) { + if ((c->const_var->expr)._typ == 289 /* v.ast.ArrayInit */) { + if ((*c->const_var->expr._v__ast__ArrayInit).is_fixed && v__ast__Type_nr_muls(c->expected_type) > 0) { + v__ast__Type elem_typ = v__ast__Type_deref(c->expected_type); + node->kind = v__ast__IdentKind__constant; + node->name = c->const_var->name; + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = elem_typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); + node->obj = v__ast__ConstField_to_sumtype_v__ast__ScopeObject(c->const_var); + v__ast__Type _t1 = c->expected_type; + return _t1; + } + } + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cycle in constant `"), /*115 &fn (mut v.ast.ConstDecl)*/0xfe10, {.d_s = anon_fn_v__ast__constdecl_str()}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); + v__ast__Type _t2 = _const_v__ast__void_type; + return _t2; } array_push((array*)&c->const_deps, _MOV((string[]){ string_clone(name) })); } @@ -50690,30 +53024,30 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no if (!(node->tok_kind == v__token__Kind__assign || node->tok_kind == v__token__Kind__decl_assign)) { v__checker__Checker_error(c, _SLIT("undefined ident: `_` (may only be used in assignments)"), node->pos); } - v__ast__Type _t3 = _const_v__ast__void_type; - return _t3; + v__ast__Type _t4 = _const_v__ast__void_type; + return _t4; } if (node->kind == v__ast__IdentKind__constant || node->kind == v__ast__IdentKind__global || node->kind == v__ast__IdentKind__variable) { v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 419) /*expected idx: 419, name: v.ast.IdentVar */ ; - v__ast__Type _t4 = info.typ; - return _t4; - } else if (node->kind == v__ast__IdentKind__function) { - v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 418) /*expected idx: 418, name: v.ast.IdentFn */ ; v__ast__Type _t5 = info.typ; return _t5; + } else if (node->kind == v__ast__IdentKind__function) { + v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 418) /*expected idx: 418, name: v.ast.IdentFn */ ; + v__ast__Type _t6 = info.typ; + return _t6; } else if (node->kind == v__ast__IdentKind__unresolved) { if (node->tok_kind == v__token__Kind__assign && node->is_mut) { v__checker__Checker_error(c, _SLIT("`mut` not allowed with `=` (use `:=` to declare a variable)"), node->pos); } - _option_v__ast__ScopeObject _t6; - if (_t6 = v__ast__Scope_find(node->scope, node->name), _t6.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; + _option_v__ast__ScopeObject _t7; + if (_t7 = v__ast__Scope_find(node->scope, node->name), _t7.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t7.data; if (obj._typ == 366 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; - v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; - return _t7; + v__ast__Type _t8 = (*obj._v__ast__GlobalField).typ; + return _t8; } else if (obj._typ == 367 /* v.ast.Var */) { int node_pos = (c->pref->is_vweb && !_IN_MAP(ADDR(string, node->name), ADDR(map, node->scope->objects)) && node->scope->start_pos < c->comptime_call_pos ? (c->comptime_call_pos) : (node->pos.pos)); @@ -50722,25 +53056,25 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } bool is_sum_type_cast = (*obj._v__ast__Var).smartcasts.len != 0 && !c->prevent_sum_type_unwrapping_once; c->prevent_sum_type_unwrapping_once = false; - v__ast__Type _t8; /* if prepend */ + v__ast__Type _t9; /* if prepend */ if (is_sum_type_cast) { - _t8 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); + _t9 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); } else { - _t8 = (*obj._v__ast__Var).typ; + _t9 = (*obj._v__ast__Var).typ; } - v__ast__Type typ = _t8; + v__ast__Type typ = _t9; if (typ == 0) { if (((*obj._v__ast__Var).expr)._typ == 309 /* v.ast.Ident */) { if ((*(*obj._v__ast__Var).expr._v__ast__Ident).kind == v__ast__IdentKind__unresolved) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unresolved variable: `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t9 = _const_v__ast__void_type; - return _t9; + v__ast__Type _t10 = _const_v__ast__void_type; + return _t10; } } if (((*obj._v__ast__Var).expr)._typ == 311 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len) { for (int vi = 0; vi < (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len; ++vi) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.data)[vi]; @@ -50764,11 +53098,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } node->obj = obj; if (is_optional) { - v__ast__Type _t10 = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); - return _t10; + v__ast__Type _t11 = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); + return _t11; } - v__ast__Type _t11 = typ; - return _t11; + v__ast__Type _t12 = typ; + return _t12; } else { @@ -50781,9 +53115,9 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } else if (!string_contains(name, _SLIT(".")) && !string__eq(node->mod, _SLIT("builtin"))) { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = node->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}})); } - _option_v__ast__ScopeObject _t12; - if (_t12 = v__ast__Scope_find(c->file->global_scope, name), _t12.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t12.data; + _option_v__ast__ScopeObject _t13; + if (_t13 = v__ast__Scope_find(c->file->global_scope, name), _t13.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t13.data; if (obj._typ == 365 /* v.ast.ConstField */) { if (!((*obj._v__ast__ConstField).is_pub || string__eq((*obj._v__ast__ConstField).mod, c->mod) || c->pref->is_test)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("constant `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); @@ -50807,39 +53141,39 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); (*obj._v__ast__ConstField).typ = typ; node->obj = obj; - v__ast__Type _t13 = typ; - return _t13; + v__ast__Type _t14 = typ; + return _t14; } else { } ; } - _option_v__ast__Fn _t14; - if (_t14 = v__ast__Table_find_fn(c->table, name), _t14.state == 0) { - v__ast__Fn func = *(v__ast__Fn*)_t14.data; + _option_v__ast__Fn _t15; + if (_t15 = v__ast__Table_find_fn(c->table, name), _t15.state == 0) { + v__ast__Fn func = *(v__ast__Fn*)_t15.data; v__ast__Type fn_type = v__ast__new_type(v__ast__Table_find_or_register_fn_type(c->table, node->mod, func, false, true)); node->name = name; node->kind = v__ast__IdentKind__function; node->info = v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentFn, (((v__ast__IdentFn){.typ = fn_type,})))); - v__ast__Type _t15 = fn_type; - return _t15; + v__ast__Type _t16 = fn_type; + return _t16; } } if (node->language == v__ast__Language__c) { if (string__eq(node->name, _SLIT("C.NULL"))) { - v__ast__Type _t16 = _const_v__ast__voidptr_type; - return _t16; + v__ast__Type _t17 = _const_v__ast__voidptr_type; + return _t17; } - v__ast__Type _t17 = _const_v__ast__int_type; - return _t17; + v__ast__Type _t18 = _const_v__ast__int_type; + return _t18; } if (c->inside_sql) { - _option_v__ast__StructField _t18; - if (_t18 = v__ast__Table_find_field(c->table, (voidptr)&/*qq*/c->cur_orm_ts, node->name), _t18.state == 0) { - v__ast__StructField field = *(v__ast__StructField*)_t18.data; - v__ast__Type _t19 = field.typ; - return _t19; + _option_v__ast__StructField _t19; + if (_t19 = v__ast__Table_find_field(c->table, (voidptr)&/*qq*/c->cur_orm_ts, node->name), _t19.state == 0) { + v__ast__StructField field = *(v__ast__StructField*)_t19.data; + v__ast__Type _t20 = field.typ; + return _t20; } } if (node->kind == v__ast__IdentKind__unresolved && !string__eq(node->mod, _SLIT("builtin"))) { @@ -50847,8 +53181,8 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no node->mod = _SLIT("builtin"); v__ast__Type builtin_type = v__checker__Checker_ident(c, node); if (!v__ast__Type_alias_eq(builtin_type, _const_v__ast__void_type)) { - v__ast__Type _t20 = builtin_type; - return _t20; + v__ast__Type _t21 = builtin_type; + return _t21; } node->mod = saved_mod; } @@ -50863,17 +53197,17 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no string cname_mod = string_all_before(node->name, _SLIT(".")); if (cname_mod.len != node->name.len) { Array_string const_names_in_mod = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_v__ast__ScopeObject _t21 = c->table->global_scope->objects; - int _t23 = _t21.key_values.len; - for (int _t22 = 0; _t22 < _t23; ++_t22 ) { - int _t24 = _t21.key_values.len - _t23; - _t23 = _t21.key_values.len; - if (_t24 < 0) { - _t22 = -1; + Map_string_v__ast__ScopeObject _t22 = c->table->global_scope->objects; + int _t24 = _t22.key_values.len; + for (int _t23 = 0; _t23 < _t24; ++_t23 ) { + int _t25 = _t22.key_values.len - _t24; + _t24 = _t22.key_values.len; + if (_t25 < 0) { + _t23 = -1; continue; } - if (!DenseArray_has_index(&_t21.key_values, _t22)) {continue;} - v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t21.key_values, _t22)); + if (!DenseArray_has_index(&_t22.key_values, _t23)) {continue;} + v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t22.key_values, _t23)); if ((so)._typ == 365 /* v.ast.ConstField */) { if (string__eq((*so._v__ast__ConstField).mod, cname_mod)) { array_push((array*)&const_names_in_mod, _MOV((string[]){ string_clone((*so._v__ast__ConstField).name) })); @@ -50887,11 +53221,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } } if (v__ast__Table_known_type(c->table, node->name)) { - v__ast__Type _t26 = _const_v__ast__void_type; - return _t26; + v__ast__Type _t27 = _const_v__ast__void_type; + return _t27; } - v__ast__Type _t27 = _const_v__ast__void_type; - return _t27; + v__ast__Type _t28 = _const_v__ast__void_type; + return _t28; } v__ast__Type v__checker__Checker_concat_expr(v__checker__Checker* c, v__ast__ConcatExpr* node) { @@ -51157,7 +53491,7 @@ VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_obj_definition(v__ _option_v__ast__Expr _t3 = v__checker__Checker_find_definition(c, (*expr._v__ast__Ident)); return _t3; } - if (!v__ast__Expr_is_lit(expr)) { + if (!v__ast__Expr_is_pure_literal(expr)) { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("definition of `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is unknown at compile time"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } _option_v__ast__Expr _t5; @@ -51195,8 +53529,8 @@ v__ast__Type v__checker__Checker_postfix_expr(v__checker__Checker* c, v__ast__Po string typ_str = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("invalid operation: "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" (non-numeric type `"), /*115 &string*/0xfe10, {.d_s = typ_str}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } else { - multi_return_string_v__token__Pos mr_96262 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_96262.arg0; + multi_return_string_v__token__Pos mr_97509 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_97509.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -51291,7 +53625,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre } else if ((node->right)._typ == 329 /* v.ast.SelectorExpr */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); - if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).uses_exprs))) { + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).uses_exprs))) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take address of field in struct `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, (*node->right._v__ast__SelectorExpr).expr_type)}}, {_SLIT("`, which is tagged as `[minify]`"), 0, { .d_c = 0 }}})), v__token__Pos_extend(node->pos, (*node->right._v__ast__SelectorExpr).pos)); } } @@ -51376,7 +53710,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) { v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type); if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) { - if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { + if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos); } @@ -51385,7 +53719,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative index `"), /*115 &string*/0xfe10, {.d_s = (*index._v__ast__IntegerLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } else if (typ_sym->kind == v__ast__Kind__array_fixed) { int i = string_int((*index._v__ast__IntegerLiteral).val); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; if ((!range_index && i >= info.size) || (range_index && i > info.size)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("index out of range (index: "), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT(", len: "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT(")"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } @@ -51485,6 +53819,9 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde typ = value_type; } } + if (node->or_expr.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->or_expr.stmts)))._typ == 349 /* v.ast.ExprStmt */) { + c->expected_or_type = typ; + } v__checker__Checker_stmts_ending_with_expression(c, node->or_expr.stmts); v__checker__Checker_check_expr_opt_call(c, v__ast__IndexExpr_to_sumtype_v__ast__Expr(node), typ); v__ast__Type _t1 = typ; @@ -51531,7 +53868,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - if ((fsym->info)._typ != 488 /* v.ast.Enum */) { + if ((fsym->info)._typ != 489 /* v.ast.Enum */) { v__checker__Checker_error(c, _SLIT("not an enum"), node->pos); v__ast__Type _t6 = _const_v__ast__void_type; return _t6; @@ -51786,7 +54123,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array_fixed: { - _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type, pos); + _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type, pos); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; memcpy(&_t4, &_t3, sizeof(_option)); @@ -51819,7 +54156,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__sum_type: { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; for (int _t9 = 0; _t9 < info.concrete_types.len; ++_t9) { v__ast__Type concrete_typ = ((v__ast__Type*)info.concrete_types.data)[_t9]; _option_void _t10 = v__checker__Checker_ensure_type_exists(c, concrete_typ, pos); @@ -51973,7 +54310,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).cmain,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_crun,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -53671,7 +56008,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } ; - if (v__ast__Type_has_flag(node->typ, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (v__ast__Type_has_flag(node->typ, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { v__checker__Checker_error(c, _SLIT("generic struct cannot use in non-generic function"), node->pos); } v__ast__Type _t3 = node->typ; @@ -54045,7 +56382,7 @@ v__ast__Scope* prev_fn_scope; } } v__ast__TypeSymbol* return_sym = v__ast__Table_final_sym(c->table, node->return_type); - if ((return_sym->info)._typ == 485 /* v.ast.MultiReturn */) { + if ((return_sym->info)._typ == 486 /* v.ast.MultiReturn */) { for (int _t4 = 0; _t4 < (*return_sym->info._v__ast__MultiReturn).types.len; ++_t4) { v__ast__Type multi_type = ((v__ast__Type*)(*return_sym->info._v__ast__MultiReturn).types.data)[_t4]; v__ast__TypeSymbol* multi_sym = v__ast__Table_sym(c->table, multi_type); @@ -54096,7 +56433,7 @@ v__ast__Scope* prev_fn_scope; return; } if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - if ((sym->info)._typ == 477 /* v.ast.Interface */) { + if ((sym->info)._typ == 478 /* v.ast.Interface */) { if (v__ast__Interface_has_method(&(*sym->info._v__ast__Interface), node->name)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` cannot implement its own interface method `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -54176,18 +56513,18 @@ v__ast__Scope* prev_fn_scope; v__checker__Checker_error(c, _SLIT("generic struct in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__interface_) { - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic interface in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic sumtype in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } } - if ((c->pref->translated || c->file->is_translated) && node->is_variadic && node->params.len == 1 && v__ast__Type_is_ptr(param->typ)) { + if ((c->pref->translated || c->file->is_translated) && node->is_variadic && v__ast__Type_is_ptr(param->typ)) { param->typ = v__ast__Type_ref(_const_v__ast__int_type); } } @@ -54395,7 +56732,7 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE c->expected_or_type = v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__optional); v__checker__Checker_stmts_ending_with_expression(c, node->or_block.stmts); c->expected_or_type = _const_v__ast__void_type; - if (node->or_block.kind == v__ast__OrKind__propagate_option && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !c->inside_const) { + if (node->or_block.kind == v__ast__OrKind__propagate_option && !isnil(c->table->cur_fn) && !v__ast__Type_has_flag(c->table->cur_fn->return_type, v__ast__TypeFlag__optional) && !c->inside_const) { if (!c->table->cur_fn->is_main) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the optional call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional"), 0, { .d_c = 0 }}})), node->or_block.pos); } @@ -54451,7 +56788,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - c->table->cur_fn->has_await = true; + if (!isnil(c->table->cur_fn)) { + c->table->cur_fn->has_await = true; + } if (tsym->info._typ == 459 /* v.ast.Struct */) { v__ast__Type ret_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*tsym->info._v__ast__Struct).concrete_types, 0)); ret_type = v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional); @@ -54479,7 +56818,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, (*expr._v__ast__TypeNode).typ)); if (v__ast__Table_known_type(c->table, sym->name) && sym->kind != v__ast__Kind__placeholder) { v__ast__Kind kind = sym->kind; - if ((sym->info)._typ == 474 /* v.ast.Alias */) { + if ((sym->info)._typ == 475 /* v.ast.Alias */) { kind = v__ast__Table_sym(c->table, (*sym->info._v__ast__Alias).parent_type)->kind; } if (!(kind == v__ast__Kind__struct_ || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__map || kind == v__ast__Kind__array)) { @@ -54513,7 +56852,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_expr(c, node->left); if (!v__ast__Type_alias_eq((*node->left._v__ast__AnonFn).typ, ((v__ast__Type)(0)))) { v__ast__TypeSymbol* anon_fn_sym = v__ast__Table_sym(c->table, (*node->left._v__ast__AnonFn).typ); - func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ).func; found = true; } } @@ -54533,7 +56872,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_final_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); if ((sym->info)._typ == 454 /* v.ast.Array */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Array).elem_type); - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { func = (*elem_sym->info._v__ast__FnType).func; found = true; } else { @@ -54541,15 +56880,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } else if ((sym->info)._typ == 455 /* v.ast.Map */) { v__ast__TypeSymbol* value_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Map).value_type); - if ((value_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((value_sym->info)._typ == 487 /* v.ast.FnType */) { func = (*value_sym->info._v__ast__FnType).func; found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the value of the map, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 482 /* v.ast.ArrayFixed */) { + } else if ((sym->info)._typ == 483 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__ArrayFixed).elem_type); - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { func = (*elem_sym->info._v__ast__FnType).func; found = true; } else { @@ -54560,7 +56899,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (!found && (node->left)._typ == 295 /* v.ast.CallExpr */) { v__checker__Checker_expr(c, node->left); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__CallExpr).return_type); - if ((sym->info)._typ == 486 /* v.ast.FnType */) { + if ((sym->info)._typ == 487 /* v.ast.FnType */) { node->return_type = (*sym->info._v__ast__FnType).func.return_type; found = true; func = (*sym->info._v__ast__FnType).func; @@ -54632,14 +56971,14 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (typ != 0) { v__ast__TypeSymbol* generic_vts = v__ast__Table_final_sym(c->table, typ); if (generic_vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; } else { v__ast__TypeSymbol* vts = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; @@ -54655,7 +56994,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(obj.typ))); if (sym->kind == v__ast__Kind__function) { found = true; - func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ).func; } } } @@ -54813,9 +57152,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_error(c, _SLIT("function with `shared` arguments cannot be called inside `lock`/`rlock` block"), call_arg->pos); } if (call_arg->is_mut) { - multi_return_string_v__token__Pos mr_28912 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_28912.arg0; - v__token__Pos pos = mr_28912.arg1; + multi_return_string_v__token__Pos mr_28998 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_28998.arg0; + v__token__Pos pos = mr_28998.arg1; if (!v__ast__Expr_is_lvalue(call_arg->expr)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(call_arg->expr)); } @@ -54855,6 +57194,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } + if (v__ast__Type_is_ptr(param.typ) && !param.is_mut && !v__ast__Type_is_real_pointer(call_arg->typ) && v__ast__Expr_is_literal(call_arg->expr) && func.language == v__ast__Language__v) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("literal argument cannot be passed as reference parameter `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, param.typ)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), call_arg->pos); + } _option_void _t32 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { IError err = _t32.err; @@ -54907,7 +57249,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } } else if (arg_typ_sym_->kind == v__ast__Kind__array_fixed && param_typ_sym_->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ).elem_type)) { continue; } } @@ -54966,12 +57308,12 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } } - if (func.generic_names.len > 0 && v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (func.generic_names.len > 0 && v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { node->return_type = v__ast__Table_unwrap_generic_type(c->table, func.return_type, func.generic_names, concrete_types); } else { node->return_type = func.return_type; } - if (node->concrete_types.len > 0 && func.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { + if (node->concrete_types.len > 0 && func.return_type != 0 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { _option_v__ast__Type _t35; if (_t35 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t35.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t35.data; @@ -55013,7 +57355,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal node->left_type = left_type; node->return_type = left_type; node->receiver_type = left_type; - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { v__ast__Table_unwrap_generic_type(c->table, left_type, c->table->cur_fn->generic_names, c->table->cur_concrete_types); } v__ast__Type unwrapped_left_type = v__checker__Checker_unwrap_generic(c, left_type); @@ -55057,7 +57399,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); return _t8; } else { - v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); return _t9; } @@ -55098,13 +57440,15 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } - c->table->cur_fn->has_await = true; + if (!isnil(c->table->cur_fn)) { + c->table->cur_fn->has_await = true; + } node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0)); v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional); v__ast__Type _t14 = node->return_type; return _t14; } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { - v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.Thread */ ; + v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.Thread */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -55130,9 +57474,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type parent_type = _const_v__ast__void_type; if ((left_sym->info)._typ == 459 /* v.ast.Struct */) { parent_type = (*left_sym->info._v__ast__Struct).parent_type; - } else if ((left_sym->info)._typ == 478 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 479 /* v.ast.SumType */) { parent_type = (*left_sym->info._v__ast__SumType).parent_type; - } else if ((left_sym->info)._typ == 477 /* v.ast.Interface */) { + } else if ((left_sym->info)._typ == 478 /* v.ast.Interface */) { parent_type = (*left_sym->info._v__ast__Interface).parent_type; } if (parent_type != 0) { @@ -55159,9 +57503,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_42752 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_42752.arg0; - embed_types = mr_42752.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_43216 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_43216.arg0; + embed_types = mr_43216.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -55209,9 +57553,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); } if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { - multi_return_string_v__token__Pos mr_45062 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45062.arg0; - v__token__Pos pos = mr_45062.arg1; + multi_return_string_v__token__Pos mr_45526 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_45526.arg0; + v__token__Pos pos = mr_45526.arg1; if (!v__ast__Expr_is_lvalue(node->left)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); } @@ -55251,7 +57595,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type exp_arg_typ = ((v__ast__Type)(0)); bool param_is_mut = false; bool no_type_promotion = false; - if ((left_sym->info)._typ == 483 /* v.ast.Chan */) { + if ((left_sym->info)._typ == 484 /* v.ast.Chan */) { if (string__eq(method_name, _SLIT("try_push"))) { exp_arg_typ = v__ast__Type_ref((*left_sym->info._v__ast__Chan).elem_type); } else if (string__eq(method_name, _SLIT("try_pop"))) { @@ -55319,9 +57663,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); } if (arg->is_mut) { - multi_return_string_v__token__Pos mr_48964 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_48964.arg0; - v__token__Pos pos = mr_48964.arg1; + multi_return_string_v__token__Pos mr_49428 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_49428.arg0; + v__token__Pos pos = mr_49428.arg1; if (!param_is_mut) { string tok = v__ast__ShareType_str(arg->share); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); @@ -55345,7 +57689,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type elem_typ = (*left_sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg->typ); if (arg_sym->kind == v__ast__Kind__function) { - v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; if (func_info.func.params.len == 2) { if (v__ast__Type_nr_muls((*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ) != v__ast__Type_nr_muls(elem_typ) + 1) { string arg_typ_str = v__ast__Table_type_to_str(c->table, (*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ); @@ -55371,6 +57715,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } continue; } + if (v__ast__Type_is_ptr(param.typ) && !v__ast__Type_is_real_pointer(arg->typ) && v__ast__Expr_is_literal(arg->expr)) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("literal argument cannot be passed as reference parameter `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, param.typ)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); + } _option_void _t31 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg); if (_t31.state != 0 && _t31.err._typ != _IError_None___index) { IError err = _t31.err; @@ -55392,7 +57739,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (method.is_unsafe && !c->inside_unsafe) { v__checker__Checker_warn(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("method `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("` must be called from an `unsafe` block"), 0, { .d_c = 0 }}})), node->pos); } - if (!c->table->cur_fn->is_deprecated && method.is_deprecated) { + if (!isnil(c->table->cur_fn) && !c->table->cur_fn->is_deprecated && method.is_deprecated) { v__checker__Checker_deprecate_fnmethod(c, _SLIT("method"), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})), method, *node); } v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/method); @@ -55411,12 +57758,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Table_register_fn_concrete_types(c->table, v__ast__Fn_fkey(&method), node->concrete_types); } } - if (method.generic_names.len > 0 && v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__generic) && c->table->cur_fn->generic_names.len == 0) { + if (method.generic_names.len > 0 && v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__generic) && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { node->return_type = v__ast__Table_unwrap_generic_type(c->table, method.return_type, method.generic_names, concrete_types); } else { node->return_type = method.return_type; } - if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { + if (node->concrete_types.len > 0 && method.return_type != 0 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { _option_v__ast__Type _t32; if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t32.data; @@ -55466,7 +57813,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (field_sym->kind == v__ast__Kind__function) { node->is_method = false; node->is_field = true; - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; _option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); if (_t39.state != 0 && _t39.err._typ != _IError_None___index) { IError err = _t39.err; @@ -55505,8 +57852,8 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal return _t44; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_56127 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); - node->from_embed_types = mr_56127.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_56878 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_56878.arg1; v__ast__Type _t45 = info.func.return_type; return _t45; } @@ -55576,7 +57923,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* if (_t2.state != 0) { /*or block*/ IError err = _t2.err; v__checker__Checker_error(c, _SLIT("invalid time format"), attr.pos); - *(time__Time*) _t2.data = time__now(); + *(time__Time*) _t2.data = now; } after_time = (*(time__Time*)_t2.data); @@ -55867,7 +58214,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("map"))) { v__checker__Checker_check_map_and_filter(c, true, elem_typ, *node); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); - v__ast__Type ret_type = ((arg_sym->info._typ == 486 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); + v__ast__Type ret_type = ((arg_sym->info._typ == 487 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); node->return_type = v__ast__Table_find_or_register_array(c->table, v__checker__Checker_unwrap_generic(c, ret_type)); if (v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__shared_f)) { node->return_type = v__ast__Type_deref(v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__shared_f)); @@ -56356,7 +58703,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; if ((branch.cond)._typ == 311 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; if ((*branch.cond._v__ast__IfGuardExpr).vars.len != mr_info.types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("if guard expects "), /*100 &int*/0xfe07, {.d_i32 = mr_info.types.len}}, {_SLIT(" variables, but got "), /*100 &int*/0xfe07, {.d_i32 = (*branch.cond._v__ast__IfGuardExpr).vars.len}}, {_SLIT0, 0, { .d_c = 0 }}})), branch.pos); } else { @@ -56388,11 +58735,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; c->returns = false; } } - if (v__ast__Type_alias_eq(node->typ, _const_v__ast__int_literal_type)) { - node->typ = _const_v__ast__int_type; - } else if (v__ast__Type_alias_eq(node->typ, _const_v__ast__float_literal_type)) { - node->typ = _const_v__ast__f64_type; - } + node->typ = v__ast__mktyp(node->typ); if (expr_required && !node->has_else) { string d = (node->is_comptime ? (_SLIT("$")) : (_SLIT(""))); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT("` expression needs `"), /*115 &string*/0xfe10, {.d_s = d}}, {_SLIT("else` clause"), 0, { .d_c = 0 }}})), node->pos); @@ -56431,7 +58774,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__Type expr_type = v__checker__Checker_expr(c, (*node._v__ast__InfixExpr).left); if (left_sym->kind == v__ast__Kind__aggregate) { - expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; + expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ).sum_type; } if (left_sym->kind == v__ast__Kind__interface_) { if (right_sym->kind != v__ast__Kind__interface_) { @@ -56628,15 +58971,15 @@ v__ast__Type former_expected_type; case v__token__Kind__amp: case v__token__Kind__pipe: { - if ((right_sym->info)._typ == 474 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type))) { - right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + if ((right_sym->info)._typ == 475 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type))) { + right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); } - if ((left_sym->info)._typ == 474 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type))) { - left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + if ((left_sym->info)._typ == 475 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type))) { + left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); } if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; - } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 474 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 475 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t5; if (_t5 = v__ast__TypeSymbol_find_method(left_sym, v__token__Kind_str(node->op)), _t5.state == 0) { @@ -56655,7 +58998,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 474 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 475 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(right_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t6; if (_t6 = v__ast__TypeSymbol_find_method(right_sym, v__token__Kind_str(node->op)), _t6.state == 0) { @@ -56990,12 +59333,12 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT(": type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("` does not exist"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(right_expr)); } if (left_sym->kind == v__ast__Kind__aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(c->table, parent_left_type); } if (!(left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT("` can only be used with interfaces and sum types"), 0, { .d_c = 0 }}})), node->pos); - } else if ((left_sym->info)._typ == 478 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 479 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*left_sym->info._v__ast__SumType).variants, typ)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -57157,8 +59500,8 @@ v__ast__Type former_expected_type; } else if (v__ast__Type_alias_eq(left_type, _const_v__ast__string_type) && !(node->op == v__token__Kind__plus || node->op == v__token__Kind__eq || node->op == v__token__Kind__ne || node->op == v__token__Kind__lt || node->op == v__token__Kind__gt || node->op == v__token__Kind__le || node->op == v__token__Kind__ge)) { v__checker__Checker_error(c, _SLIT("string types only have the following operators defined: `==`, `!=`, `<`, `>`, `<=`, `>=`, and `+`"), node->pos); } else if (left_sym->kind == v__ast__Kind__enum_ && right_sym->kind == v__ast__Kind__enum_ && !eq_ne) { - v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ; - v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ; + v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ; + v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ; if (left_enum.is_flag && right_enum.is_flag) { if (!(node->op == v__token__Kind__pipe || node->op == v__token__Kind__amp)) { v__checker__Checker_error(c, _SLIT("only `==`, `!=`, `|` and `&` are defined on `[flag]` tagged `enum`, use an explicit cast to `int` if needed"), node->pos); @@ -57242,7 +59585,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_check_valid_pascal_case(c, node->name, _SLIT("interface name"), node->pos); v__ast__TypeSymbol* decl_sym = v__ast__Table_sym(c->table, node->typ); bool is_js = node->language == v__ast__Language__js; - if ((decl_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((decl_sym->info)._typ == 478 /* v.ast.Interface */) { if (node->embeds.len > 0) { Array_v__ast__InterfaceEmbedding all_embeds = v__checker__Checker_expand_iface_embeds(c, node, 0, node->embeds); node->embeds = all_embeds; @@ -57274,7 +59617,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` tries to embed `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("`, but `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("` is not an interface, but `"), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(isym->kind)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), embed.pos); continue; } - v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; for (int _t2 = 0; _t2 < isym_info.fields.len; ++_t2) { v__ast__StructField f = ((v__ast__StructField*)isym_info.fields.data)[_t2]; if (!(*(bool*)map_get(ADDR(map, efnames_ds_info), &(string[]){f.name}, &(bool[]){ 0 }))) { @@ -57439,7 +59782,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, utyp); v__ast__TypeSymbol* inter_sym = v__ast__Table_sym(c->table, interface_type); - if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 478 /* v.ast.Interface */) { if ((*inter_sym->info._v__ast__Interface).is_generic) { Array_v__ast__Type inferred_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_string _t1 = {0}; @@ -57496,7 +59839,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type _t11 = 0; return _t11; } - if ((imret_sym->info)._typ == 485 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 485 /* v.ast.MultiReturn */) { + if ((imret_sym->info)._typ == 486 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 486 /* v.ast.MultiReturn */) { for (int i = 0; i < (*imret_sym->info._v__ast__MultiReturn).types.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)(*imret_sym->info._v__ast__MultiReturn).types.data)[i]; if (v__ast__Type_has_flag(mr_typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_get_type_name(c->table, mr_typ), gt_name)) { @@ -57741,7 +60084,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__ast__Expr high_expr = (*expr._v__ast__RangeExpr).high; v__ast__TypeSymbol* final_cond_sym = v__ast__Table_final_sym(c->table, node->cond_type); if ((low_expr)._typ == 314 /* v.ast.IntegerLiteral */) { - if ((high_expr)._typ == 314 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 488 /* v.ast.Enum */)) { + if ((high_expr)._typ == 314 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 489 /* v.ast.Enum */)) { low = string_i64((*low_expr._v__ast__IntegerLiteral).val); high = string_i64((*high_expr._v__ast__IntegerLiteral).val); if (low > high) { @@ -57809,7 +60152,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - } else if ((cond_type_sym.info)._typ == 478 /* v.ast.SumType */) { + } else if ((cond_type_sym.info)._typ == 479 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*cond_type_sym.info._v__ast__SumType).variants, expr_type)) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); @@ -57828,7 +60171,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__util__Suggestion suggestion = v__util__new_suggestion(expr_str, sumtype_variant_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), v__ast__Expr_pos(expr)); } - } else if ((cond_type_sym.info)._typ == 474 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 459 /* v.ast.Struct */) { + } else if ((cond_type_sym.info)._typ == 475 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 459 /* v.ast.Struct */) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot match alias type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` with `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); @@ -57894,7 +60237,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } else { - if (cond_type_sym.info._typ == 478 /* v.ast.SumType */) { + if (cond_type_sym.info._typ == 479 /* v.ast.SumType */) { for (int _t8 = 0; _t8 < (*cond_type_sym.info._v__ast__SumType).variants.len; ++_t8) { v__ast__Type v = ((v__ast__Type*)(*cond_type_sym.info._v__ast__SumType).variants.data)[_t8]; string v_str = v__ast__Table_type_to_str(c->table, v); @@ -57904,7 +60247,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - else if (cond_type_sym.info._typ == 488 /* v.ast.Enum */) { + else if (cond_type_sym.info._typ == 489 /* v.ast.Enum */) { for (int _t10 = 0; _t10 < (*cond_type_sym.info._v__ast__Enum).vals.len; ++_t10) { string v = ((string*)(*cond_type_sym.info._v__ast__Enum).vals.data)[_t10]; if (!_IN_MAP(ADDR(string, v), ADDR(map, branch_exprs))) { @@ -58245,6 +60588,9 @@ VV_LOCAL_SYMBOL Array_v__ast__StructField v__checker__Checker_fetch_and_verify_o } void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* node) { + if (isnil(c->table->cur_fn)) { + return; + } c->expected_type = c->table->cur_fn->return_type; v__ast__Type expected_type = v__checker__Checker_unwrap_generic(c, c->expected_type); v__ast__TypeSymbol* expected_type_sym = v__ast__Table_sym(c->table, expected_type); @@ -58263,7 +60609,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod bool exp_is_optional = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional); bool exp_is_result = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__result); Array_v__ast__Type expected_types = new_array_from_c_array(1, 1, sizeof(v__ast__Type), _MOV((v__ast__Type[1]){expected_type})); - if ((expected_type_sym->info)._typ == 485 /* v.ast.MultiReturn */) { + if ((expected_type_sym->info)._typ == 486 /* v.ast.MultiReturn */) { expected_types = (*expected_type_sym->info._v__ast__MultiReturn).types; if (c->table->cur_concrete_types.len > 0) { Array_v__ast__Type _t1 = {0}; @@ -58318,7 +60664,9 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (expected_types.len > 0 && expected_types.len != got_types.len) { string arg = (expected_types.len == 1 ? (_SLIT("argument")) : (_SLIT("arguments"))); - v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = expected_types.len}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(", but got "), /*100 &int*/0xfe07, {.d_i32 = got_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); + int midx = v__checker__imax(0, v__checker__imin(expected_types.len, expr_idxs.len - 1)); + v__token__Pos mismatch_pos = v__ast__Expr_pos((*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, (*(int*)/*ee elem_sym */array_get(expr_idxs, midx))))); + v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = expected_types.len}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(", but got "), /*100 &int*/0xfe07, {.d_i32 = got_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), mismatch_pos); return; } for (int i = 0; i < expected_types.len; ++i) { @@ -58574,6 +60922,16 @@ VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr) { return _t2; } +VV_LOCAL_SYMBOL int v__checker__imin(int a, int b) { + int _t1 = (a < b ? (a) : (b)); + return _t1; +} + +VV_LOCAL_SYMBOL int v__checker__imax(int a, int b) { + int _t1 = (a < b ? (b) : (a)); + return _t1; +} + u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp, v__ast__Type typ) { if (v__ast__Type_has_flag(ftyp, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(ftyp, v__ast__TypeFlag__result)) { u8 _t1 = 's'; @@ -58593,7 +60951,7 @@ u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, ftyp)); if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; sym = v__ast__Table_sym(c->table, info.parent_type); if (v__ast__Type_alias_eq(info.parent_type, _const_v__ast__string_type)) { u8 _t6 = 's'; @@ -58656,7 +61014,7 @@ v__ast__Type v__checker__Checker_string_inter_lit(v__checker__Checker* c, v__ast } array_set(&node->need_fmts, i, &(bool[]) { fmt != v__checker__Checker_get_default_fmt(c, ftyp, typ) }); } - if (c->table->cur_fn->is_method && string__eq(c->table->cur_fn->name, _SLIT("str")) && string__eq(c->table->cur_fn->receiver.name, v__ast__Expr_str(expr))) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->is_method && string__eq(c->table->cur_fn->name, _SLIT("str")) && string__eq(c->table->cur_fn->receiver.name, v__ast__Expr_str(expr))) { v__checker__Checker_error(c, _SLIT("cannot call `str()` method recursively"), v__ast__Expr_pos(expr)); } } @@ -58827,7 +61185,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); if (field_sym->kind == v__ast__Kind__function) { - v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; _option_void _t4 = v__checker__Checker_ensure_type_exists(c, fn_info.func.return_type, fn_info.func.return_type_pos); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { IError err = _t4.err; @@ -58920,18 +61278,18 @@ VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__S v__ast__Table* t = global_table; v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); - if ((a_sym->info)._typ == 488 /* v.ast.Enum */) { + if ((a_sym->info)._typ == 489 /* v.ast.Enum */) { if (!(*a_sym->info._v__ast__Enum).is_flag && !(*a_sym->info._v__ast__Enum).uses_exprs) { if (b_sym->kind == v__ast__Kind__enum_) { int a_nr_vals = ((*a_sym->info._v__ast__Enum)).vals.len; - int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).vals.len; int _t5 = (a_nr_vals > b_nr_vals ? (-1) : a_nr_vals < b_nr_vals ? (1) : (0)); return _t5; } int _t6 = 1; return _t6; } - } else if ((b_sym->info)._typ == 488 /* v.ast.Enum */) { + } else if ((b_sym->info)._typ == 489 /* v.ast.Enum */) { if (!(*b_sym->info._v__ast__Enum).is_flag && !(*b_sym->info._v__ast__Enum).uses_exprs) { int _t7 = -1; return _t7; @@ -58977,7 +61335,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, _SLIT("generic struct init must specify type parameter, e.g. Foo"), node->pos); } else if (node->generic_types.len > 0 && node->generic_types.len != (*struct_sym->info._v__ast__Struct).generic_types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("generic struct init expects "), /*100 &int*/0xfe07, {.d_i32 = (*struct_sym->info._v__ast__Struct).generic_types.len}}, {_SLIT(" generic parameter, but got "), /*100 &int*/0xfe07, {.d_i32 = node->generic_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); - } else if (node->generic_types.len > 0) { + } else if (node->generic_types.len > 0 && !isnil(c->table->cur_fn)) { for (int _t3 = 0; _t3 < node->generic_types.len; ++_t3) { v__ast__Type gtyp = ((v__ast__Type*)node->generic_types.data)[_t3]; string gtyp_name = v__ast__Table_sym(c->table, gtyp)->name; @@ -58992,7 +61350,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->generic_types.len > 0 && (*struct_sym->info._v__ast__Struct).generic_types.len == node->generic_types.len && !Array_v__ast__Type_arr_eq((*struct_sym->info._v__ast__Struct).generic_types, node->generic_types)) { v__ast__Table_replace_generic_type(c->table, node->typ, node->generic_types); } - } else if ((struct_sym->info)._typ == 474 /* v.ast.Alias */) { + } else if ((struct_sym->info)._typ == 475 /* v.ast.Alias */) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*struct_sym->info._v__ast__Alias).parent_type); if (parent_sym->kind == v__ast__Kind__map) { string alias_str = v__ast__Table_type_to_str(c->table, node->typ); @@ -59002,7 +61360,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t4; } } - if (c->table->cur_fn->generic_names.len > 0) { + if (!isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len > 0) { v__ast__Table_unwrap_generic_type(c->table, node->typ, c->table->cur_fn->generic_names, c->table->cur_concrete_types); } _option_void _t5 = v__checker__Checker_ensure_type_exists(c, node->typ, node->pos); @@ -59035,7 +61393,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (type_sym->kind == v__ast__Kind__interface_ && type_sym->language != v__ast__Language__js) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate interface `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - if ((type_sym->info)._typ == 474 /* v.ast.Alias */) { + if ((type_sym->info)._typ == 475 /* v.ast.Alias */) { if (v__ast__Type_is_number((*type_sym->info._v__ast__Alias).parent_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate number type alias `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t7 = _const_v__ast__void_type; @@ -59051,7 +61409,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is declared with a `[noinit]` attribute, so "), 0, { .d_c = 0 }}})), str_intp(2, _MOV((StrIntpData[]){{_SLIT("it cannot be initialized with `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("{}`"), 0, { .d_c = 0 }}}))), node->pos); } } - if (type_sym->name.len == 1 && c->table->cur_fn->generic_names.len == 0) { + if (type_sym->name.len == 1 && !isnil(c->table->cur_fn) && c->table->cur_fn->generic_names.len == 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t8 = 0; return _t8; @@ -59065,7 +61423,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { - v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); if (sym->kind == v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct: "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); @@ -59096,7 +61454,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); for (int i = 0; i < node->fields.len; ++i) { v__ast__StructInitField* field = ((v__ast__StructInitField*)node->fields.data) + i; - v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); string field_name = _SLIT(""); if (node->is_short) { if (i >= info.fields.len) { @@ -59112,7 +61470,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (_t11.state != 0) { /*or block*/ IError err = _t11.err; exists = false; - *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); } field_info = (*(v__ast__StructField*)_t11.data); @@ -60816,10 +63174,10 @@ bool v__markused__mark_used_defer_0 = false; if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 477 /* v.ast.Interface */) { + if ((isym->info)._typ != 478 /* v.ast.Interface */) { continue; } - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (interface_info.methods.len == 0) { continue; } @@ -60918,7 +63276,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -61018,7 +63376,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 220 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } else if (node._typ == 345 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -61101,7 +63459,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ for (int _t1 = 0; _t1 < all_fn_root_names.len; ++_t1) { string fn_name = ((string*)all_fn_root_names.data)[_t1]; if (!_IN_MAP(ADDR(string, fn_name), ADDR(map, w->used_fns))) { - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } } } @@ -61772,7 +64130,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_write(g, _SLIT("0")); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; for (int _t1 = 1; _t1 < info.size; ++_t1) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_write(g, _SLIT("0")); @@ -61830,7 +64188,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_expr(g, node.default_expr); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; for (int _t2 = 1; _t2 < info.size; ++_t2) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_expr(g, node.default_expr); @@ -62388,7 +64746,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); } } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; int size = left_info.size; v__ast__Type elem_type = left_info.elem_type; string elem_type_str = v__gen__c__Gen_typ(g, elem_type); @@ -63260,7 +65618,7 @@ string sref_name; if (is_inside_ternary && is_decl) { strings__Builder_write_string(&g->out, v__util__tabs(g->indent - g->inside_ternary)); } - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); string call_conv = _SLIT(""); string msvc_call_conv = _SLIT(""); @@ -63509,12 +65867,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (left._typ == 309 /* v.ast.Ident */) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); + string anon_ctx = (g->anon_fn ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT("->"), 0, { .d_c = 0 }}}))) : (_SLIT(""))); if (left_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = anon_ctx}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { string styp = v__gen__c__Gen_typ(g, left_typ); - v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = anon_ctx}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else if (left._typ == 312 /* v.ast.IndexExpr */) { @@ -63525,7 +65884,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (elem_typ->kind == v__ast__Kind__function) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)array_get(")); } else { string styp = v__gen__c__Gen_typ(g, info.elem_type); @@ -63554,7 +65913,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (val_typ->kind == v__ast__Kind__function) { v__ast__Type left_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_type); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)map_get(")); } else { v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)map_get("), 0, { .d_c = 0 }}}))); @@ -63651,6 +66010,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__InfixExpr).right); } } + else if (val._typ == 324 /* v.ast.ParExpr */) { + v__gen__c__Gen_write(g, _SLIT("(")); + v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__ParExpr).expr); + v__gen__c__Gen_write(g, _SLIT(")")); + } + else if (val._typ == 295 /* v.ast.CallExpr */) { + string fn_name = string_replace((*val._v__ast__CallExpr).name, _SLIT("."), _SLIT("__")); + v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); + for (int i = 0; i < (*val._v__ast__CallExpr).args.len; ++i) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*val._v__ast__CallExpr).args.data)[i]; + v__gen__c__Gen_gen_cross_tmp_variable(g, left, arg.expr); + if (i != (*val._v__ast__CallExpr).args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + v__gen__c__Gen_write(g, _SLIT(")")); + } else if (val._typ == 326 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PrefixExpr).op)); v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PrefixExpr).right); @@ -63866,7 +66242,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_alias_equality_fn(v__gen__c__Gen* g, v return _t1; } array_push((array*)&g->generated_eq_fns, _MOV((v__ast__Type[]){ left_type })); - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b); // auto"), 0, { .d_c = 0 }}}))); strings__Builder fn_builder = strings__new_builder(512); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); @@ -64032,7 +66408,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_map_equality_fn(v__gen__c__Gen* g, v__ strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (!map_exists(&b, k)) return false;")); v__ast__Kind kind = v__ast__Table_type_kind(g->table, value.typ); if (kind == v__ast__Kind__function) { - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); strings__Builder_write_string(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*v) ("), 0, { .d_c = 0 }}}))); int arg_len = func.func.params.len; @@ -64167,7 +66543,7 @@ strings__Builder fn_builder; strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("_interface_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, _SLIT("\tif (a._typ == b._typ) {")); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tint idx = v_typeof_interface_idx_"), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("(a._typ);"), 0, { .d_c = 0 }}}))); - if ((info)._typ == 477 /* v.ast.Interface */) { + if ((info)._typ == 478 /* v.ast.Interface */) { for (int _t3 = 0; _t3 < (*info._v__ast__Interface).types.len; ++_t3) { v__ast__Type typ = ((v__ast__Type*)(*info._v__ast__Interface).types.data)[_t3]; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif (idx == "), /*100 &int*/0xfe07, {.d_i32 = v__ast__Type_idx(typ)}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); @@ -64223,7 +66599,7 @@ strings__Builder fn_builder; VV_LOCAL_SYMBOL string v__gen__c__Gen_get_free_method(v__gen__c__Gen* g, v__ast__Type typ) { map_set(&g->autofree_methods, &(int[]){typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 474 /* v.ast.Alias */) { + if ((sym->info)._typ == 475 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -64264,7 +66640,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ } map_set(&g->generated_free_methods, &(int[]){deref_typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 474 /* v.ast.Alias */) { + if ((sym->info)._typ == 475 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -64419,7 +66795,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, unwrapped); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped); string str_fn_name = v__gen__c__styp_to_str_fn_name(styp); - if ((sym->info)._typ == 474 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 475 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); str_fn_name = v__gen__c__styp_to_str_fn_name(sym->name); @@ -64452,7 +66828,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ v__gen__c__Gen_gen_str_for_result(g, typ.typ, styp, str_fn_name); return; } - if (sym->info._typ == 474 /* v.ast.Alias */) { + if (sym->info._typ == 475 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { v__gen__c__Gen_gen_str_default(g, *sym, styp, str_fn_name); } else { @@ -64462,13 +66838,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ else if (sym->info._typ == 454 /* v.ast.Array */) { v__gen__c__Gen_gen_str_for_array(g, (*sym->info._v__ast__Array), styp, str_fn_name); } - else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 483 /* v.ast.ArrayFixed */) { v__gen__c__Gen_gen_str_for_array_fixed(g, (*sym->info._v__ast__ArrayFixed), styp, str_fn_name); } - else if (sym->info._typ == 488 /* v.ast.Enum */) { + else if (sym->info._typ == 489 /* v.ast.Enum */) { v__gen__c__Gen_gen_str_for_enum(g, (*sym->info._v__ast__Enum), styp, str_fn_name); } - else if (sym->info._typ == 486 /* v.ast.FnType */) { + else if (sym->info._typ == 487 /* v.ast.FnType */) { v__gen__c__Gen_gen_str_for_fn_type(g, (*sym->info._v__ast__FnType), styp, str_fn_name); } else if (sym->info._typ == 459 /* v.ast.Struct */) { @@ -64477,19 +66853,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ else if (sym->info._typ == 455 /* v.ast.Map */) { v__gen__c__Gen_gen_str_for_map(g, (*sym->info._v__ast__Map), styp, str_fn_name); } - else if (sym->info._typ == 485 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 486 /* v.ast.MultiReturn */) { v__gen__c__Gen_gen_str_for_multi_return(g, (*sym->info._v__ast__MultiReturn), styp, str_fn_name); } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { v__gen__c__Gen_gen_str_for_union_sum_type(g, (*sym->info._v__ast__SumType), styp, str_fn_name); } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { v__gen__c__Gen_gen_str_for_interface(g, (*sym->info._v__ast__Interface), styp, str_fn_name); } - else if (sym->info._typ == 483 /* v.ast.Chan */) { + else if (sym->info._typ == 484 /* v.ast.Chan */) { v__gen__c__Gen_gen_str_for_chan(g, (*sym->info._v__ast__Chan), styp, str_fn_name); } - else if (sym->info._typ == 484 /* v.ast.Thread */) { + else if (sym->info._typ == 485 /* v.ast.Thread */) { v__gen__c__Gen_gen_str_for_thread(g, (*sym->info._v__ast__Thread), styp, str_fn_name); } @@ -64835,7 +67211,7 @@ VV_LOCAL_SYMBOL multi_return_string_string v__gen__c__deref_kind(bool str_method VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string str_fn_name) { v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 474 /* v.ast.Alias */) { + if ((sym->info)._typ == 475 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } @@ -64910,7 +67286,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v__ast__ArrayFixed info, string styp, string str_fn_name) { v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 474 /* v.ast.Alias */) { + if ((sym->info)._typ == 475 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } @@ -64973,7 +67349,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string str_fn_name) { v__ast__Type key_typ = info.key_type; v__ast__TypeSymbol* key_sym = v__ast__Table_sym(g->table, key_typ); - if ((key_sym->info)._typ == 474 /* v.ast.Alias */) { + if ((key_sym->info)._typ == 475 /* v.ast.Alias */) { key_typ = (*key_sym->info._v__ast__Alias).parent_type; key_sym = v__ast__Table_sym(g->table, key_typ); } @@ -64984,7 +67360,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M } v__ast__Type val_typ = info.value_type; v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_typ); - if ((val_sym->info)._typ == 474 /* v.ast.Alias */) { + if ((val_sym->info)._typ == 475 /* v.ast.Alias */) { val_typ = (*val_sym->info._v__ast__Alias).parent_type; val_sym = v__ast__Table_sym(g->table, val_typ); } @@ -65530,7 +67906,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -65557,6 +67933,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .autofree_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .generated_free_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .autofree_scope_stmts = __new_array(0, 0, sizeof(string)), + .use_segfault_handler = !(Array_string_contains(pref->compile_defines, _SLIT("no_segfault_handler")) || pref->os == v__pref__OS__wasm32), }); if (pref->is_test) { v__gen__c__Gen_write_tests_definitions(&global_g); @@ -65571,6 +67948,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_init(&global_g); v__util__Timers_show(global_g.timers, _SLIT("cgen init")); global_g.tests_inited = false; + global_g.file = (*(v__ast__File**)array_last(files)); if (!pref->no_parallel) { sync__pool__PoolProcessor* pp = sync__pool__new_pool_processor(((sync__pool__PoolProcessorConfig){.maxjobs = 0,.callback = (voidptr)v__gen__c__cgen_process_one_file_cb,})); sync__pool__PoolProcessor_set_shared_context(pp, (voidptr)&/*qq*/global_g); @@ -65992,6 +68370,9 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_finish(&g); strings__Builder b = strings__new_builder(640000); strings__Builder_write_string(&b, v__gen__c__Gen_hashes(&g)); + if (g.use_segfault_handler) { + strings__Builder_writeln(&b, _SLIT("\n#define V_USE_SIGNAL_H")); + } strings__Builder_writeln(&b, _SLIT("\n// V comptime_definitions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.comptime_definitions)); strings__Builder_writeln(&b, _SLIT("\n// V typedefs:")); @@ -66216,7 +68597,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -66243,6 +68624,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .autofree_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .generated_free_methods = new_map(sizeof(int), sizeof(bool), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop), .autofree_scope_stmts = __new_array(0, 0, sizeof(string)), + .use_segfault_handler = global_g->use_segfault_handler, }, sizeof(v__gen__c__Gen))); v__gen__c__Gen_gen_file(g); v__gen__c__Gen* _t1 = g; @@ -66478,7 +68860,9 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { } } v__ast__Table* muttable = ((v__ast__Table*)(g->table)); - map_set(&muttable->used_fns, &(string[]){_SLIT("v_segmentation_fault_handler")}, &(bool[]) { true }); + if (g->use_segfault_handler) { + map_set(&muttable->used_fns, &(string[]){_SLIT("v_segmentation_fault_handler")}, &(bool[]) { true }); + } map_set(&muttable->used_fns, &(string[]){_SLIT("eprintln")}, &(bool[]) { true }); map_set(&muttable->used_fns, &(string[]){_SLIT("print_backtrace")}, &(bool[]) { true }); map_set(&muttable->used_fns, &(string[]){_SLIT("exit")}, &(bool[]) { true }); @@ -66498,12 +68882,7 @@ void v__gen__c__Gen_finish(v__gen__c__Gen* g) { if (g->pref->is_livemain || g->pref->is_liveshared) { v__gen__c__Gen_generate_hotcode_reloader_code(g); } - if (g->embedded_files.len > 0) { - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { - v__gen__c__Gen_gen_embedded_data(g); - } - v__gen__c__Gen_gen_embedded_metadata(g); - } + v__gen__c__Gen_handle_embedded_files_finish(g); if (g->pref->is_test) { v__gen__c__Gen_gen_c_main_for_tests(g); } else { @@ -66517,7 +68896,7 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { for (int ityp = 0; ityp < g->table->type_symbols.len; ++ityp) { v__ast__TypeSymbol* sym = ((v__ast__TypeSymbol**)g->table->type_symbols.data)[ityp]; if (sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; if (sum_info.is_generic) { continue; } @@ -66566,10 +68945,10 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("}")); } else if (sym->kind == v__ast__Kind__interface_) { - if ((sym->info)._typ != 477 /* v.ast.Interface */) { + if ((sym->info)._typ != 478 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -66715,18 +69094,18 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_result_type_text(v__gen__c__Gen* g, string } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_optional(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_37846 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_37846.arg0; - string base = mr_37846.arg1; + multi_return_string_string mr_38074 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_38074.arg0; + string base = mr_38074.arg1; map_set(&g->optionals, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_result(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_37979 = v__gen__c__Gen_result_type_name(g, t); - string styp = mr_37979.arg0; - string base = mr_37979.arg1; + multi_return_string_string mr_38207 = v__gen__c__Gen_result_type_name(g, t); + string styp = mr_38207.arg0; + string base = mr_38207.arg1; map_set(&g->results, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -66948,7 +69327,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string sgtyps = _SLIT("_T"); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Interface).generic_types.len; ++_t2) { @@ -66959,7 +69338,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string sgtyps = _SLIT("_T"); for (int _t3 = 0; _t3 < (*sym->info._v__ast__SumType).generic_types.len; ++_t3) { @@ -67013,13 +69392,13 @@ void v__gen__c__Gen_write_typedef_types(v__gen__c__Gen* g) { } } else if (sym->kind == (v__ast__Kind__array_fixed)) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (v__ast__TypeSymbol_is_builtin(elem_sym)) { string styp = sym->cname; string len = string_after(styp, _SLIT("_")); string fixed = v__gen__c__Gen_typ(g, info.elem_type); - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed = strings__Builder_cut_to(&g->out, pos); @@ -67092,10 +69471,10 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast parent_styp = string_substr(parent->cname, 3, (parent->cname).len); } } else { - if ((sym.info)._typ == 474 /* v.ast.Alias */) { + if ((sym.info)._typ == 475 /* v.ast.Alias */) { parent_styp = v__gen__c__Gen_typ(g, (*sym.info._v__ast__Alias).parent_type); v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym.info._v__ast__Alias).parent_type); - if ((parent_sym->info)._typ == 482 /* v.ast.ArrayFixed */) { + if ((parent_sym->info)._typ == 483 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*parent_sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym)) { is_fixed_array_of_non_builtin = true; @@ -67119,10 +69498,10 @@ void v__gen__c__Gen_write_interface_typedef(v__gen__c__Gen* g, v__ast__TypeSymbo } void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - if ((sym.info)._typ != 477 /* v.ast.Interface */) { + if ((sym.info)._typ != 478 /* v.ast.Interface */) { return; } - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (info.is_generic) { return; } @@ -67151,7 +69530,7 @@ void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v_ } void v__gen__c__Gen_write_fn_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; v__ast__Fn func = info.func; bool is_fn_sig = (func.name).len == 0; bool not_anon = !info.is_anon; @@ -67645,7 +70024,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } else if (node._typ == 358 /* v.ast.InterfaceDecl */) { v__ast__TypeSymbol* ts = v__ast__Table_sym(g->table, (*node._v__ast__InterfaceDecl).typ); - if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).is_generic) { + if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ).is_generic) { for (int _t4 = 0; _t4 < (*node._v__ast__InterfaceDecl).methods.len; ++_t4) { v__ast__FnDecl method = ((v__ast__FnDecl*)(*node._v__ast__InterfaceDecl).methods.data)[_t4]; if (v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__optional)) { @@ -67763,18 +70142,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, strings__Builder_writeln(&sb, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT("_ptr = memdup("), /*115 &string*/0xfe10, {.d_s = accessor}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } strings__Builder_write_string(&sb, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = exp_cname}}, {_SLIT("){ ._"), /*115 &string*/0xfe10, {.d_s = got_cname}}, {_SLIT(" = ptr, ._typ = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_sidx(g, got)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).fields.len; ++_t3) { - v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).fields.data)[_t3]; + for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ).fields.len; ++_t3) { + v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ).fields.data)[_t3]; string ptr = _SLIT("ptr"); string type_cname = got_cname; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_66722 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66722.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_66950 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_66950.arg1; if (embed_types.len > 0) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); ptr = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT("_ptr"), 0, { .d_c = 0 }}})); @@ -67827,7 +70206,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_expr(g, expr); return; } - if ((exp_sym->info)._typ == 477 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { + if ((exp_sym->info)._typ == 478 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { if ((expr)._typ == 334 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { g->inside_cast_in_heap++; string got_styp = v__gen__c__Gen_cc_type(g, v__ast__Type_ref(got_type), true); @@ -67886,7 +70265,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex g->prevent_sum_type_unwrapping_once = true; v__gen__c__Gen_expr(g, expr); } else { - if ((unwrapped_got_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((unwrapped_got_sym->info)._typ == 473 /* v.ast.Aggregate */) { unwrapped_got_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*unwrapped_got_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); unwrapped_got_sym = v__ast__Table_sym(g->table, unwrapped_got_type); } @@ -68391,6 +70770,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_scope_vars2(v__gen__c__Gen* g, v__a } VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_variable(v__gen__c__Gen* g, v__ast__Var v) { + if (v.typ == 0) { + return; + } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v.typ); if (g->is_autofree) { } @@ -68616,7 +70998,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("*)__dup"), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("(&("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("){.mtx = {0}, .val ="), 0, { .d_c = 0 }}}))); } } - int last_stmt_pos = (*(int*)array_last(g->stmt_path_pos)); + int _t1; /* if prepend */ + if (g->stmt_path_pos.len > 0) { + _t1 = (*(int*)array_last(g->stmt_path_pos)); + } else { + _t1 = 0; + } + int last_stmt_pos = _t1; v__gen__c__Gen_call_expr(g, (*node._v__ast__CallExpr)); if (g->is_autofree && !g->is_builtin_mod && !g->is_js_call && g->strs_to_free0.len == 0 && !g->inside_lambda) { v__gen__c__Gen_autofree_call_pregen(g, (*node._v__ast__CallExpr)); @@ -68783,18 +71171,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) if ((*node._v__ast__PrefixExpr).op == v__token__Kind__arrow) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__PrefixExpr).right_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, (*node._v__ast__PrefixExpr).right_type); - v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ; + v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.Chan */ ; v__ast__Type elem_type = right_inf.elem_type; bool is_gen_or_and_assign_rhs = gen_or && !g->discard_or_result; - string _t1; /* if prepend */ + string _t2; /* if prepend */ if (is_gen_or_and_assign_rhs) { string line = v__gen__c__Gen_go_before_stmt(g, 0); strings__Builder_write_string(&g->out, v__util__tabs(g->indent)); - _t1 = line; + _t2 = line; } else { - _t1 = _SLIT(""); + _t2 = _SLIT(""); } - string cur_line = _t1; + string cur_line = _t2; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { string opt_elem_type = v__gen__c__Gen_typ(g, v__ast__Type_set_flag(elem_type, v__ast__TypeFlag__optional)); @@ -68895,9 +71283,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_type_name(v__gen__c__Gen* g, v__ast__Type ra string s = _SLIT(""); if (sym->kind == v__ast__Kind__function) { if (v__ast__Type_is_ptr(typ)) { - s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ )); + s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ )); } else { - s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ); + s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ); } } else { s = v__ast__Table_type_to_str(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); @@ -68913,11 +71301,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_typeof_expr(v__gen__c__Gen* g, v__ast__TypeO v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")._typ ))")); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; string typ_name = v__ast__Table_get_type_name(g->table, fixed_info.elem_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_SLIT(\"["), /*100 &int*/0xfe07, {.d_i32 = fixed_info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = v__util__strip_main_name(typ_name)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_SLIT(\""), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_fn_decl_str(g, info)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* varg_elem_type_sym = v__ast__Table_sym(g->table, v__ast__Table_value_type(g->table, typ)); @@ -68995,7 +71383,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_error(g, _SLIT("field_name should be `len`"), node.pos); VUNREACHABLE(); } - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { @@ -69031,7 +71419,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel string dot = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("->")) : (_SLIT("."))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")"), /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = agg_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -69044,7 +71432,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel } else if (_t4 = v__ast__Table_find_method(g->table, sym, node.field_name), _t4.state == 0) { v__ast__Fn m = *(v__ast__Fn*)_t4.data; bool has_embeds = false; - if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 473 /* v.ast.Aggregate */) { if (node.from_embed_types.len > 0) { has_embeds = true; } @@ -69068,7 +71456,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel strings__Builder_write_string(&sb, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, param.typ)}}, {_SLIT(" a"), /*100 &int literal*/0xfe07, {.d_i32 = i}}, {_SLIT0, 0, { .d_c = 0 }}}))); } strings__Builder_writeln(&sb, _SLIT(") {")); - strings__Builder_writeln(&sb, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("* a0 = *("), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("**)(__RETURN_ADDRESS() - __CLOSURE_DATA_OFFSET);"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = data_styp}}, {_SLIT("* a0 = __CLOSURE_GET_DATA();"), 0, { .d_c = 0 }}}))); if (!v__ast__Type_alias_eq(m.return_type, _const_v__ast__void_type)) { strings__Builder_write_string(&sb, _SLIT("\treturn ")); } else { @@ -69115,7 +71503,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel if (is_optional) { v__gen__c__Gen_write(g, _SLIT(".data)")); } - if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 473 /* v.ast.Aggregate */) { for (int i = 0; i < node.from_embed_types.len; ++i) { v__ast__Type embed = ((v__ast__Type*)node.from_embed_types.data)[i]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); @@ -69305,11 +71693,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit string value_typ_str = v__gen__c__Gen_typ(g, unwrap_val_typ); v__ast__TypeSymbol* value_sym = v__ast__Table_sym(g->table, unwrap_val_typ); v__ast__TypeSymbol* key_sym = v__ast__Table_final_sym(g->table, unwrap_key_typ); - multi_return_string_string_string_string mr_108350 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108350.arg0; - string key_eq_fn = mr_108350.arg1; - string clone_fn = mr_108350.arg2; - string free_fn = mr_108350.arg3; + multi_return_string_string_string_string mr_108643 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_108643.arg0; + string key_eq_fn = mr_108643.arg1; + string clone_fn = mr_108643.arg2; + string free_fn = mr_108643.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -69591,7 +71979,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } } string dot = (is_ptr || is_auto_heap ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -69670,7 +72058,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp if ((g->pref->translated || g->file->is_translated) && sym->kind == v__ast__Kind__function) { } string cast_label = _SLIT(""); - if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { + if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { cast_label = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(")"), 0, { .d_c = 0 }}})); } if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 321 /* v.ast.None */) { @@ -69879,7 +72267,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, g->fn_decl->return_type); - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; string styp = _SLIT(""); if (fn_return_is_optional || fn_return_is_result) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -70308,6 +72696,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, str VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__GlobalDecl node) { string visibility_kw = ((g->pref->use_cache || (g->pref->build_mode == v__pref__BuildMode__build_module && !string__eq(g->module_built, node.mod))) && !v__util__should_bundle_module(node.mod) ? (_SLIT("extern ")) : (_SLIT(""))); bool cinit = Array_v__ast__Attr_contains(node.attrs, _SLIT("cinit")); + bool cextern = Array_v__ast__Attr_contains(node.attrs, _SLIT("c_extern")); bool should_init = (!g->pref->use_cache && g->pref->build_mode != v__pref__BuildMode__build_module) || (g->pref->build_mode == v__pref__BuildMode__build_module && string__eq(g->module_built, node.mod)); string attributes = _SLIT(""); if (Array_v__ast__Attr_contains(node.attrs, _SLIT("weak"))) { @@ -70328,8 +72717,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_type_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_sym(g->table, field.typ)->name}}, {_SLIT("; // global2"), 0, { .d_c = 0 }}}))); continue; } + string _v_extern = (cextern ? (_SLIT("extern ")) : (_SLIT(""))); string modifier = (field.is_volatile ? (_SLIT(" volatile ")) : (_SLIT(""))); - strings__Builder_write_string(&g->definitions, str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = visibility_kw}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = modifier}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = attributes}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + strings__Builder_write_string(&g->definitions, str_intp(7, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _v_extern}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = visibility_kw}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = modifier}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = attributes}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + if (cextern) { + strings__Builder_writeln(&g->definitions, _SLIT("; // global5")); + continue; + } if (field.has_expr || cinit) { if (g->pref->translated) { strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -70422,7 +72816,7 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; } int fn_vinit_start_pos = g->out.len; v__gen__c__Gen_writeln(g, _SLIT("void _vinit(int ___argc, voidptr ___argv) {")); - if (!Array_string_contains(g->pref->compile_defines, _SLIT("no_segfault_handler")) || g->pref->os == v__pref__OS__wasm32) { + if (g->use_segfault_handler) { v__gen__c__Gen_writeln(g, _SLIT("#if __STDC_HOSTED__ == 1\n\tsignal(11, v_segmentation_fault_handler);\n#endif")); } if (g->pref->is_bare) { @@ -70576,9 +72970,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ for (int _t3 = 0; _t3 < (*sym->info._v__ast__Struct).fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data)[_t3]; if (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__optional)) { - multi_return_string_string mr_148577 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_148577.arg0; - string base = mr_148577.arg1; + multi_return_string_string mr_148992 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_148992.arg0; + string base = mr_148992.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -70601,7 +72995,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ size_suffix = _SLIT(" : 1"); } else { v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); - if ((field_sym->info)._typ == 488 /* v.ast.Enum */) { + if ((field_sym->info)._typ == 489 /* v.ast.Enum */) { if (!(*field_sym->info._v__ast__Enum).is_flag && !(*field_sym->info._v__ast__Enum).uses_exprs) { int bits_needed = 0; int l = (*field_sym->info._v__ast__Enum).vals.len; @@ -70624,9 +73018,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}"), /*115 &string*/0xfe10, {.d_s = ti_attrs}}, {_SLIT(";\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->type_definitions, post_pragma); } - else if (sym->info._typ == 474 /* v.ast.Alias */) { + else if (sym->info._typ == 475 /* v.ast.Alias */) { } - else if (sym->info._typ == 484 /* v.ast.Thread */) { + else if (sym->info._typ == 485 /* v.ast.Thread */) { if (g->pref->os == v__pref__OS__windows) { if (string__eq(name, _SLIT("__v_thread"))) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef HANDLE "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -70642,7 +73036,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { continue; } @@ -70672,7 +73066,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, _SLIT("};")); strings__Builder_writeln(&g->type_definitions, _SLIT("")); } - else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 483 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym) && !v__ast__Type_has_flag((*sym->info._v__ast__ArrayFixed).elem_type, v__ast__TypeFlag__generic)) { string styp = sym->cname; @@ -70684,7 +73078,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ if (string_starts_with(fixed_elem_name, _SLIT("C__"))) { fixed_elem_name = string_substr(fixed_elem_name, 3, (fixed_elem_name).len); } - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed_elem_name = strings__Builder_cut_to(&g->out, pos); @@ -70720,8 +73114,8 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } Array_string field_deps = __new_array_with_default(0, 0, sizeof(string), 0); - if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { - string dep = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; + if (sym->info._typ == 483 /* v.ast.ArrayFixed */) { + string dep = v__ast__Table_final_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; if (Array_string_contains(type_names, dep)) { array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); } @@ -70746,7 +73140,7 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); - if ((fsym->info)._typ == 474 /* v.ast.Alias */) { + if ((fsym->info)._typ == 475 /* v.ast.Alias */) { string xdep = v__ast__Table_sym(g->table, (*fsym->info._v__ast__Alias).parent_type)->name; if (!Array_string_contains(type_names, xdep) || Array_string_contains(field_deps, xdep)) { continue; @@ -70873,11 +73267,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_158435 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158435.arg0; - string pafile = mr_158435.arg1; - string pamod = mr_158435.arg2; - string pafn = mr_158435.arg3; + multi_return_int_string_string_string mr_158856 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_158856.arg0; + string pafile = mr_158856.arg1; + string pamod = mr_158856.arg2; + string pafn = mr_158856.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_result_not_set("), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); @@ -70900,11 +73294,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_159705 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_159705.arg0; - string pafile = mr_159705.arg1; - string pamod = mr_159705.arg2; - string pafn = mr_159705.arg3; + multi_return_int_string_string_string mr_160126 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_160126.arg0; + string pafile = mr_160126.arg1; + string pamod = mr_160126.arg2; + string pafn = mr_160126.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_optional_not_set( "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); @@ -70977,7 +73371,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } case v__ast__Kind__alias: { - string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); return _t6; break; } @@ -71014,11 +73408,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { v__ast__Map info = v__ast__TypeSymbol_map_info(sym); v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type); - multi_return_string_string_string_string mr_162313 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162313.arg0; - string key_eq_fn = mr_162313.arg1; - string clone_fn = mr_162313.arg2; - string free_fn = mr_162313.arg3; + multi_return_string_string_string_string mr_162734 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_162734.arg0; + string key_eq_fn = mr_162734.arg1; + string clone_fn = mr_162734.arg2; + string free_fn = mr_162734.arg3; string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type); string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type); string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT(""))); @@ -71209,7 +73603,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no string styp = v__gen__c__Gen_typ(g, unwrapped_node_typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped_node_typ); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - if ((expr_type_sym->info)._typ == 478 /* v.ast.SumType */) { + if ((expr_type_sym->info)._typ == 479 /* v.ast.SumType */) { string dot = (v__ast__Type_is_ptr(node.expr_type) ? (_SLIT("->")) : (_SLIT("."))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* as */ *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)__as_cast("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT("(")); @@ -71239,7 +73633,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no } v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (!_IN_MAP(ADDR(int, node.typ), ADDR(map, info.conversions))) { Array_v__ast__Type left_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){expr_type_sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); Array_v__ast__Type right_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); @@ -71310,10 +73704,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 477 /* v.ast.Interface */) { + if ((isym->info)._typ != 478 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -71376,19 +73770,22 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { _option_v__ast__StructField _t4; if (_t4 = v__ast__TypeSymbol_find_field(st_sym, field.name), _t4.state == 0) { strings__Builder_writeln(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")),"), 0, { .d_c = 0 }}}))); + } else if (st_sym->kind == v__ast__Kind__array && (string__eq(field.name, _SLIT("element_size")) || string__eq(field.name, _SLIT("data")) || string__eq(field.name, _SLIT("offset")) || string__eq(field.name, _SLIT("len")) || string__eq(field.name, _SLIT("cap")) || string__eq(field.name, _SLIT("flags")))) { + strings__Builder_writeln(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")),"), 0, { .d_c = 0 }}}))); } else { - IError err = _t4.err; strings__Builder_write_string(&cast_struct, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t."), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("*)((char*)x"), 0, { .d_c = 0 }}}))); if (v__ast__Type_alias_eq(st, _const_v__ast__voidptr_type)) { strings__Builder_write_string(&cast_struct, _SLIT("/*.... ast.voidptr_type */")); } else { - for (int _t5 = 0; _t5 < v__ast__TypeSymbol_struct_info(st_sym).embeds.len; ++_t5) { - v__ast__Type embed_type = ((v__ast__Type*)v__ast__TypeSymbol_struct_info(st_sym).embeds.data)[_t5]; - v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed_type); - _option_v__ast__StructField _t6; - if (_t6 = v__ast__TypeSymbol_find_field(embed_sym, field.name), _t6.state == 0) { - strings__Builder_write_string(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT(" + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT(") + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); - break; + if (st_sym->kind == v__ast__Kind__struct_) { + for (int _t5 = 0; _t5 < v__ast__TypeSymbol_struct_info(st_sym).embeds.len; ++_t5) { + v__ast__Type embed_type = ((v__ast__Type*)v__ast__TypeSymbol_struct_info(st_sym).embeds.data)[_t5]; + v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed_type); + _option_v__ast__StructField _t6; + if (_t6 = v__ast__TypeSymbol_find_field(embed_sym, field.name), _t6.state == 0) { + strings__Builder_write_string(&cast_struct, str_intp(5, _MOV((StrIntpData[]){{_SLIT(" + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT(") + __offsetof_ptr(x, "), /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); + break; + } } } } @@ -71461,7 +73858,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 477 /* v.ast.Interface */) { + else if (st_sym->info._typ == 478 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Interface).parent_type); for (int _t15 = 0; _t15 < parent_sym->methods.len; ++_t15) { @@ -71478,7 +73875,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 478 /* v.ast.SumType */) { + else if (st_sym->info._typ == 479 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__SumType).parent_type); for (int _t18 = 0; _t18 < parent_sym->methods.len; ++_t18) { @@ -71524,10 +73921,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (parent_sym->info._typ == 459 /* v.ast.Struct */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Struct).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 478 /* v.ast.Interface */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Interface).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 479 /* v.ast.SumType */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__SumType).concrete_types, method.name, false); } @@ -71552,8 +73949,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,.typ = v__ast__Type_set_nr_muls(st, 1),(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,}) }); - multi_return_Array_string_Array_string_Array_bool mr_176920 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_176920.arg0; + multi_return_Array_string_Array_string_Array_bool mr_177692 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_177692.arg0; string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos); if (v__ast__Type_is_ptr(st)) { parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__")); @@ -71570,8 +73967,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_177384 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_177384.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_178156 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_178156.arg1; if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -71756,7 +74153,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; bool _t5 = v__gen__c__Gen_contains_ptr(g, info.elem_type); return _t5; break; @@ -71784,7 +74181,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__aggregate: { - v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; + v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ; for (int _t11 = 0; _t11 < info.types.len; ++_t11) { v__ast__Type atyp = ((v__ast__Type*)info.types.data)[_t11]; if (v__gen__c__Gen_contains_ptr(g, atyp)) { @@ -71798,7 +74195,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__multi_return: { - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; for (int _t14 = 0; _t14 < info.types.len; ++_t14) { v__ast__Type mrtyp = ((v__ast__Type*)info.types.data)[_t14]; if (v__gen__c__Gen_contains_ptr(g, mrtyp)) { @@ -71858,7 +74255,7 @@ VV_LOCAL_SYMBOL string v__gen__c__c_closure_helpers(v__pref__Preferences* pref) if (pref->os != v__pref__OS__windows) { strings__Builder_writeln(&builder, _SLIT("#include ")); } - strings__Builder_write_string(&builder, _SLIT("\n#ifdef _MSC_VER\n\011#define __RETURN_ADDRESS() ((char*)_ReturnAddress())\n#elif defined(__TINYC__) && defined(_WIN32)\n\011#define __RETURN_ADDRESS() ((char*)__builtin_return_address(0))\n#else\n\011#define __RETURN_ADDRESS() ((char*)__builtin_extract_return_addr(__builtin_return_address(0)))\n#endif\n\n#define ASSUMED_PAGE_SIZE 0x4000 // 16K\n#define _CLOSURE_SIZE (((3*sizeof(void*) > sizeof(__closure_thunk) ? 3*sizeof(void*) : sizeof(__closure_thunk)) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))\n// equal to `max(3*sizeof(void*), sizeof(__closure_thunk))`, rounded up to the next multiple of `sizeof(void*)`\n\n// refer to https://godbolt.org/z/r7P3EYv6c for a complete assembly\n#ifdef __V_amd64\nstatic const char __closure_thunk[] = {\n\0110x8f, 0x05, 0x0a, 0xc0, 0xff, 0xff, // pop QWORD PTR [rip - return_addr]\n\0110xff, 0x15, 0xfc, 0xbf, 0xff, 0xff, // call QWORD PTR [rip - fn]\n\0110xff, 0x25, 0xfe, 0xbf, 0xff, 0xff // jmp QWORD PTR [rip - return_addr]\n};\n#define __CLOSURE_DATA_OFFSET 0x400C\n#elif defined(__V_x86)\nstatic char __closure_thunk[] = {\n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call 4\n\0110x59, // pop ecx\n\0110x8f, 0x81, 0x03, 0xc0, 0xff, 0xff, // pop DWORD PTR [ecx - 0x3ffd] # \n\0110xff, 0x91, 0xff, 0xbf, 0xff, 0xff, // call DWORD PTR [ecx - 0x4001] # \n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call 4\n\0110x59, // pop ecx\n\0110xff, 0xa1, 0xf1, 0xbf, 0xff, 0xff // jmp DWORD PTR [ecx - 0x400f] # \n};\n#define __CLOSURE_DATA_OFFSET 0x4012\n#elif defined(__V_arm64)\nstatic char __closure_thunk[] = {\n\0110x90, 0x00, 0xfe, 0x10, // adr x16, return_addr\n\0110x1e, 0x02, 0x00, 0xf9, // str x30, [x16]\n\0110x10, 0x00, 0xfe, 0x58, // ldr x16, fn\n\0110x00, 0x02, 0x3f, 0xd6, // blr x16\n\0110x1e, 0x00, 0xfe, 0x58, // ldr x30, return_addr\n\0110xc0, 0x03, 0x5f, 0xd6 // ret\n};\n#define __CLOSURE_DATA_OFFSET 0x4010\n#elif defined(__V_arm32)\n// arm32 needs a small page size because its pc-relative addressing range is just \302\2614095 bytes\n#undef ASSUMED_PAGE_SIZE\n#define ASSUMED_PAGE_SIZE 4080\n#undef _CLOSURE_SIZE\n#define _CLOSURE_SIZE 28\nstatic char __closure_thunk[] = {\n\0110xf0, 0xef, 0x0f, 0xe5, // str lr, return_addr\n\0110xf8, 0xcf, 0x1f, 0xe5, // ldr ip, fn\n\0110x3c, 0xff, 0x2f, 0xe1, // blx ip\n\0110xfc, 0xef, 0x1f, 0xe5, // ldr lr, return_addr\n\0110x1e, 0xff, 0x2f, 0xe1 // bx lr\n};\n#define __CLOSURE_DATA_OFFSET 0xFFC\n#endif\n\nstatic inline void __closure_set_data(char* closure, void* data) {\n void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n p[0] = data;\n}\n\nstatic inline void __closure_set_function(char* closure, void* f) {\n void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n p[1] = f;\n}\n\n#ifdef _WIN32\n#include \nstatic SRWLOCK _closure_mtx;\n#define _closure_mtx_init() InitializeSRWLock(&_closure_mtx)\n#define _closure_mtx_lock() AcquireSRWLockExclusive(&_closure_mtx)\n#define _closure_mtx_unlock() ReleaseSRWLockExclusive(&_closure_mtx)\n#else\nstatic pthread_mutex_t _closure_mtx;\n#define _closure_mtx_init() pthread_mutex_init(&_closure_mtx, 0)\n#define _closure_mtx_lock() pthread_mutex_lock(&_closure_mtx)\n#define _closure_mtx_unlock() pthread_mutex_unlock(&_closure_mtx)\n#endif\nstatic char* _closure_ptr = 0;\nstatic int _closure_cap = 0;\n\nstatic void* __closure_create(void* fn, void* data) {\n\011_closure_mtx_lock();\n\011if (_closure_cap == 0) {\n#ifdef _WIN32\n\011\011SYSTEM_INFO si;\n\011\011GetNativeSystemInfo(&si);\n\011\011uint32_t page_size = si.dwPageSize;\n\011\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011\011char* p = VirtualAlloc(NULL, page_size * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);\n\011\011if (p == NULL) return 0;\n#else\n\011\011uint32_t page_size = sysconf(_SC_PAGESIZE);\n\011\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011\011int prot = PROT_READ | PROT_WRITE;\n\011\011int flags = MAP_ANONYMOUS | MAP_PRIVATE;\n\011\011char* p = mmap(0, page_size * 2, prot, flags, -1, 0);\n\011\011if (p == MAP_FAILED) return 0;\n#endif\n\011\011char* x = p + page_size;\n\011\011int remaining = page_size / _CLOSURE_SIZE;\n\011\011_closure_ptr = x;\n\011\011_closure_cap = remaining;\n\011\011while (remaining > 0) {\n\011\011\011memcpy(x, __closure_thunk, sizeof(__closure_thunk));\n\011\011\011remaining--;\n\011\011\011x += _CLOSURE_SIZE;\n\011\011}\n#ifdef _WIN32\n\011\011DWORD _tmp;\n\011\011VirtualProtect(_closure_ptr, page_size, PAGE_EXECUTE_READ, &_tmp);\n#else\n\011\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_EXEC);\n#endif\n\011}\n\011_closure_cap--;\n\011void* closure = _closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011__closure_set_data(closure, data);\n\011__closure_set_function(closure, fn);\n\011_closure_mtx_unlock();\n\011return closure;\n}\n\nstatic void __closure_destroy(void *closure) {\n#ifdef _WIN32\n\011SYSTEM_INFO si;\n\011GetNativeSystemInfo(&si);\n\011uint32_t page_size = si.dwPageSize;\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011VirtualFree(closure, page_size * 2, MEM_RELEASE);\n#else\n long page_size = sysconf(_SC_PAGESIZE);\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n munmap((char*)closure - page_size, page_size * 2);\n#endif\n}\n")); + strings__Builder_write_string(&builder, _SLIT("\n#ifdef _MSC_VER\n\011#define __RETURN_ADDRESS() ((char*)_ReturnAddress())\n#elif defined(__TINYC__) && defined(_WIN32)\n\011#define __RETURN_ADDRESS() ((char*)__builtin_return_address(0))\n#else\n\011#define __RETURN_ADDRESS() ((char*)__builtin_extract_return_addr(__builtin_return_address(0)))\n#endif\n\nstatic int _V_page_size = 0x4000; // 16K\n#define ASSUMED_PAGE_SIZE 0x4000\n#define _CLOSURE_SIZE (((2*sizeof(void*) > sizeof(__closure_thunk) ? 2*sizeof(void*) : sizeof(__closure_thunk)) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))\n// equal to `max(2*sizeof(void*), sizeof(__closure_thunk))`, rounded up to the next multiple of `sizeof(void*)`\n\n// refer to https://godbolt.org/z/r7P3EYv6c for a complete assembly\n#ifdef __V_amd64\nstatic const char __closure_thunk[] = {\n\0110xF3, 0x44, 0x0F, 0x7E, 0x3D, 0xF7, 0xBF, 0xFF, 0xFF, // movq xmm15, QWORD PTR [rip - userdata]\n\0110xFF, 0x25, 0xF9, 0xBF, 0xFF, 0xFF // jmp QWORD PTR [rip - fn]\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x66, 0x4C, 0x0F, 0x7E, 0xF8, // movq rax, xmm15\n\0110xC3 // ret\n};\n#define __CLOSURE_DATA_OFFSET 0x400C\n#elif defined(__V_x86)\nstatic char __closure_thunk[] = {\n\0110xe8, 0x00, 0x00, 0x00, 0x00, // call here\n\011 // here:\n\0110x59, // pop ecx\n\0110x66, 0x0F, 0x6E, 0xF9, // movd xmm7, ecx\n\0110xff, 0xA1, 0xff, 0xbf, 0xff, 0xff, // jmp DWORD PTR [ecx - 0x4001] # \n};\n\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x66, 0x0F, 0x7E, 0xF8, // movd eax, xmm7\n\0110x8B, 0x80, 0xFB, 0xBF, 0xFF, 0xFF, // mov eax, DWORD PTR [eax - 0x4005]\n\0110xc3 // ret\n};\n\n#define __CLOSURE_DATA_OFFSET 0x4012\n#elif defined(__V_arm64)\nstatic char __closure_thunk[] = {\n\0110x11, 0x00, 0xFE, 0x58, // ldr x17, userdata\n\0110x30, 0x00, 0xFE, 0x58, // ldr x16, fn\n\0110x00, 0x02, 0x1F, 0xD6 // br x16\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110xE0, 0x03, 0x11, 0xAA, // mov x0, x17\n\0110xC0, 0x03, 0x5F, 0xD6 // ret\n};\n#elif defined(__V_arm32)\nstatic char __closure_thunk[] = {\n\0110x04, 0xC0, 0x4F, 0xE2, // adr ip, here\n // here:\n\0110x01, 0xC9, 0x4C, 0xE2, // sub ip, ip, #4000\n\0110x90, 0xCA, 0x07, 0xEE, // vmov s15, ip\n\0110x00, 0xC0, 0x9C, 0xE5, // ldr ip, [ip, 0]\n\0110x1C, 0xFF, 0x2F, 0xE1 // bx ip\n};\nstatic char __CLOSURE_GET_DATA_BYTES[] = {\n\0110x90, 0x0A, 0x17, 0xEE,\n\0110x04, 0x00, 0x10, 0xE5,\n\0110x1E, 0xFF, 0x2F, 0xE1\n};\n#define __CLOSURE_DATA_OFFSET 0xFFC\n#endif\n\nstatic void*(*__CLOSURE_GET_DATA)(void) = 0;\n\nstatic inline void __closure_set_data(char* closure, void* data) {\n\011void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n\011p[0] = data;\n}\n\nstatic inline void __closure_set_function(char* closure, void* f) {\n\011void** p = (void**)(closure - ASSUMED_PAGE_SIZE);\n\011p[1] = f;\n}\n\n#ifdef _WIN32\n#include \nstatic SRWLOCK _closure_mtx;\n#define _closure_mtx_init() InitializeSRWLock(&_closure_mtx)\n#define _closure_mtx_lock() AcquireSRWLockExclusive(&_closure_mtx)\n#define _closure_mtx_unlock() ReleaseSRWLockExclusive(&_closure_mtx)\n#else\nstatic pthread_mutex_t _closure_mtx;\n#define _closure_mtx_init() pthread_mutex_init(&_closure_mtx, 0)\n#define _closure_mtx_lock() pthread_mutex_lock(&_closure_mtx)\n#define _closure_mtx_unlock() pthread_mutex_unlock(&_closure_mtx)\n#endif\nstatic char* _closure_ptr = 0;\nstatic int _closure_cap = 0;\n\nstatic void __closure_alloc(void) {\n#ifdef _WIN32\n\011char* p = VirtualAlloc(NULL, _V_page_size * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);\n\011if (p == NULL) return;\n#else\n\011char* p = mmap(0, _V_page_size * 2, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);\n\011if (p == MAP_FAILED) return;\n#endif\n\011char* x = p + _V_page_size;\n\011int remaining = _V_page_size / _CLOSURE_SIZE;\n\011_closure_ptr = x;\n\011_closure_cap = remaining;\n\011while (remaining > 0) {\n\011\011memcpy(x, __closure_thunk, sizeof(__closure_thunk));\n\011\011remaining--;\n\011\011x += _CLOSURE_SIZE;\n\011}\n#ifdef _WIN32\n\011DWORD _tmp;\n\011VirtualProtect(_closure_ptr, _V_page_size, PAGE_EXECUTE_READ, &_tmp);\n#else\n\011mprotect(_closure_ptr, _V_page_size, PROT_READ | PROT_EXEC);\n#endif\n}\n\n#ifdef _WIN32\nvoid __closure_init() {\n\011SYSTEM_INFO si;\n\011GetNativeSystemInfo(&si);\n\011uint32_t page_size = si.dwPageSize * (((ASSUMED_PAGE_SIZE - 1) / si.dwPageSize) + 1);\n\011_V_page_size = page_size;\n\011__closure_alloc();\n\011DWORD _tmp;\n\011VirtualProtect(_closure_ptr, page_size, PAGE_READWRITE, &_tmp);\n\011memcpy(_closure_ptr, __CLOSURE_GET_DATA_BYTES, sizeof(__CLOSURE_GET_DATA_BYTES));\n\011VirtualProtect(_closure_ptr, page_size, PAGE_EXECUTE_READ, &_tmp);\n\011__CLOSURE_GET_DATA = (void*)_closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011_closure_cap--;\n}\n#else\nvoid __closure_init() {\n\011uint32_t page_size = sysconf(_SC_PAGESIZE);\n\011page_size = page_size * (((ASSUMED_PAGE_SIZE - 1) / page_size) + 1);\n\011_V_page_size = page_size;\n\011__closure_alloc();\n\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_WRITE);\n\011memcpy(_closure_ptr, __CLOSURE_GET_DATA_BYTES, sizeof(__CLOSURE_GET_DATA_BYTES));\n\011mprotect(_closure_ptr, page_size, PROT_READ | PROT_EXEC);\n\011__CLOSURE_GET_DATA = (void*)_closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011_closure_cap--;\n}\n#endif\n\nstatic void* __closure_create(void* fn, void* data) {\n\011_closure_mtx_lock();\n\011if (_closure_cap == 0) {\n\011\011__closure_alloc();\n\011}\n\011_closure_cap--;\n\011void* closure = _closure_ptr;\n\011_closure_ptr += _CLOSURE_SIZE;\n\011__closure_set_data(closure, data);\n\011__closure_set_function(closure, fn);\n\011_closure_mtx_unlock();\n\011return closure;\n}\n")); string _t1 = strings__Builder_str(&builder); return _t1; } @@ -71902,7 +74299,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_vlines_reset(v__gen__c__Gen* g) { } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_only_header(v__gen__c__Gen* g) { + if ((g->pref->cmain).len != 0) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("int "), /*115 &string*/0xfe10, {.d_s = g->pref->cmain}}, {_SLIT("(int ___argc, char** ___argv){"), 0, { .d_c = 0 }}}))); + return; + } if (g->pref->os == v__pref__OS__windows) { if (v__gen__c__Gen_is_gui_app(g)) { #if defined(_MSC_VER) @@ -71917,14 +74318,21 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g v__gen__c__Gen_writeln(g, _SLIT("\tcmd_line_to_argv CommandLineToArgvW = (cmd_line_to_argv)GetProcAddress(shell32_module, \"CommandLineToArgvW\");")); v__gen__c__Gen_writeln(g, _SLIT("\tint ___argc;")); v__gen__c__Gen_writeln(g, _SLIT("\twchar_t** ___argv = CommandLineToArgvW(full_cmd_line, &___argc);")); - } else { - v__gen__c__Gen_writeln(g, _SLIT("int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){")); + return; } - } else { - v__gen__c__Gen_writeln(g, _SLIT("int main(int ___argc, char** ___argv){")); + v__gen__c__Gen_writeln(g, _SLIT("int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){")); + return; } + v__gen__c__Gen_writeln(g, _SLIT("int main(int ___argc, char** ___argv){")); +} + +VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_function_header(v__gen__c__Gen* g) { + v__gen__c__Gen_gen_c_main_function_only_header(g); v__gen__c__Gen_writeln(g, _SLIT("\tg_main_argc = ___argc;")); v__gen__c__Gen_writeln(g, _SLIT("\tg_main_argv = ___argv;")); + if (g->nr_closures > 0) { + v__gen__c__Gen_writeln(g, _SLIT("__closure_init();")); + } } VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { @@ -71973,22 +74381,22 @@ void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g) { } void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name) { - multi_return_int_string_string_string mr_4758 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_4758.arg0; - string pafile = mr_4758.arg1; - string pamod = mr_4758.arg2; - string pafn = mr_4758.arg3; + multi_return_int_string_string_string mr_5006 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_5006.arg0; + string pafile = mr_5006.arg1; + string pamod = mr_5006.arg2; + string pafn = mr_5006.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name) { - multi_return_int_string_string_string mr_5449 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); - int paline = mr_5449.arg0; - string pafile = mr_5449.arg1; - string pamod = mr_5449.arg2; - string pafn = mr_5449.arg3; + multi_return_int_string_string_string mr_5697 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5697.arg0; + string pafile = mr_5697.arg1; + string pamod = mr_5697.arg2; + string pafn = mr_5697.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); @@ -72471,7 +74879,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 335) /*expected idx: 335, name: v.ast.TypeNode */ ).typ; if ((left)._typ == 335 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { v__ast__TypeSymbol* interface_sym = v__ast__Table_sym(g->table, got_type); - if ((interface_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((interface_sym->info)._typ == 478 /* v.ast.Interface */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_does_type_implement_interface(g->table, checked_type, got_type); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -73003,7 +75411,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { string ptr_asterisk = (is_ptr ? (_SLIT("*")) : (_SLIT(""))); string str_dumparg_type = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = ptr_asterisk}}, {_SLIT0, 0, { .d_c = 0 }}})); if (dump_sym->kind == v__ast__Kind__function) { - v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; str_dumparg_type = str_intp(2, _MOV((StrIntpData[]){{_SLIT("DumpFNType_"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, 0, { .d_c = 0 }}})); int tdef_pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &fninfo, str_dumparg_type); @@ -73071,17 +75479,26 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_writeln_fn_header(v__gen__c__Gen* g, string return _t2; } -VV_LOCAL_SYMBOL bool v__gen__c__Gen_embed_file_is_prod_mode(v__gen__c__Gen* g) { - if (g->pref->is_prod || Array_string_contains(g->pref->compile_defines, _SLIT("debug_embed_file_in_prod"))) { - bool _t1 = true; +VV_LOCAL_SYMBOL bool v__gen__c__Gen_should_really_embed_file(v__gen__c__Gen* g) { + if (Array_string_contains(g->pref->compile_defines, _SLIT("embed_only_metadata"))) { + bool _t1 = false; return _t1; } - bool _t2 = false; + bool _t2 = true; return _t2; } +VV_LOCAL_SYMBOL void v__gen__c__Gen_handle_embedded_files_finish(v__gen__c__Gen* g) { + if (g->embedded_files.len > 0) { + if (v__gen__c__Gen_should_really_embed_file(g)) { + v__gen__c__Gen_gen_embedded_data(g); + } + v__gen__c__Gen_gen_embedded_metadata(g); + } +} + VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embed_file_init(v__gen__c__Gen* g, v__ast__ComptimeCall* node) { - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { _option_Array_u8 _t1 = os__read_bytes(node->embed_file.apath); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -73155,12 +75572,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g) { u64 ef_idx = v__ast__EmbeddedFile_hash(emfile); strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tcase "), /*117 &u64*/0xfe08, {.d_u64 = ef_idx}}, {_SLIT("U: {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.path = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.rpath)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.apath = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(_SLIT(""))}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.apath = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.apath)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { if (emfile.is_compressed) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.compression_type = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.compression_type)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->embedded_data, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.compressed = v__embed_file__find_index_entry_by_path((voidptr)_v_embed_file_index, "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.rpath)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(emfile.compression_type)}}, {_SLIT(")->data;"), 0, { .d_c = 0 }}}))); @@ -73173,7 +75590,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_embedded_metadata(v__gen__c__Gen* g) { } strings__Builder_writeln(&g->embedded_data, _SLIT("\t\t\tres.free_compressed = 0;")); strings__Builder_writeln(&g->embedded_data, _SLIT("\t\t\tres.free_uncompressed = 0;")); - if (v__gen__c__Gen_embed_file_is_prod_mode(g)) { + if (v__gen__c__Gen_should_really_embed_file(g)) { strings__Builder_writeln(&g->embedded_data, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tres.len = "), /*100 &int*/0xfe07, {.d_i32 = emfile.len}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { u64 file_size = os__file_size(emfile.apath); @@ -73528,7 +75945,7 @@ int ctmp; strings__Builder_writeln(&g->definitions, _SLIT(");")); v__gen__c__Gen_writeln(g, _SLIT(") {")); if (is_closure) { - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cur_closure_ctx}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT(" = *(void**)(__RETURN_ADDRESS() - __CLOSURE_DATA_OFFSET);"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cur_closure_ctx}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__closure_ctx}}, {_SLIT(" = __CLOSURE_GET_DATA();"), 0, { .d_c = 0 }}}))); } for (int i = 0; i < heap_promoted.len; ++i) { bool is_promoted = ((bool*)heap_promoted.data)[i]; @@ -73769,34 +76186,34 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_defer_stmts_when_needed(v__gen__c__Gen } VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen_fn_decl_params(v__gen__c__Gen* g, Array_v__ast__Param params, v__ast__Scope* scope, bool is_variadic) { - Array_string fargs = __new_array_with_default(0, 0, sizeof(string), 0); - Array_string fargtypes = __new_array_with_default(0, 0, sizeof(string), 0); + Array_string fparams = __new_array_with_default(0, 0, sizeof(string), 0); + Array_string fparamtypes = __new_array_with_default(0, 0, sizeof(string), 0); Array_bool heap_promoted = __new_array_with_default(0, 0, sizeof(bool), 0); if (params.len == 0) { v__gen__c__Gen_write(g, _SLIT("void")); } for (int i = 0; i < params.len; ++i) { - v__ast__Param arg = ((v__ast__Param*)params.data)[i]; - string caname = (string__eq(arg.name, _SLIT("_")) ? (v__gen__c__Gen_new_tmp_declaration_name(g)) : (v__gen__c__c_name(arg.name))); - v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, arg.typ); - v__ast__TypeSymbol* arg_type_sym = v__ast__Table_sym(g->table, typ); - string arg_type_name = v__gen__c__Gen_typ(g, typ); - if (arg_type_sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__Param param = ((v__ast__Param*)params.data)[i]; + string caname = (string__eq(param.name, _SLIT("_")) ? (v__gen__c__Gen_new_tmp_declaration_name(g)) : (v__gen__c__c_name(param.name))); + v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, param.typ); + v__ast__TypeSymbol* param_type_sym = v__ast__Table_sym(g->table, typ); + string param_type_name = v__gen__c__Gen_typ(g, typ); + if (param_type_sym->kind == v__ast__Kind__function) { + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ; v__ast__Fn func = info.func; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); strings__Builder_write_string(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_fn_decl_params(g, func.params, ((voidptr)(0)), func.is_variadic); v__gen__c__Gen_write(g, _SLIT(")")); strings__Builder_write_string(&g->definitions, _SLIT(")")); - array_push((array*)&fargs, _MOV((string[]){ string_clone(caname) })); - array_push((array*)&fargtypes, _MOV((string[]){ string_clone(arg_type_name) })); + array_push((array*)&fparams, _MOV((string[]){ string_clone(caname) })); + array_push((array*)&fparamtypes, _MOV((string[]){ string_clone(param_type_name) })); } else { bool heap_prom = false; if (scope != ((voidptr)(0))) { - if (!string__eq(arg.name, _SLIT("_"))) { + if (!string__eq(param.name, _SLIT("_"))) { _option_v__ast__Var_ptr _t3; - if (_t3 = v__ast__Scope_find_var(scope, arg.name), _t3.state == 0) { + if (_t3 = v__ast__Scope_find_var(scope, param.name), _t3.state == 0) { v__ast__Var* v = *(v__ast__Var**)_t3.data; if (!v->is_stack_obj && v->is_auto_heap) { heap_prom = true; @@ -73805,12 +76222,12 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen } } string var_name_prefix = (heap_prom ? (_SLIT("_v_toheap_")) : (_SLIT(""))); - string const_prefix = (v__ast__Type_is_any_kind_of_pointer(arg.typ) && !arg.is_mut && string_starts_with(arg.name, _SLIT("const_")) ? (_SLIT("const ")) : (_SLIT(""))); - string s = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = const_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arg_type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT0, 0, { .d_c = 0 }}})); + string const_prefix = (v__ast__Type_is_any_kind_of_pointer(param.typ) && !param.is_mut && string_starts_with(param.name, _SLIT("const_")) ? (_SLIT("const ")) : (_SLIT(""))); + string s = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = const_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = param_type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT0, 0, { .d_c = 0 }}})); v__gen__c__Gen_write(g, s); strings__Builder_write_string(&g->definitions, s); - array_push((array*)&fargs, _MOV((string[]){ string_clone(caname) })); - array_push((array*)&fargtypes, _MOV((string[]){ string_clone(arg_type_name) })); + array_push((array*)&fparams, _MOV((string[]){ string_clone(caname) })); + array_push((array*)&fparamtypes, _MOV((string[]){ string_clone(param_type_name) })); array_push((array*)&heap_promoted, _MOV((bool[]){ heap_prom })); } if (i < params.len - 1) { @@ -73819,10 +76236,10 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen } } if (g->pref->translated && is_variadic) { - v__gen__c__Gen_write(g, _SLIT(", ...")); - strings__Builder_write_string(&g->definitions, _SLIT(", ...")); + v__gen__c__Gen_write(g, _SLIT(", ... ")); + strings__Builder_write_string(&g->definitions, _SLIT(", ... ")); } - return (multi_return_Array_string_Array_string_Array_bool){.arg0=fargs, .arg1=fargtypes, .arg2=heap_promoted}; + return (multi_return_Array_string_Array_string_Array_bool){.arg0=fparams, .arg1=fparamtypes, .arg2=heap_promoted}; } VV_LOCAL_SYMBOL string v__gen__c__Gen_get_anon_fn_type_name(v__gen__c__Gen* g, v__ast__AnonFn* node, string var_name) { @@ -73971,7 +76388,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 477 /* v.ast.Interface */) { + else if (sym->info._typ == 478 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*sym->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -73990,7 +76407,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 478 /* v.ast.SumType */) { + else if (sym->info._typ == 479 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*sym->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -74016,14 +76433,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); if (typ_sym->kind == v__ast__Kind__alias && !string__eq(node.name, _SLIT("str")) && !v__ast__TypeSymbol_has_method(typ_sym, node.name)) { - unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); } string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), node.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ )), node.name)) { bool left_is_shared = v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f); - string left_cc_type = v__gen__c__Gen_cc_type(g, node.left_type, false); + string left_cc_type = v__gen__c__Gen_cc_type(g, v__ast__Table_unaliased_type(g->table, node.left_type), false); string left_type_name = v__util__no_dots(left_cc_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(left_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); if (v__ast__Expr_is_auto_deref_var(node.left) && v__ast__Type_nr_muls(node.left_type) > 1) { @@ -74196,7 +76613,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } else if ((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { rec_type = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, rec_type); - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { rec_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -74217,7 +76634,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE receiver_type_name = _SLIT("map"); } if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { - if (!((left_sym->info)._typ == 474 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { + if (!((left_sym->info)._typ == 475 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } if (string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("pop"))) { @@ -74512,7 +76929,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if (!v__ast__Type_alias_eq(typ, _const_v__ast__string_type) || g->comptime_for_method.len > 0) { v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, typ); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), _SLIT("str"))) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ )), _SLIT("str"))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -74566,7 +76983,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, typ); - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -74580,11 +76997,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_39776 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39776.arg0; - string pafile = mr_39776.arg1; - string pamod = mr_39776.arg2; - string pafn = mr_39776.arg3; + multi_return_int_string_string_string mr_39829 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39829.arg0; + string pafile = mr_39829.arg1; + string pamod = mr_39829.arg2; + string pafn = mr_39829.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -74609,7 +77026,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } } string dot = (is_ptr ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -74887,15 +77304,24 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr); } else { if (variadic_count > 0) { - string noscan = v__gen__c__Gen_check_noscan(g, arr_info.elem_type); - v__gen__c__Gen_write(g, str_intp(7, _MOV((StrIntpData[]){{_SLIT("new_array_from_c_array"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); - for (int j = arg_nr; j < args.len; ++j) { - v__gen__c__Gen_ref_or_deref_arg(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)), arr_info.elem_type, node.language); - if (j < args.len - 1) { - v__gen__c__Gen_write(g, _SLIT(", ")); + if (g->pref->translated || g->file->is_translated) { + for (int j = arg_nr; j < args.len; ++j) { + v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)).expr); + if (j < args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } } + } else { + string noscan = v__gen__c__Gen_check_noscan(g, arr_info.elem_type); + v__gen__c__Gen_write(g, str_intp(7, _MOV((StrIntpData[]){{_SLIT("new_array_from_c_array"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = variadic_count}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + for (int j = arg_nr; j < args.len; ++j) { + v__gen__c__Gen_ref_or_deref_arg(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, j)), arr_info.elem_type, node.language); + if (j < args.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + v__gen__c__Gen_write(g, _SLIT("}))")); } - v__gen__c__Gen_write(g, _SLIT("}))")); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__new_array(0, 0, sizeof("), /*115 &string*/0xfe10, {.d_s = elem_type}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } @@ -75100,7 +77526,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__Type unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, expr.receiver_type); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), expr.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ )), expr.name)) { string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(receiver_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -75447,7 +77873,22 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_c_stmt(v__gen__c__Gen* g, v__ast__ForCSt } v__gen__c__Gen_write(g, _SLIT("; ")); if (node.has_inc) { - v__gen__c__Gen_stmt(g, node.inc); + bool processed = false; + if ((node.inc)._typ == 349 /* v.ast.ExprStmt */) { + if (((*node.inc._v__ast__ExprStmt).expr)._typ == 303 /* v.ast.ConcatExpr */) { + for (int inc_expr_idx = 0; inc_expr_idx < (*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.len; ++inc_expr_idx) { + v__ast__Expr inc_expr = ((v__ast__Expr*)(*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.data)[inc_expr_idx]; + v__gen__c__Gen_expr(g, inc_expr); + if (inc_expr_idx < (*(*node.inc._v__ast__ExprStmt).expr._v__ast__ConcatExpr).vals.len - 1) { + v__gen__c__Gen_write(g, _SLIT(", ")); + } + } + processed = true; + } + } + if (!processed) { + v__gen__c__Gen_stmt(g, node.inc); + } } v__gen__c__Gen_writeln(g, _SLIT(") {")); g->is_vlines_enabled = true; @@ -75526,7 +77967,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT(" = ((voidptr*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("];"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { string right = str_intp(5, _MOV((StrIntpData[]){{_SLIT("(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("]"), 0, { .d_c = 0 }}})); @@ -75562,14 +78003,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } string idx = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__ast__TypeSymbol* cond_sym = v__ast__Table_sym(g->table, node.cond_type); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" != "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("; ++"), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); bool is_fixed_array = val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut; if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); } else if (is_fixed_array) { string styp = v__gen__c__Gen_typ(g, node.val_type); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(node.val_var)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -75631,7 +78072,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); if (val_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 487) /*expected idx: 487, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_write(g, _SLIT(" = (*(voidptr*)")); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("DenseArray_value(&"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arw_or_pt}}, {_SLIT("key_values, "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { @@ -75757,7 +78198,8 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_if(v__gen__c__Gen* g, v__ast bool _t6 = true; return _t6; } - } else if ((*stmt.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { + } + if ((*stmt.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { bool _t7 = true; return _t7; } @@ -75809,7 +78251,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no v__gen__c__Gen_stmts(g, branch.stmts); g->expected_cast_type = prev_expected_cast_type; } - if (node.branches.len == 1) { + if (node.branches.len == 1 && !node.is_expr) { v__gen__c__Gen_write(g, _SLIT(": 0")); } v__gen__c__Gen_write(g, _SLIT(")")); @@ -75900,7 +78342,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string left_var_name = v__gen__c__c_name(var.name); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*branch.cond._v__ast__IfGuardExpr).vars.len) { string var_typ = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(mr_info.types, vi))); if (is_auto_heap) { @@ -76061,7 +78503,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE v__gen__c__Gen_write(g, tmp_left); } } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; string noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); if (node.is_gated) { v__gen__c__Gen_write(g, _SLIT("array_slice_ni(")); @@ -76089,7 +78531,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE if (range.has_high) { v__gen__c__Gen_expr(g, range.high); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__array) { if (v__ast__Type_is_ptr(node.left_type)) { @@ -76189,7 +78631,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In v__gen__c__Gen_write(g, _SLIT("/*2*/string_clone(")); } if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")(*("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_sym */array_get("), 0, { .d_c = 0 }}}))); @@ -76253,10 +78695,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 486 /* v.ast.FnType */; + bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 487 /* v.ast.FnType */; if (is_fn_index_call) { v__gen__c__Gen_write(g, _SLIT("(*")); } @@ -76365,7 +78807,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = tmp_opt_ptr}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_ptr_typ */(map_get_check("), 0, { .d_c = 0 }}}))); } else { if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 487 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, _SLIT(")(*(voidptr*)map_get(")); @@ -76590,7 +79032,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr(v__gen__c__Gen* g, v__ast__InfixE VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arrow_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); string styp = left.sym->cname; - v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 484) /*expected idx: 484, name: v.ast.Chan */ ).elem_type; bool gen_or = node.or_block.kind != v__ast__OrKind__absent; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { @@ -76617,7 +79059,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_defined_eq_operator = v__ast__Table_has_method(g->table, left.sym, _SLIT("==")); - bool has_alias_eq_op_overload = (left.sym->info)._typ == 474 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + bool has_alias_eq_op_overload = (left.sym->info)._typ == 475 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + if (g->pref->translated && !g->is_builtin_mod) { + v__gen__c__Gen_gen_plain_infix_expr(g, node); + return; + } if ((v__ast__Type_is_ptr(left.typ) && v__ast__Type_is_int(right.typ)) || (v__ast__Type_is_ptr(right.typ) && v__ast__Type_is_int(left.typ))) { v__gen__c__Gen_gen_plain_infix_expr(g, node); } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 333 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 333) /*expected idx: 333, name: v.ast.StringLiteral */ ).val).len == 0) { @@ -76854,6 +79300,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_cmp_op(v__gen__c__Gen* g, v__ast_ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_operator_overloading = v__ast__Table_has_method(g->table, left.sym, _SLIT("<")); + if (g->pref->translated && !g->is_builtin_mod) { + v__gen__c__Gen_gen_plain_infix_expr(g, node); + return; + } if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { if (node.op == v__token__Kind__le || node.op == v__token__Kind__ge) { v__gen__c__Gen_write(g, _SLIT("!")); @@ -77022,7 +79472,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 482 /* v.ast.ArrayFixed */) { + if ((right.sym->info)._typ == 483 /* v.ast.ArrayFixed */) { v__ast__Type elem_type = (*right.sym->info._v__ast__ArrayFixed).elem_type; v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { @@ -77087,7 +79537,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); bool is_aggregate = left_sym->kind == v__ast__Kind__aggregate; if (is_aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 473) /*expected idx: 473, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(g->table, parent_left_type); } v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); @@ -77134,7 +79584,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; Array_v__ast__Type* _t2 = (Array_v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, info.conversions), &(int[]){node.right_type})); _option_Array_v__ast__Type _t1 = {0}; if (_t2) { @@ -77433,21 +79883,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { string dec_fn_dec = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = dec_fn_name}}, {_SLIT("(cJSON* root)"), 0, { .d_c = 0 }}})); string init_styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" res"), 0, { .d_c = 0 }}})); if (sym->kind == v__ast__Kind__struct_) { - int skips = 0; - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; - for (int _t2 = 0; _t2 < info.fields.len; ++_t2) { - v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t2]; - for (int _t3 = 0; _t3 < field.attrs.len; ++_t3) { - v__ast__Attr attr = ((v__ast__Attr*)field.attrs.data)[_t3]; - if (string__eq(attr.name, _SLIT("skip"))) { - skips++; - } - } - } - if (skips > 0) { - init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); - init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); - } + init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); + init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); } strings__Builder_writeln(&dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(" {\n "), /*115 &string*/0xfe10, {.d_s = init_styp}}, {_SLIT(";\n if (!root) {\n const char *error_ptr = cJSON_GetErrorPtr();\n if (error_ptr != NULL) {\n const int error_pos = (int)cJSON_GetErrorPos();\n int maxcontext_chars = 30;\n byte *buf = vcalloc_noscan(maxcontext_chars + 10);\n if(error_pos > 0) {\n int backlines = 1;\n int backchars = error_pos < maxcontext_chars-7 ? (int)error_pos : maxcontext_chars-7 ;\n char *prevline_ptr = (char*)error_ptr;\n while(backchars--){\n char prevc = *(prevline_ptr - 1);\n if(0==prevc){\n break;\n }\n if(10==prevc && !backlines--){\n break;\n }\n prevline_ptr--;\n if(123==prevc) {\n break; // stop at `{` too\n }\n }\n int maxchars = vstrlen_char(prevline_ptr);\n vmemcpy(buf, prevline_ptr, (maxchars < maxcontext_chars ? maxchars : maxcontext_chars));\n }\n return ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){.state = 2,.err = _v_error(tos2(buf)),.data = {0}};\n }\n }\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->json_forward_decls, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -77467,7 +79904,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, v__gen__c__Gen_decode_map(g, m.key_type, m.value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_map(g, m.key_type, m.value_type)); } else if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; v__ast__Type parent_typ = a.parent_type; v__ast__TypeSymbol* psym = v__ast__Table_sym(g->table, parent_typ); if (v__gen__c__is_js_prim(v__gen__c__Gen_typ(g, parent_typ))) { @@ -77486,7 +79923,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } } else if (sym->kind == v__ast__Kind__sum_type) { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 478 /* v.ast.SumType */) { + if ((sym->info)._typ != 479 /* v.ast.SumType */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not a sumtype"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } @@ -77510,7 +79947,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g, v__ast__TypeSymbol sym, strings__Builder* enc, strings__Builder* dec) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ; string type_var = v__gen__c__Gen_new_tmp_var(g); int typ = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){sym.name}, &(int[]){ 0 })); #if !defined(CUSTOM_DEFINE_json_no_inline_sumtypes) @@ -77699,81 +80136,69 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, if (v__gen__c__is_js_prim(field_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT("(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (field_sym->kind == v__ast__Kind__enum_) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (string__eq(field_sym->name, _SLIT("time.Time"))) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; string parent_type = v__gen__c__Gen_typ(g, alias.parent_type); string parent_dec_name = v__gen__c__js_dec_name(parent_type); if (v__gen__c__is_js_prim(parent_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } else { v__gen__c__Gen_gen_json_for_type(g, field.typ); string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } } else { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); - if (field.has_default_expr) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); if (field.has_default_expr) { strings__Builder_writeln(dec, _SLIT("\t} else {")); - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, _SLIT("\t}")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } + strings__Builder_writeln(dec, _SLIT("\t}")); } } string enc_name = v__gen__c__js_enc_name(field_type); @@ -77782,7 +80207,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } if (!v__gen__c__is_js_prim(field_type)) { if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; + v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ; enc_name = v__gen__c__js_enc_name(v__gen__c__Gen_typ(g, ainfo.parent_type)); } } @@ -77801,7 +80226,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, strings__Builder* dec, bool is_required) { strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root, \""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); if (is_required) { - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = 2, .err = _v_error(_SLIT(\"expected field \'"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\' is missing\")), .data = {0} };"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, _SLIT("\t}")); } @@ -77809,9 +80234,12 @@ VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, VV_LOCAL_SYMBOL void v__gen__c__gen_js_get_opt(string dec_name, string field_type, string styp, string tmp, string name, strings__Builder* dec, bool is_required) { v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); - strings__Builder_writeln(dec, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state != 0) {"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state, .err = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".err, .data = {0} };"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT("(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state != 0) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".state, .err = "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".err, .data = {0} };"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t\t}")); strings__Builder_writeln(dec, _SLIT("\t}")); } @@ -77858,11 +80286,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, key_type); string styp_v = v__gen__c__Gen_typ(g, value_type); v__ast__TypeSymbol* key_type_symbol = v__ast__Table_sym(g->table, key_type); - multi_return_string_string_string_string mr_20487 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); - string hash_fn = mr_20487.arg0; - string key_eq_fn = mr_20487.arg1; - string clone_fn = mr_20487.arg2; - string free_fn = mr_20487.arg3; + multi_return_string_string_string_string mr_20160 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20160.arg0; + string key_eq_fn = mr_20160.arg1; + string clone_fn = mr_20160.arg2; + string free_fn = mr_20160.arg3; string fn_name_v = v__gen__c__js_dec_name(styp_v); string s = _SLIT(""); if (v__gen__c__is_js_prim(styp_v)) { @@ -78155,7 +80583,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast__MatchExpr node, bool is_expr, string cond_var, string tmp_var, v__ast__TypeSymbol enum_typ) { string cname = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = enum_typ.cname}}, {_SLIT("__"), 0, { .d_c = 0 }}})); - Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); + Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); Array_v__ast__MatchBranch range_branches = __new_array_with_default(0, node.branches.len, sizeof(v__ast__MatchBranch), 0); bool default_generated = false; g->empty_line = true; @@ -78164,8 +80592,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ for (int _t1 = 0; _t1 < node.branches.len; ++_t1) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)node.branches.data)[_t1]; if (branch.is_else) { - for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.len; ++_t2) { - string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.data)[_t2]; + for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).vals.len; ++_t2) { + string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 489) /*expected idx: 489, name: v.ast.Enum */ ).vals.data)[_t2]; if (!Array_string_contains(covered_enum, val)) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("case "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -79423,7 +81851,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_table_name(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL v__ast__StructField v__gen__c__Gen_get_struct_field(v__gen__c__Gen* g, string name) { v__ast__Struct info = v__ast__TypeSymbol_struct_info(v__ast__Table_sym(g->table, (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){g->sql_table_name}, &(int[]){ 0 })))); - v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); + v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}); for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; if (string__eq(field.name, name)) { @@ -79502,7 +81930,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast typ = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(typ, v__ast__TypeFlag__shared_f), 0); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - if ((sym->info)._typ == 474 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 475 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); if (v__ast__TypeSymbol_has_method(parent_sym, _SLIT("str"))) { typ = (*sym->info._v__ast__Alias).parent_type; @@ -79586,7 +82014,7 @@ VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i))); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (sym->kind == v__ast__Kind__alias) { - typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; } bool remove_tail_zeros = false; u8 fspec = (*(u8*)/*ee elem_sym */array_get(node.fmts, i)); @@ -79707,7 +82135,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } v__gen__c__Gen_expr(g, expr); } - } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), _SLIT("str"))) { + } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ )), _SLIT("str"))) { string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, expr); @@ -79725,7 +82153,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } else if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { exp_typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, exp_typ); - if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 473 /* v.ast.Aggregate */) { exp_typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -80016,7 +82444,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 309 /* v.ast.Ident */) { - v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, _SLIT("{")); for (int i = 0; i < fixed_array_info.size; ++i) { v__gen__c__Gen_expr(g, sfield.expr); @@ -80066,7 +82494,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t15 = v__ast__Table_find_field_from_embeds(g->table, update_sym, field->name); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_6823 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); @@ -80221,6 +82649,7 @@ _option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v .nr_lines = 0, .tidx = 0, .eofs = 0, + .inter_cbr_count = 0, .quote = 0, .inter_quote = 0, .comments_mode = comments_mode, @@ -80263,6 +82692,7 @@ v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMo .nr_lines = 0, .tidx = 0, .eofs = 0, + .inter_cbr_count = 0, .quote = 0, .inter_quote = 0, .comments_mode = comments_mode, @@ -80381,15 +82811,15 @@ VV_LOCAL_SYMBOL string v__scanner__Scanner_num_lit(v__scanner__Scanner* s, int s { // Unsafe block u8* txt = s->text.str; u8* b = malloc_noscan(end - start + 1); - int i1 = 0; - for (int i = start; i < end; i++) { + int i_no_sep = 0; + for (int i = start; i < end; ++i) { if (txt[i] != _const_v__scanner__num_sep) { - b[i1] = txt[i]; - i1++; + b[i_no_sep] = txt[i]; + i_no_sep++; } } - b[i1] = 0; - string _t2 = u8_vstring_with_len(b, i1); + b[i_no_sep] = 0; + string _t2 = u8_vstring_with_len(b, i_no_sep); return _t2; } return (string){.str=(byteptr)"", .is_lit=1}; @@ -80959,7 +83389,11 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne } else if (c == ('{')) { if (s->is_inside_string) { - continue; + if (s->text.str[ s->pos - 1] == '$') { + continue; + } else { + s->inter_cbr_count++; + } } v__token__Token _t28 = v__scanner__Scanner_new_token(s, v__token__Kind__lcbr, _SLIT(""), 1); return _t28; @@ -80974,7 +83408,7 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne } } else if (c == ('}')) { - if (s->is_enclosed_inter) { + if (s->is_enclosed_inter && s->inter_cbr_count == 0) { if (s->pos < s->text.len - 1) { s->pos++; } else { @@ -80991,6 +83425,9 @@ VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_text_scan(v__scanner__Scanne v__token__Token _t32 = v__scanner__Scanner_new_token(s, v__token__Kind__string, ident_string, ident_string.len + 2); return _t32; } else { + if (s->inter_cbr_count > 0) { + s->inter_cbr_count--; + } v__token__Token _t33 = v__scanner__Scanner_new_token(s, v__token__Kind__rcbr, _SLIT(""), 1); return _t33; } @@ -82194,20 +84631,33 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* bool _t5 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).left) || v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).right); return _t5; } - else if (val._typ == 326 /* v.ast.PrefixExpr */) { - bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); + else if (val._typ == 324 /* v.ast.ParExpr */) { + bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__ParExpr).expr); return _t6; } + else if (val._typ == 295 /* v.ast.CallExpr */) { + for (int _t7 = 0; _t7 < (*val._v__ast__CallExpr).args.len; ++_t7) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*val._v__ast__CallExpr).args.data)[_t7]; + if (v__parser__Parser_check_cross_variables(p, exprs, arg.expr)) { + bool _t8 = true; + return _t8; + } + } + } + else if (val._typ == 326 /* v.ast.PrefixExpr */) { + bool _t9 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); + return _t9; + } else if (val._typ == 325 /* v.ast.PostfixExpr */) { - bool _t7 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); - return _t7; + bool _t10 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); + return _t10; } else if (val._typ == 329 /* v.ast.SelectorExpr */) { - for (int _t8 = 0; _t8 < exprs.len; ++_t8) { - v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t8]; + for (int _t11 = 0; _t11 < exprs.len; ++_t11) { + v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t11]; if (string__eq(v__ast__Expr_str(expr), val_str)) { - bool _t9 = true; - return _t9; + bool _t12 = true; + return _t12; } } } @@ -82215,8 +84665,8 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* else { } ; - bool _t10 = false; - return _t10; + bool _t13 = false; + return _t13; } VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Parser* p, Array_v__ast__Expr left, Array_v__ast__Comment left_comments) { @@ -82229,9 +84679,9 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t2, Array_v__ast__Comment); Array_v__ast__Comment right_comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); Array_v__ast__Expr right = __new_array_with_default(0, left.len, sizeof(v__ast__Expr), 0); - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_4041 = v__parser__Parser_expr_list(p); - right = mr_4041.arg0; - right_comments = mr_4041.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_4236 = v__parser__Parser_expr_list(p); + right = mr_4236.arg0; + right_comments = mr_4236.arg1; _PUSH_MANY(&comments, (right_comments), _t3, Array_v__ast__Comment); Array_v__ast__Comment end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); bool has_cross_var = false; @@ -82515,7 +84965,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } } v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file")); - if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { + if (string__eq(embed_compression_type, _SLIT("zlib"))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } v__ast__ComptimeCall _t7 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = ((v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.len = 0,.is_compressed = 0,}),.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = true,.is_env = 0,.is_pkgconfig = 0,}); @@ -83205,6 +85655,9 @@ bool inside_array_lit; v__parser__Parser_next(p); v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); + if (p->tok.kind == v__token__Kind__comma && p->peek_tok.kind == v__token__Kind__rpar) { + v__parser__Parser_next(p); + } v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.expr = expr,.cname = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; @@ -83447,18 +85900,11 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.right = right,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = pos,.left_type = 0,.right_type = 0,.op = tok.kind,.is_stmt = true,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,})))); - } else if (v__token__Kind_is_infix(p->tok.kind)) { - if (v__token__Kind_is_prefix(p->tok.kind) && p->tok.line_nr != p->prev_tok.line_nr) { - if (p->tok.kind == v__token__Kind__mul && v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__assign) { - v__ast__Expr _t4 = node; - return _t4; - } - v__parser__Parser_warn_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("move infix `"), /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str(p->tok.kind)}}, {_SLIT("` operator before new line (if infix intended) or use brackets for a prefix expression"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); - } + } else if (v__token__Kind_is_infix(p->tok.kind) && !((p->tok.kind == v__token__Kind__minus || p->tok.kind == v__token__Kind__amp || p->tok.kind == v__token__Kind__mul) && p->tok.line_nr != p->prev_tok.line_nr)) { node = v__parser__Parser_infix_expr(p, node); if (p->tok.kind == v__token__Kind__key_as && p->inside_if) { - v__ast__Expr _t5 = node; - return _t5; + v__ast__Expr _t4 = node; + return _t4; } } else if ((p->tok.kind == v__token__Kind__inc || p->tok.kind == v__token__Kind__dec) || (p->tok.kind == v__token__Kind__question && p->inside_ct_if_expr)) { if (p->peek_tok.kind == v__token__Kind__rpar || p->peek_tok.kind == v__token__Kind__rsbr) { @@ -83475,12 +85921,12 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr node = v__ast__PostfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PostfixExpr, (((v__ast__PostfixExpr){.op = p->tok.kind,.pos = v__token__Token_pos(&p->tok),.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); v__parser__Parser_next(p); } else { - v__ast__Expr _t6 = node; - return _t6; + v__ast__Expr _t5 = node; + return _t5; } } - v__ast__Expr _t7 = node; - return _t7; + v__ast__Expr _t6 = node; + return _t6; } VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, v__ast__Expr left) { @@ -83888,7 +86334,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { _option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t6; } @@ -83902,27 +86348,27 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); if (is_method) { bool is_duplicate = v__ast__TypeSymbol_has_method(type_sym, name); if (type_sym->kind == v__ast__Kind__interface_ && is_duplicate) { - if ((type_sym->info)._typ == 477 /* v.ast.Interface */) { + if ((type_sym->info)._typ == 478 /* v.ast.Interface */) { is_duplicate = !v__ast__Interface_has_method(&(*type_sym->info._v__ast__Interface), name); } } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t9; } } @@ -83936,7 +86382,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8871 = v__parser__Parser_parse_generic_types(p); @@ -83977,7 +86423,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); @@ -84032,7 +86478,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ @@ -84141,11 +86587,11 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ - .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}), + .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}), .generic_names = generic_names, .attrs = p->attrs, .params = params, @@ -84303,7 +86749,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->tok.kind == v__token__Kind__name) { if (v__parser__Parser_disallow_declarations_in_script_mode(p)) { - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } } @@ -84378,7 +86824,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__ast__Type typ = v__ast__new_type(idx); p->inside_defer = old_inside_defer; v__ast__AnonFn _t3 = ((v__ast__AnonFn){.decl = ((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = args, @@ -84675,7 +87121,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check_fn_mutable_arguments(v__parser__Par return; } if (sym->kind == v__ast__Kind__alias) { - v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; + v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type; v__parser__Parser_check_fn_mutable_arguments(p, atyp, pos); return; } @@ -85730,7 +88176,7 @@ v__ast__Type v__parser__Parser_parse_multi_return_type(v__parser__Parser* p) { Array_v__ast__Type mr_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool has_generic = false; for (;;) { - if (!(p->tok.kind != v__token__Kind__eof)) break; + if (!(!(p->tok.kind == v__token__Kind__eof || p->tok.kind == v__token__Kind__rpar))) break; v__ast__Type mr_type = v__parser__Parser_parse_type(p); if (v__ast__Type_idx(mr_type) == 0) { break; @@ -85777,9 +88223,9 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) } bool has_generic = false; int line_nr = p->tok.line_nr; - multi_return_Array_v__ast__Param_bool_bool mr_6628 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args = mr_6628.arg0; - bool is_variadic = mr_6628.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_6638 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args = mr_6638.arg0; + bool is_variadic = mr_6638.arg2; for (int _t2 = 0; _t2 < args.len; ++_t2) { v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; if (v__ast__Type_has_flag(arg.typ, v__ast__TypeFlag__generic)) { @@ -86001,7 +88447,7 @@ v__ast__Type v__parser__Parser_parse_type(v__parser__Parser* p) { return _t4; } v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); - if (is_optional && (sym->info)._typ == 478 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).is_anon) { + if (is_optional && (sym->info)._typ == 479 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 479) /*expected idx: 479, name: v.ast.SumType */ ).is_anon) { v__parser__Parser_error_with_pos(p, _SLIT("an inline sum type cannot be optional"), v__token__Pos_extend(optional_pos, v__token__Token_pos(&p->prev_tok))); } } @@ -86270,14 +88716,14 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 478 /* v.ast.Interface */) { if ((*parent_sym->info._v__ast__Interface).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Interface).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of interfce `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 479 /* v.ast.SumType */) { if ((*parent_sym->info._v__ast__SumType).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__SumType).generic_types.len != concrete_types.len) { @@ -86298,7 +88744,7 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str v__ast__Stmt v__parser__parse_stmt(string text, v__ast__Table* table, v__ast__Scope* scope) { bool v__parser__parse_stmt_defer_0 = false; - v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); + v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.table = table,.scope = scope,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.cmain = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_crun = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -86324,15 +88770,15 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = tmpl_path, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -86342,9 +88788,9 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), .table = table, .scope = scope, + .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -86410,15 +88856,15 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -86428,9 +88874,9 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = v__scanner__new_scanner(text, comments_mode, pref), .table = table, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = v__scanner__new_scanner(text, comments_mode, pref), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -86558,15 +89004,15 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -86576,9 +89022,9 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = (*(v__scanner__Scanner**)_t1.data), .table = table, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = (*(v__scanner__Scanner**)_t1.data), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -86654,15 +89100,15 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), .used_imports = __new_array(0, 0, sizeof(string)), .auto_imports = __new_array(0, 0, sizeof(string)), - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .label_names = __new_array(0, 0, sizeof(string)), .global_labels = __new_array(0, 0, sizeof(string)), .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = (string){.str=(byteptr)"", .is_lit=1}, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, @@ -86672,9 +89118,9 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, .pref = pref, - .scanner = (*(v__scanner__Scanner**)_t1.data), .table = table_, .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .scanner = (*(v__scanner__Scanner**)_t1.data), .expr_level = 0, .n_asm = 0, .file_backend_mode = 0, @@ -87076,112 +89522,155 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { return _t15; } v__ast__IfExpr if_expr = v__parser__Parser_if_expr(p, true); - v__ast__Stmt _t16 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (((v__ast__ExprStmt){.pos = if_expr.pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__IfExpr_to_sumtype_v__ast__Expr(&if_expr),.is_expr = 0,.typ = 0,})))); - return _t16; + v__ast__ExprStmt cur_stmt = ((v__ast__ExprStmt){.pos = if_expr.pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__IfExpr_to_sumtype_v__ast__Expr(&if_expr),.is_expr = 0,.typ = 0,}); + if (v__parser__comptime_if_expr_contains_top_stmt(if_expr)) { + v__ast__Stmt _t16 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(&cur_stmt); + return _t16; + } else { + v__ast__Stmt _t17 = v__parser__Parser_other_stmts(p, v__ast__ExprStmt_to_sumtype_v__ast__Stmt(&cur_stmt)); + return _t17; + } } else if (p->tok.kind == (v__token__Kind__hash)) { - v__ast__Stmt _t17 = v__ast__HashStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__HashStmt, (v__parser__Parser_hash(p)))); - return _t17; - } - else if (p->tok.kind == (v__token__Kind__key_type)) { - v__ast__Stmt _t18 = v__ast__TypeDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__TypeDecl, (v__parser__Parser_type_decl(p)))); + v__ast__Stmt _t18 = v__ast__HashStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__HashStmt, (v__parser__Parser_hash(p)))); return _t18; } - else if (p->tok.kind == (v__token__Kind__key_enum)) { - v__ast__Stmt _t19 = v__ast__EnumDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__EnumDecl, (v__parser__Parser_enum_decl(p)))); + else if (p->tok.kind == (v__token__Kind__key_type)) { + v__ast__Stmt _t19 = v__ast__TypeDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__TypeDecl, (v__parser__Parser_type_decl(p)))); return _t19; } - else if (p->tok.kind == (v__token__Kind__key_union)) { - v__ast__Stmt _t20 = v__ast__StructDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__StructDecl, (v__parser__Parser_struct_decl(p)))); + else if (p->tok.kind == (v__token__Kind__key_enum)) { + v__ast__Stmt _t20 = v__ast__EnumDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__EnumDecl, (v__parser__Parser_enum_decl(p)))); return _t20; } - else if (p->tok.kind == (v__token__Kind__comment)) { - v__ast__Stmt _t21 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (v__parser__Parser_comment_stmt(p)))); + else if (p->tok.kind == (v__token__Kind__key_union)) { + v__ast__Stmt _t21 = v__ast__StructDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__StructDecl, (v__parser__Parser_struct_decl(p)))); return _t21; } + else if (p->tok.kind == (v__token__Kind__comment)) { + v__ast__Stmt _t22 = v__ast__ExprStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__ExprStmt, (v__parser__Parser_comment_stmt(p)))); + return _t22; + } else { - p->inside_fn = true; - if (p->pref->is_script && !p->pref->is_test) { - p->script_mode = true; - p->script_mode_start_token = p->tok; - if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { - v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); - } - v__parser__Parser_open_scope(p); - Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); - for (;;) { - if (!(p->tok.kind != v__token__Kind__eof)) break; - array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ v__parser__Parser_stmt(p, false) })); - } - v__parser__Parser_close_scope(p); - p->script_mode = false; - v__ast__Stmt _t23 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .label_names = p->label_names, - .name = _SLIT("main.main"), - .short_name = _SLIT("main"), - .mod = _SLIT("main"), - .file = p->file_name, - .source_file = 0, - .scope = p->scope, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, - .ctdefine_idx = -1, - .idx = 0, - .return_type = _const_v__ast__void_type, - .ninstances = 0, - .language = 0, - .file_mode = 0, - .rec_share = 0, - .is_deprecated = 0, - .is_pub = 0, - .is_variadic = 0, - .is_anon = 0, - .is_noreturn = 0, - .is_manualfree = 0, - .is_main = true, - .is_test = 0, - .is_conditional = 0, - .is_exported = 0, - .is_keep_alive = 0, - .is_unsafe = 0, - .is_markused = 0, - .is_method = 0, - .rec_mut = 0, - .no_body = 0, - .is_builtin = 0, - .is_direct_arr = 0, - .has_return = 0, - .should_be_skipped = 0, - .has_await = 0, - })))); - return _t23; - } else if (p->pref->is_fmt) { - v__ast__Stmt _t24 = v__parser__Parser_stmt(p, false); - return _t24; - } else { - v__ast__Stmt _t25 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, string__plus(_SLIT("bad top level statement "), v__token__Token_str(p->tok)))))); - return _t25; - } + v__ast__Stmt _t23 = v__parser__Parser_other_stmts(p, v__ast__empty_stmt()); + return _t23; }; if (p->should_abort) { break; } } - v__ast__Stmt _t26 = v__ast__empty_stmt(); - return _t26; + v__ast__Stmt _t24 = v__ast__empty_stmt(); + return _t24; +} + +VV_LOCAL_SYMBOL bool v__parser__comptime_if_expr_contains_top_stmt(v__ast__IfExpr if_expr) { + for (int _t1 = 0; _t1 < if_expr.branches.len; ++_t1) { + v__ast__IfBranch branch = ((v__ast__IfBranch*)if_expr.branches.data)[_t1]; + for (int _t2 = 0; _t2 < branch.stmts.len; ++_t2) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t2]; + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 310 /* v.ast.IfExpr */) { + if (!v__parser__comptime_if_expr_contains_top_stmt((*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr))) { + bool _t3 = false; + return _t3; + } + } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 295 /* v.ast.CallExpr */) { + bool _t4 = false; + return _t4; + } + } else if ((stmt)._typ == 341 /* v.ast.AssignStmt */) { + bool _t5 = false; + return _t5; + } else if ((stmt)._typ == 356 /* v.ast.HashStmt */) { + bool _t6 = true; + return _t6; + } + } + } + bool _t7 = true; + return _t7; +} + +VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_other_stmts(v__parser__Parser* p, v__ast__Stmt cur_stmt) { + p->inside_fn = true; + if (p->pref->is_script && !p->pref->is_test) { + p->script_mode = true; + p->script_mode_start_token = p->tok; + if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { + v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); + } + v__parser__Parser_open_scope(p); + Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); + if (!v__ast__Stmt_sumtype_eq(cur_stmt, v__ast__empty_stmt())) { + array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ cur_stmt })); + } + for (;;) { + if (!(p->tok.kind != v__token__Kind__eof)) break; + array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ v__parser__Parser_stmt(p, false) })); + } + v__parser__Parser_close_scope(p); + p->script_mode = false; + v__ast__Stmt _t3 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, + .name = _SLIT("main.main"), + .short_name = _SLIT("main"), + .mod = _SLIT("main"), + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, + .is_deprecated = 0, + .is_pub = 0, + .is_variadic = 0, + .is_anon = 0, + .is_noreturn = 0, + .is_manualfree = 0, + .is_main = true, + .is_test = 0, + .is_conditional = 0, + .is_exported = 0, + .is_keep_alive = 0, + .is_unsafe = 0, + .is_markused = 0, + .is_method = 0, + .rec_mut = 0, + .no_body = 0, + .is_builtin = 0, + .is_direct_arr = 0, + .has_return = 0, + .should_be_skipped = 0, + .has_await = 0, + })))); + return _t3; + } else if (p->pref->is_fmt) { + v__ast__Stmt _t4 = v__parser__Parser_stmt(p, false); + return _t4; + } else { + v__ast__Stmt _t5 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, string__plus(_SLIT("bad top level statement "), v__token__Token_str(p->tok)))))); + return _t5; + } + return (v__ast__Stmt){0}; } v__ast__Comment v__parser__Parser_check_comment(v__parser__Parser* p) { @@ -88343,9 +90832,9 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse v__token__Pos pos = v__token__Token_pos(&tok); Array_v__ast__Ident defer_vars = p->defer_vars; p->defer_vars = __new_array_with_default(0, 0, sizeof(v__ast__Ident), 0); - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48447 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_48447.arg0; - Array_v__ast__Comment left_comments = mr_48447.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_49074 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_49074.arg0; + Array_v__ast__Comment left_comments = mr_49074.arg1; if (!(p->inside_defer && p->tok.kind == v__token__Kind__decl_assign)) { _PUSH_MANY(&defer_vars, (p->defer_vars), _t1, Array_v__ast__Ident); } @@ -88720,6 +91209,9 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { arg = v__parser__Parser_expr(p, 0); has_arg = true; } + if (p->tok.kind == v__token__Kind__comma && p->peek_tok.kind == v__token__Kind__rpar) { + v__parser__Parser_next(p); + } v__token__Pos end_pos = v__token__Token_pos(&p->tok); v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){ @@ -88750,7 +91242,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { } else if ((p->peek_tok.kind == v__token__Kind__lcbr || (p->peek_tok.kind == v__token__Kind__lt && lit0_is_capital)) && (!p->inside_match || (p->inside_select && prev_tok_kind == v__token__Kind__arrow && lit0_is_capital)) && !p->inside_match_case && (!p->inside_if || p->inside_select) && (!p->inside_for || p->inside_select) && !known_var) { v__ast__Expr _t19 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (v__parser__Parser_struct_init(p, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit), false)))); return _t19; - } else if (p->peek_tok.kind == v__token__Kind__lcbr && p->inside_if && lit0_is_capital && !known_var && language == v__ast__Language__v) { + } else if (p->peek_tok.kind == v__token__Kind__lcbr && ((p->inside_if && lit0_is_capital && !known_var && language == v__ast__Language__v) || (p->inside_match_case && p->tok.kind == v__token__Kind__name && p->peek_tok.pos - p->tok.pos == p->tok.len))) { v__ast__Expr _t20 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (v__parser__Parser_struct_init(p, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit), false)))); return _t20; } else if (p->peek_tok.kind == v__token__Kind__dot && (lit0_is_capital && !known_var && language == v__ast__Language__v)) { @@ -89628,9 +92120,9 @@ VV_LOCAL_SYMBOL v__ast__Return v__parser__Parser_return_stmt(v__parser__Parser* v__ast__Return _t1 = ((v__ast__Return){.pos = first_pos,.comments = comments,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),}); return _t1; } - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_85187 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_85187.arg0; - Array_v__ast__Comment comments2 = mr_85187.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_86019 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_86019.arg0; + Array_v__ast__Comment comments2 = mr_86019.arg1; _PUSH_MANY(&comments, (comments2), _t2, Array_v__ast__Comment); v__token__Pos end_pos = v__ast__Expr_pos((*(v__ast__Expr*)array_last(exprs))); v__ast__Return _t3 = ((v__ast__Return){.pos = v__token__Pos_extend(first_pos, end_pos),.comments = comments,.exprs = exprs,.types = __new_array(0, 0, sizeof(v__ast__Type)),}); @@ -89900,8 +92392,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t3; } Array_v__ast__TypeNode sum_variants = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); - multi_return_Array_v__ast__Type_Array_string mr_91683 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_91683.arg0; + multi_return_Array_v__ast__Type_Array_string mr_92515 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_92515.arg0; v__token__Pos decl_pos_with_generics = v__token__Pos_extend(decl_pos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_check(p, v__token__Kind__assign); v__token__Pos type_pos = v__token__Token_pos(&p->tok); @@ -90691,6 +93183,9 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } v__token__Pos field_start_pos = v__token__Token_pos(&p->tok); bool is_field_volatile = false; + bool is_field_deprecated = false; + string field_deprecation_msg = _SLIT(""); + string field_deprecated_after = _SLIT(""); if (p->tok.kind == v__token__Kind__key_volatile) { v__parser__Parser_next(p); is_field_volatile = true; @@ -90768,6 +93263,19 @@ bool v__parser__Parser_struct_decl_defer_0 = false; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t23, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__lsbr) { v__parser__Parser_attributes(p); + for (int _t24 = 0; _t24 < p->attrs.len; ++_t24) { + v__ast__Attr fa = ((v__ast__Attr*)p->attrs.data)[_t24]; + + if (string__eq(fa.name, _SLIT("deprecated"))) { + is_field_deprecated = true; + field_deprecation_msg = fa.arg; + } + else if (string__eq(fa.name, _SLIT("deprecated_after"))) { + field_deprecated_after = fa.arg; + } + else { + }; + } } v__ast__Expr default_expr = v__ast__empty_expr(); bool has_default_expr = false; @@ -90783,12 +93291,14 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } ; has_default_expr = true; - _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t24, Array_v__ast__Comment); + _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t25, Array_v__ast__Comment); } array_push((array*)&ast_fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ .comments = comments, .attrs = p->attrs, .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = field_deprecation_msg, + .deprecated_after = field_deprecated_after, .default_expr = default_expr, .name = field_name, .pos = field_pos, @@ -90801,12 +93311,15 @@ bool v__parser__Parser_struct_decl_defer_0 = false; .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, + .is_deprecated = is_field_deprecated, }) })); } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ .comments = comments, .attrs = p->attrs, .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = field_deprecation_msg, + .deprecated_after = field_deprecated_after, .default_expr = default_expr, .name = field_name, .pos = field_pos, @@ -90819,6 +93332,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, + .is_deprecated = is_field_deprecated, }) })); p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); i++; @@ -90856,17 +93370,6 @@ bool v__parser__Parser_struct_decl_defer_0 = false; }); if (v__ast__Table_has_deep_child_no_ref(p->table, &t, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid recursive struct `"), /*115 &string*/0xfe10, {.d_s = orig_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t27 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); - // Defer begin - if (v__parser__Parser_struct_decl_defer_0) { - v__ast__Table_reset_parsing_type(p->table); - } - // Defer end - return _t27; - } - int ret = v__ast__Table_register_sym(p->table, t); - if (ret == -1 && language != v__ast__Language__c) { - v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); v__ast__StructDecl _t28 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { @@ -90875,8 +93378,19 @@ bool v__parser__Parser_struct_decl_defer_0 = false; // Defer end return _t28; } + int ret = v__ast__Table_register_sym(p->table, t); + if (ret == -1 && language != v__ast__Language__c) { + v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); + v__ast__StructDecl _t29 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); + // Defer begin + if (v__parser__Parser_struct_decl_defer_0) { + v__ast__Table_reset_parsing_type(p->table); + } + // Defer end + return _t29; + } p->expr_mod = _SLIT(""); - v__ast__StructDecl _t29 = ((v__ast__StructDecl){ + v__ast__StructDecl _t30 = ((v__ast__StructDecl){ .generic_types = generic_types, .attrs = attrs, .end_comments = end_comments, @@ -90898,7 +93412,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__ast__Table_reset_parsing_type(p->table); } // Defer end - return _t29; + return _t30; } VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Parser* p, string typ_str, bool short_syntax) { @@ -91022,8 +93536,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13120 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13120.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13775 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13775.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { @@ -91052,7 +93566,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } v__ast__Type typ = v__ast__new_type(reg_idx); v__ast__TypeSymbol* ts = v__ast__Table_sym(p->table, typ); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 478) /*expected idx: 478, name: v.ast.Interface */ ; ts->methods = __new_array_with_default(0, 20, sizeof(v__ast__Fn), 0); Array_v__ast__StructField fields = __new_array_with_default(0, 20, sizeof(v__ast__StructField), 0); Array_v__ast__FnDecl methods = __new_array_with_default(0, 20, sizeof(v__ast__FnDecl), 0); @@ -91118,13 +93632,13 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t8; } - multi_return_Array_v__ast__Param_bool_bool mr_16256 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16256.arg0; - bool is_variadic = mr_16256.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16911 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16911.arg0; + bool is_variadic = mr_16911.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ - .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}, .generic_names = __new_array(0, 0, sizeof(string)), .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .params = args, @@ -91236,6 +93750,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .comments = comments, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .deprecation_msg = (string){.str=(byteptr)"", .is_lit=1}, + .deprecated_after = (string){.str=(byteptr)"", .is_lit=1}, .default_expr = {0}, .name = field_name, .pos = field_pos, @@ -91248,8 +93764,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_mut = 0, .is_global = 0, .is_volatile = 0, + .is_deprecated = 0, }) })); - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,}) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.deprecation_msg = (string){.str=(byteptr)"", .is_lit=1},.deprecated_after = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,}) })); } } Array_v__ast__Type _t15 = {0}; @@ -91701,6 +94218,7 @@ v__builder__Builder v__builder__new_builder(v__pref__Preferences* pref) { .mod_invalidates_paths = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .mod_invalidates_mods = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .path_invalidates_mods = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .crun_cache_keys = __new_array(0, 0, sizeof(string)), }); return _t2; } @@ -93145,6 +95663,17 @@ VV_LOCAL_SYMBOL Array_v__cflag__CFlag v__builder__Builder_get_rest_of_module_cfl // TypeDecl void v__builder__compile(string command, v__pref__Preferences* pref, void (*backend_cb)(v__builder__Builder* b)) { + v__builder__check_if_output_folder_is_writable(pref); + v__builder__Builder b = v__builder__new_builder(pref); + if (v__builder__Builder_should_rebuild(&b)) { + v__builder__Builder_rebuild(&b, (voidptr)backend_cb); + } + v__builder__Builder_exit_on_invalid_syntax(&b); + v__builder__Builder_myfree(&b); + v__builder__Builder_run_compiled_executable_and_exit(&b); +} + +VV_LOCAL_SYMBOL void v__builder__check_if_output_folder_is_writable(v__pref__Preferences* pref) { string odir = os__dir(pref->out_name); string output_folder = odir; if (odir.len == pref->out_name.len) { @@ -93159,54 +95688,6 @@ void v__builder__compile(string command, v__pref__Preferences* pref, void (*back } (*(bool*)_t1.data); - v__builder__Builder b = v__builder__new_builder(pref); - if (pref->is_verbose) { - println(_SLIT("builder.compile() pref:")); - } - time__StopWatch sw = time__new_stopwatch(((time__StopWatchOptions){.auto_start = true,})); - backend_cb((voidptr)&/*qq*/b); - v__util__Timers* timers = v__util__get_timers(); - v__util__Timers_show_remaining(timers); - if (pref->is_stats) { - i64 compilation_time_micros = 1 + time__Duration_microseconds(time__StopWatch_elapsed(sw)); - string scompilation_time_ms = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*102 &f64*/0xc062d, {.d_f64 = ((f64)(compilation_time_micros)) / 1000.0}}, {_SLIT0, 0, { .d_c = 0 }}}))); - int all_v_source_lines = 0; - int all_v_source_bytes = 0; - for (int _t2 = 0; _t2 < b.parsed_files.len; ++_t2) { - v__ast__File* pf = ((v__ast__File**)b.parsed_files.data)[_t2]; - all_v_source_lines += pf->nr_lines; - all_v_source_bytes += pf->nr_bytes; - } - string sall_v_source_lines = int_str(all_v_source_lines); - string sall_v_source_bytes = int_str(all_v_source_bytes); - sall_v_source_lines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_lines}}, {_SLIT0, 0, { .d_c = 0 }}}))); - sall_v_source_bytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_bytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" V source code size: "), /*115 &string*/0xfe10, {.d_s = sall_v_source_lines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sall_v_source_bytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); - string slines = int_str(b.stats_lines); - string sbytes = int_str(b.stats_bytes); - slines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = slines}}, {_SLIT0, 0, { .d_c = 0 }}}))); - sbytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sbytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("generated target code size: "), /*115 &string*/0xfe10, {.d_s = slines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sbytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); - int vlines_per_second = ((int)(1000000.0 * ((f64)(all_v_source_lines)) / ((f64)(compilation_time_micros)))); - string svlines_per_second = v__util__bold(int_str(vlines_per_second)); - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("compilation took: "), /*115 &string*/0xfe10, {.d_s = scompilation_time_ms}}, {_SLIT(" ms, compilation speed: "), /*115 &string*/0xfe10, {.d_s = svlines_per_second}}, {_SLIT(" vlines/s"), 0, { .d_c = 0 }}}))); - } - v__builder__Builder_exit_on_invalid_syntax(&b); - v__builder__Builder_myfree(&b); - if (pref->is_test || pref->is_run) { - v__builder__Builder_run_compiled_executable_and_exit(&b); - } -} - -string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix) { - string vtmp = v__util__get_vtmp_folder(); - string uniq = _SLIT(""); - if (!b->pref->reuse_tmpc) { - uniq = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*117 &u64*/0xfe08, {.d_u64 = rand__u64()}}, {_SLIT0, 0, { .d_c = 0 }}})); - } - string fname = string__plus(os__file_name(os__real_path(base_file_name)), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = uniq}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = postfix}}, {_SLIT0, 0, { .d_c = 0 }}}))); - string _t1 = os__real_path(os__join_path(vtmp, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){fname})))); - return _t1; } // Attr: [unsafe] @@ -93249,67 +95730,65 @@ VV_LOCAL_SYMBOL void v__builder__Builder_run_compiled_executable_and_exit(v__bui _v_panic(_SLIT("Running iOS apps is not supported yet.")); VUNREACHABLE(); } - if (b->pref->is_verbose) { - } - if (b->pref->is_test || b->pref->is_run) { - string compiled_file = os__real_path(b->pref->out_name); - string _t1; /* if prepend */ - if (v__pref__Backend_is_js(b->pref->backend)) { - #if defined(_WIN32) - string node_basename = _SLIT("node.exe"); - #else - #endif - ; -_option_string _t2 = os__find_abs_path_of_executable(node_basename); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - _v_panic(_SLIT("Could not find `node` in system path. Do you have Node.js installed?")); - VUNREACHABLE(); - ; - } - - _t1 = (*(string*)_t2.data); - } else { - _t1 = compiled_file; - } - string run_file = _t1; - Array_string run_args = __new_array_with_default(0, b->pref->run_args.len + 1, sizeof(string), 0); - if (v__pref__Backend_is_js(b->pref->backend)) { - array_push((array*)&run_args, _MOV((string[]){ string_clone(compiled_file) })); - } - _PUSH_MANY(&run_args, (b->pref->run_args), _t4, Array_string); - os__Process* run_process = os__new_process(run_file); - os__Process_set_args(run_process, run_args); - if (b->pref->is_verbose) { - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("running "), /*115 &string*/0xfe10, {.d_s = run_process->filename}}, {_SLIT(" with arguments "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(run_process->args)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - _option_os__SignalHandler _t5 = os__signal_opt(os__Signal__int, (voidptr)v__builder__eshcb); - if (_t5.state != 0) { /*or block*/ - IError err = _t5.err; - v__builder__serror(_SLIT("set .int"), err); - VUNREACHABLE(); - ; - } - - void (*prev_int_handler) (os__Signal ) = (*(os__SignalHandler*)_t5.data); - void (*prev_quit_handler) (os__Signal ) = ((os__SignalHandler)(v__builder__eshcb)); - os__Process_wait(run_process); - _option_os__SignalHandler _t6 = os__signal_opt(os__Signal__int, (voidptr)prev_int_handler); - if (_t6.state != 0) { /*or block*/ - IError err = _t6.err; - v__builder__serror(_SLIT("restore .int"), err); - VUNREACHABLE(); - ; - } - - (*(os__SignalHandler*)_t6.data); - int ret = run_process->code; - os__Process_close(run_process); - v__builder__Builder_cleanup_run_executable_after_exit(b, compiled_file); - _v_exit(ret); + if (!(b->pref->is_test || b->pref->is_run || b->pref->is_crun)) { + _v_exit(0); VUNREACHABLE(); } - _v_exit(0); + string compiled_file = os__real_path(b->pref->out_name); + string _t1; /* if prepend */ + if (v__pref__Backend_is_js(b->pref->backend)) { + #if defined(_WIN32) + string node_basename = _SLIT("node.exe"); + #else + #endif + ; +_option_string _t2 = os__find_abs_path_of_executable(node_basename); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + _v_panic(_SLIT("Could not find `node` in system path. Do you have Node.js installed?")); + VUNREACHABLE(); + ; + } + + _t1 = (*(string*)_t2.data); + } else { + _t1 = compiled_file; + } + string run_file = _t1; + Array_string run_args = __new_array_with_default(0, b->pref->run_args.len + 1, sizeof(string), 0); + if (v__pref__Backend_is_js(b->pref->backend)) { + array_push((array*)&run_args, _MOV((string[]){ string_clone(compiled_file) })); + } + _PUSH_MANY(&run_args, (b->pref->run_args), _t4, Array_string); + os__Process* run_process = os__new_process(run_file); + os__Process_set_args(run_process, run_args); + if (b->pref->is_verbose) { + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("running "), /*115 &string*/0xfe10, {.d_s = run_process->filename}}, {_SLIT(" with arguments "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(run_process->args)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + _option_os__SignalHandler _t5 = os__signal_opt(os__Signal__int, (voidptr)v__builder__eshcb); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; + v__builder__serror(_SLIT("set .int"), err); + VUNREACHABLE(); + ; + } + + void (*prev_int_handler) (os__Signal ) = (*(os__SignalHandler*)_t5.data); + void (*prev_quit_handler) (os__Signal ) = ((os__SignalHandler)(v__builder__eshcb)); + os__Process_wait(run_process); + _option_os__SignalHandler _t6 = os__signal_opt(os__Signal__int, (voidptr)prev_int_handler); + if (_t6.state != 0) { /*or block*/ + IError err = _t6.err; + v__builder__serror(_SLIT("restore .int"), err); + VUNREACHABLE(); + ; + } + + (*(os__SignalHandler*)_t6.data); + int ret = run_process->code; + os__Process_close(run_process); + v__builder__Builder_cleanup_run_executable_after_exit(b, compiled_file); + _v_exit(ret); VUNREACHABLE(); } @@ -93325,6 +95804,9 @@ VNORETURN VV_LOCAL_SYMBOL void v__builder__serror(string reason, IError e) { } VV_LOCAL_SYMBOL void v__builder__Builder_cleanup_run_executable_after_exit(v__builder__Builder* v, string exefile) { + if (v->pref->is_crun) { + return; + } if (v->pref->reuse_tmpc) { v__pref__Preferences_vrun_elog(v->pref, str_intp(2, _MOV((StrIntpData[]){{_SLIT("keeping executable: "), /*115 &string*/0xfe10, {.d_s = exefile}}, {_SLIT(" , because -keepc was passed"), 0, { .d_c = 0 }}}))); return; @@ -94044,12 +96526,6 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (!b->pref->use_cache || b->pref->build_mode == v__pref__BuildMode__build_module) { return; } - v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); - Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) - ; - Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) - ; - strings__Builder sb_new_hashes = strings__new_builder(1024); Array_string _t1 = {0}; Array_v__ast__File_ptr _t1_orig = b->parsed_files; int _t1_len = _t1_orig.len; @@ -94061,17 +96537,34 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { array_push((array*)&_t1, &ti); } Array_string all_files =_t1; + Array_string invalidations = v__builder__Builder_find_invalidated_modules_by_files(b, all_files); + if (invalidations.len > 0) { + string vexe = v__pref__vexe_path(); + for (int _t3 = 0; _t3 < invalidations.len; ++_t3) { + string imp = ((string*)invalidations.data)[_t3]; + v__builder__Builder_v_build_module(b, vexe, imp); + } + } +} + +Array_string v__builder__Builder_find_invalidated_modules_by_files(v__builder__Builder* b, Array_string all_files) { + v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + strings__Builder sb_new_hashes = strings__new_builder(1024); v__vcache__CacheManager cm = v__vcache__new_cache_manager(all_files); - _option_string _t3 = v__vcache__CacheManager_load(&cm, _SLIT(".hashes"), _SLIT("all_files")); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - *(string*) _t3.data = _SLIT(" "); + _option_string _t1 = v__vcache__CacheManager_load(&cm, _SLIT(".hashes"), _SLIT("all_files")); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + *(string*) _t1.data = _SLIT(" "); } - string sold_hashes = (*(string*)_t3.data); + string sold_hashes = (*(string*)_t1.data); Array_string sold_hashes_lines = string_split(sold_hashes, _SLIT("\n")); - for (int _t4 = 0; _t4 < sold_hashes_lines.len; ++_t4) { - string line = ((string*)sold_hashes_lines.data)[_t4]; + for (int _t2 = 0; _t2 < sold_hashes_lines.len; ++_t2) { + string line = ((string*)sold_hashes_lines.data)[_t2]; if (line.len == 0) { continue; } @@ -94080,16 +96573,15 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { string cpath = (*(string*)/*ee elem_sym */array_get(x, 1)); map_set(&old_hashes, &(string[]){cpath}, &(string[]) { chash }); } - for (int _t5 = 0; _t5 < b->parsed_files.len; ++_t5) { - v__ast__File* p = ((v__ast__File**)b->parsed_files.data)[_t5]; - string cpath = p->path; - _option_string _t6 = v__util__read_file(cpath); - if (_t6.state != 0) { /*or block*/ - IError err = _t6.err; - *(string*) _t6.data = _SLIT(""); + for (int _t3 = 0; _t3 < all_files.len; ++_t3) { + string cpath = ((string*)all_files.data)[_t3]; + _option_string _t4 = v__util__read_file(cpath); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(string*) _t4.data = _SLIT(""); } - string ccontent = (*(string*)_t6.data); + string ccontent = (*(string*)_t4.data); string chash = u64_hex_full(hash__sum64_string(ccontent, 7U)); map_set(&new_hashes, &(string[]){cpath}, &(string[]) { chash }); strings__Builder_write_string(&sb_new_hashes, chash); @@ -94098,31 +96590,32 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { strings__Builder_write_u8(&sb_new_hashes, '\n'); } string snew_hashes = strings__Builder_str(&sb_new_hashes); - _option_string _t7 = v__vcache__CacheManager_save(&cm, _SLIT(".hashes"), _SLIT("all_files"), snew_hashes); - if (_t7.state != 0) { /*or block*/ - IError err = _t7.err; + _option_string _t5 = v__vcache__CacheManager_save(&cm, _SLIT(".hashes"), _SLIT("all_files"), snew_hashes); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; } - (*(string*)_t7.data); - v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + (*(string*)_t5.data); + v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); + Array_string invalidations = __new_array_with_default(0, 0, sizeof(string), 0); if (!Map_string_string_map_eq(new_hashes, old_hashes)) { - v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); + v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); Map_string_int invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t9 = new_hashes.key_values.len; - for (int _t8 = 0; _t8 < _t9; ++_t8 ) { - int _t10 = new_hashes.key_values.len - _t9; - _t9 = new_hashes.key_values.len; - if (_t10 < 0) { - _t8 = -1; + int _t7 = new_hashes.key_values.len; + for (int _t6 = 0; _t6 < _t7; ++_t6 ) { + int _t8 = new_hashes.key_values.len - _t7; + _t7 = new_hashes.key_values.len; + if (_t8 < 0) { + _t6 = -1; continue; } - if (!DenseArray_has_index(&new_hashes.key_values, _t8)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t8); + if (!DenseArray_has_index(&new_hashes.key_values, _t6)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t6); npath = string_clone(npath); - string nhash = (*(string*)DenseArray_value(&new_hashes.key_values, _t8)); + string nhash = (*(string*)DenseArray_value(&new_hashes.key_values, _t6)); if (!_IN_MAP(ADDR(string, npath), ADDR(map, old_hashes))) { (*(int*)map_get_and_set((map*)&invalidated_paths, &(string[]){npath}, &(int[]){ 0 }))++; continue; @@ -94132,18 +96625,18 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { continue; } } - int _t12 = old_hashes.key_values.len; - for (int _t11 = 0; _t11 < _t12; ++_t11 ) { - int _t13 = old_hashes.key_values.len - _t12; - _t12 = old_hashes.key_values.len; - if (_t13 < 0) { - _t11 = -1; + int _t10 = old_hashes.key_values.len; + for (int _t9 = 0; _t9 < _t10; ++_t9 ) { + int _t11 = old_hashes.key_values.len - _t10; + _t10 = old_hashes.key_values.len; + if (_t11 < 0) { + _t9 = -1; continue; } - if (!DenseArray_has_index(&old_hashes.key_values, _t11)) {continue;} - string opath = /*key*/ *(string*)DenseArray_key(&old_hashes.key_values, _t11); + if (!DenseArray_has_index(&old_hashes.key_values, _t9)) {continue;} + string opath = /*key*/ *(string*)DenseArray_key(&old_hashes.key_values, _t9); opath = string_clone(opath); - string ohash = (*(string*)DenseArray_value(&old_hashes.key_values, _t11)); + string ohash = (*(string*)DenseArray_value(&old_hashes.key_values, _t9)); if (!_IN_MAP(ADDR(string, opath), ADDR(map, new_hashes))) { (*(int*)map_get_and_set((map*)&invalidated_paths, &(string[]){opath}, &(int[]){ 0 }))++; continue; @@ -94157,16 +96650,16 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { for (int cycle = 0; true; cycle++) { Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t15 = invalidated_paths.key_values.len; - for (int _t14 = 0; _t14 < _t15; ++_t14 ) { - int _t16 = invalidated_paths.key_values.len - _t15; - _t15 = invalidated_paths.key_values.len; - if (_t16 < 0) { - _t14 = -1; + int _t13 = invalidated_paths.key_values.len; + for (int _t12 = 0; _t12 < _t13; ++_t12 ) { + int _t14 = invalidated_paths.key_values.len - _t13; + _t13 = invalidated_paths.key_values.len; + if (_t14 < 0) { + _t12 = -1; continue; } - if (!DenseArray_has_index(&invalidated_paths.key_values, _t14)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&invalidated_paths.key_values, _t14); + if (!DenseArray_has_index(&invalidated_paths.key_values, _t12)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&invalidated_paths.key_values, _t12); npath = string_clone(npath); Array_string invalidated_mods = (*(Array_string*)map_get(ADDR(map, b->path_invalidates_mods), &(string[]){npath}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); if (Array_string_arr_eq(invalidated_mods, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("main")})))) { @@ -94176,14 +96669,14 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { rebuild_everything = true; break; } - for (int _t17 = 0; _t17 < invalidated_mods.len; ++_t17) { - string imod = ((string*)invalidated_mods.data)[_t17]; + for (int _t15 = 0; _t15 < invalidated_mods.len; ++_t15) { + string imod = ((string*)invalidated_mods.data)[_t15]; if (string__eq(imod, _SLIT("main"))) { continue; } - Array_string _t18 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_paths), &(string[]){imod}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); - for (int _t19 = 0; _t19 < _t18.len; ++_t19) { - string np = ((string*)_t18.data)[_t19]; + Array_string _t16 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_paths), &(string[]){imod}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); + for (int _t17 = 0; _t17 < _t16.len; ++_t17) { + string np = ((string*)_t16.data)[_t17]; (*(int*)map_get_and_set((map*)&new_invalidated_paths, &(string[]){np}, &(int[]){ 0 }))++; } } @@ -94201,16 +96694,16 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (rebuild_everything) { invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) ; - int _t21 = new_hashes.key_values.len; - for (int _t20 = 0; _t20 < _t21; ++_t20 ) { - int _t22 = new_hashes.key_values.len - _t21; - _t21 = new_hashes.key_values.len; - if (_t22 < 0) { - _t20 = -1; + int _t19 = new_hashes.key_values.len; + for (int _t18 = 0; _t18 < _t19; ++_t18 ) { + int _t20 = new_hashes.key_values.len - _t19; + _t19 = new_hashes.key_values.len; + if (_t20 < 0) { + _t18 = -1; continue; } - if (!DenseArray_has_index(&new_hashes.key_values, _t20)) {continue;} - string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t20); + if (!DenseArray_has_index(&new_hashes.key_values, _t18)) {continue;} + string npath = /*key*/ *(string*)DenseArray_key(&new_hashes.key_values, _t18); npath = string_clone(npath); string mpath = os__dir(npath); Array_string pimods = (*(Array_string*)map_get(ADDR(map, b->path_invalidates_mods), &(string[]){npath}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); @@ -94222,14 +96715,15 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { } if (invalidated_mod_paths.len > 0) { Array_string impaths = map_keys(&invalidated_mod_paths); - string vexe = v__pref__vexe_path(); - for (int _t23 = 0; _t23 < impaths.len; ++_t23) { - string imp = ((string*)impaths.data)[_t23]; - v__builder__Builder_v_build_module(b, vexe, imp); + for (int _t21 = 0; _t21 < impaths.len; ++_t21) { + string imp = ((string*)impaths.data)[_t21]; + array_push((array*)&invalidations, _MOV((string[]){ string_clone(imp) })); } } - v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); + v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.find_invalidated_modules_by_files")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); } + Array_string _t23 = invalidations; + return _t23; } VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path) { @@ -94313,7 +96807,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, for (int _t6 = 0; _t6 < ast_file->imports.len; ++_t6) { v__ast__Import imp_stmt = ((v__ast__Import*)ast_file->imports.data)[_t6]; string imp = imp_stmt.mod; - if (string__eq(imp, _SLIT("strconv")) || string__eq(imp, _SLIT("strings")) || string__eq(imp, _SLIT("dlmalloc"))) { + if (v__util__module_is_builtin(imp)) { continue; } if (Array_string_contains(built_modules, imp)) { @@ -94342,6 +96836,146 @@ VV_LOCAL_SYMBOL void v__builder__Builder_handle_usecache(v__builder__Builder* b, _PUSH_MANY(&b->ccoptions.post_args, (libs), _t10, Array_string); } +bool v__builder__Builder_should_rebuild(v__builder__Builder* b) { + string exe_name = b->pref->out_name; + exe_name = string__plus(exe_name, _SLIT(".exe")); + if (!os__is_file(exe_name)) { + bool _t1 = true; + return _t1; + } + if (!b->pref->is_crun) { + bool _t2 = true; + return _t2; + } + Array_string v_program_files = __new_array_with_default(0, 0, sizeof(string), 0); + bool is_file = os__is_file(b->pref->path); + bool is_dir = os__is_dir(b->pref->path); + if (is_file) { + array_push((array*)&v_program_files, _MOV((string[]){ string_clone(b->pref->path) })); + } else if (is_dir) { + _PUSH_MANY(&v_program_files, (v__builder__Builder_v_files_from_dir(b, b->pref->path)), _t4, Array_string); + } + qsort(v_program_files.data, v_program_files.len, v_program_files.element_size, (int (*)(const void *, const void *))&compare_14016397514164073915_string); + b->crun_cache_keys = v_program_files; + array_push((array*)&b->crun_cache_keys, _MOV((string[]){ string_clone(exe_name) })); + i64 exe_stamp = os__file_last_mod_unix(exe_name); + i64 source_stamp = v__builder__most_recent_timestamp(v_program_files); + if (exe_stamp <= source_stamp) { + bool _t6 = true; + return _t6; + } + v__vcache__CacheManager cm = v__vcache__new_cache_manager(b->crun_cache_keys); + _option_string _t7 = v__vcache__CacheManager_load(&cm, _SLIT(".build_options"), _SLIT(".crun")); + if (_t7.state != 0) { /*or block*/ + IError err = _t7.err; + bool _t8 = true; + return _t8; + } + + string sbuild_options = (*(string*)_t7.data); + if (!string__eq(sbuild_options, Array_string_join(b->pref->build_options, _SLIT("\n")))) { + bool _t9 = true; + return _t9; + } + _option_string _t10 = v__vcache__CacheManager_load(&cm, _SLIT(".dependencies"), _SLIT(".crun")); + if (_t10.state != 0) { /*or block*/ + IError err = _t10.err; + bool _t11 = true; + return _t11; + } + + string sdependencies = (*(string*)_t10.data); + Array_string dependencies = string_split(sdependencies, _SLIT("\n")); + i64 dependencies_stamp = v__builder__most_recent_timestamp(dependencies); + if (dependencies_stamp < exe_stamp) { + bool _t12 = false; + return _t12; + } + bool _t13 = true; + return _t13; +} + +VV_LOCAL_SYMBOL i64 v__builder__most_recent_timestamp(Array_string files) { + i64 res = ((i64)(0)); + for (int _t1 = 0; _t1 < files.len; ++_t1) { + string f = ((string*)files.data)[_t1]; + i64 f_stamp = os__file_last_mod_unix(f); + if (res <= f_stamp) { + res = f_stamp; + } + } + i64 _t2 = res; + return _t2; +} + +void v__builder__Builder_rebuild(v__builder__Builder* b, void (*backend_cb)(v__builder__Builder* b)) { + time__StopWatch sw = time__new_stopwatch(((time__StopWatchOptions){.auto_start = true,})); + backend_cb(b); + if (b->pref->is_crun) { + v__vcache__CacheManager cm = v__vcache__new_cache_manager(b->crun_cache_keys); + Array_string _t1 = {0}; + Array_v__ast__File_ptr _t1_orig = b->parsed_files; + int _t1_len = _t1_orig.len; + _t1 = __new_array(0, _t1_len, sizeof(string)); + + for (int _t2 = 0; _t2 < _t1_len; ++_t2) { + v__ast__File* it = ((v__ast__File**) _t1_orig.data)[_t2]; + string ti = it->path; + array_push((array*)&_t1, &ti); + } + Array_string dependency_files =_t1; + _option_string _t3 = v__vcache__CacheManager_save(&cm, _SLIT(".dependencies"), _SLIT(".crun"), Array_string_join(dependency_files, _SLIT("\n"))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + } + + (*(string*)_t3.data); + _option_string _t4 = v__vcache__CacheManager_save(&cm, _SLIT(".build_options"), _SLIT(".crun"), Array_string_join(b->pref->build_options, _SLIT("\n"))); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + } + + (*(string*)_t4.data); + } + v__util__Timers* timers = v__util__get_timers(); + v__util__Timers_show_remaining(timers); + if (b->pref->is_stats) { + i64 compilation_time_micros = 1 + time__Duration_microseconds(time__StopWatch_elapsed(sw)); + string scompilation_time_ms = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*102 &f64*/0xc062d, {.d_f64 = ((f64)(compilation_time_micros)) / 1000.0}}, {_SLIT0, 0, { .d_c = 0 }}}))); + int all_v_source_lines = 0; + int all_v_source_bytes = 0; + for (int _t5 = 0; _t5 < b->parsed_files.len; ++_t5) { + v__ast__File* pf = ((v__ast__File**)b->parsed_files.data)[_t5]; + all_v_source_lines += pf->nr_lines; + all_v_source_bytes += pf->nr_bytes; + } + string sall_v_source_lines = int_str(all_v_source_lines); + string sall_v_source_bytes = int_str(all_v_source_bytes); + sall_v_source_lines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_lines}}, {_SLIT0, 0, { .d_c = 0 }}}))); + sall_v_source_bytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sall_v_source_bytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" V source code size: "), /*115 &string*/0xfe10, {.d_s = sall_v_source_lines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sall_v_source_bytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); + string slines = int_str(b->stats_lines); + string sbytes = int_str(b->stats_bytes); + slines = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = slines}}, {_SLIT0, 0, { .d_c = 0 }}}))); + sbytes = v__util__bold( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0x14fe30, {.d_s = sbytes}}, {_SLIT0, 0, { .d_c = 0 }}}))); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("generated target code size: "), /*115 &string*/0xfe10, {.d_s = slines}}, {_SLIT(" lines, "), /*115 &string*/0xfe10, {.d_s = sbytes}}, {_SLIT(" bytes"), 0, { .d_c = 0 }}}))); + int vlines_per_second = ((int)(1000000.0 * ((f64)(all_v_source_lines)) / ((f64)(compilation_time_micros)))); + string svlines_per_second = v__util__bold(int_str(vlines_per_second)); + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("compilation took: "), /*115 &string*/0xfe10, {.d_s = scompilation_time_ms}}, {_SLIT(" ms, compilation speed: "), /*115 &string*/0xfe10, {.d_s = svlines_per_second}}, {_SLIT(" vlines/s"), 0, { .d_c = 0 }}}))); + } +} + +string v__builder__Builder_get_vtmp_filename(v__builder__Builder* b, string base_file_name, string postfix) { + string vtmp = v__util__get_vtmp_folder(); + string uniq = _SLIT(""); + if (!b->pref->reuse_tmpc) { + uniq = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*117 &u64*/0xfe08, {.d_u64 = rand__u64()}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + string fname = string__plus(os__file_name(os__real_path(base_file_name)), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = uniq}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = postfix}}, {_SLIT0, 0, { .d_c = 0 }}}))); + string _t1 = os__real_path(os__join_path(vtmp, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){fname})))); + return _t1; +} + void v__builder__cbuilder__start(void) { Array_string _t1; Array_string args_and_flags = (_t1 = v__util__join_env_vflags_and_os_args(), array_slice(_t1, 1, _t1.len)); @@ -94472,9 +97106,27 @@ v__util__Timers* timers; return; } - if (string__eq(command, _SLIT("help"))) { + if (string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("crun")) || string__eq(command, _SLIT("build")) || string__eq(command, _SLIT("build-module"))) { + main__rebuild(prefs); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); + } + // Defer end + return; + } + else if (string__eq(command, _SLIT("help"))) { main__invoke_help_and_exit(args); } + else if (string__eq(command, _SLIT("version"))) { + println(v__util__version__full_v_version(prefs->is_verbose)); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); + } + // Defer end + return; + } else if (string__eq(command, _SLIT("new")) || string__eq(command, _SLIT("init"))) { Array_string _t7; v__util__launch_tool(prefs->is_verbose, _SLIT("vcreate"), (_t7 = _const_os__args, array_slice(_t7, 1, _t7.len))); @@ -94486,11 +97138,6 @@ v__util__Timers* timers; // Defer end return; } - else if (string__eq(command, _SLIT("translate"))) { - eprintln(_SLIT("Translating C to V will be available in V 0.3")); - _v_exit(1); - VUNREACHABLE(); - } else if (string__eq(command, _SLIT("install")) || string__eq(command, _SLIT("list")) || string__eq(command, _SLIT("outdated")) || string__eq(command, _SLIT("remove")) || string__eq(command, _SLIT("search")) || string__eq(command, _SLIT("show")) || string__eq(command, _SLIT("update")) || string__eq(command, _SLIT("upgrade"))) { Array_string _t8; v__util__launch_tool(prefs->is_verbose, _SLIT("vpm"), (_t8 = _const_os__args, array_slice(_t8, 1, _t8.len))); @@ -94516,48 +97163,27 @@ v__util__Timers* timers; _v_exit(1); VUNREACHABLE(); } - else if (string__eq(command, _SLIT("version"))) { - println(v__util__version__full_v_version(prefs->is_verbose)); - // Defer begin - if (main__main_defer_0) { - v__util__Timers_show(timers, _SLIT("v total")); - } - // Defer end - return; + else if (string__eq(command, _SLIT("translate"))) { + eprintln(_SLIT("Translating C to V will be available in V 0.3")); + _v_exit(1); + VUNREACHABLE(); } else { + if (string_ends_with(command, _SLIT(".v")) || os__exists(command)) { + main__rebuild(prefs); + // Defer begin + if (main__main_defer_0) { + v__util__Timers_show(timers, _SLIT("v total")); + } + // Defer end + return; + } }; - if ((string__eq(command, _SLIT("run")) || string__eq(command, _SLIT("build")) || string__eq(command, _SLIT("build-module"))) || string_ends_with(command, _SLIT(".v")) || os__exists(command)) { - - if (prefs->backend == (v__pref__Backend__c)) { - v__builder__compile(_SLIT("build"), prefs, (voidptr)v__builder__cbuilder__compile_c); - } - else if (prefs->backend == (v__pref__Backend__js_node) || prefs->backend == (v__pref__Backend__js_freestanding) || prefs->backend == (v__pref__Backend__js_browser)) { - Array_string _t10; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/js_builder"), (_t10 = _const_os__args, array_slice(_t10, 1, _t10.len))); - VUNREACHABLE(); - } - else if (prefs->backend == (v__pref__Backend__native)) { - Array_string _t11; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/native_builder"), (_t11 = _const_os__args, array_slice(_t11, 1, _t11.len))); - VUNREACHABLE(); - } - else if (prefs->backend == (v__pref__Backend__interpret)) { - Array_string _t12; - v__util__launch_tool(prefs->is_verbose, _SLIT("builders/interpret_builder"), (_t12 = _const_os__args, array_slice(_t12, 1, _t12.len))); - VUNREACHABLE(); - }; - // Defer begin - if (main__main_defer_0) { - v__util__Timers_show(timers, _SLIT("v total")); - } - // Defer end - return; - } if (prefs->is_help) { main__invoke_help_and_exit(args); } - eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("v "), /*115 &string*/0xfe10, {.d_s = command}}, {_SLIT(": unknown command\nRun "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(" for usage."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("v "), /*115 &string*/0xfe10, {.d_s = command}}, {_SLIT(": unknown command"), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Run "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(" for usage."), 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); } @@ -94572,32 +97198,54 @@ VV_LOCAL_SYMBOL void main__invoke_help_and_exit(Array_string remaining) { } else { }; - println( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(": provide only one help topic."), 0, { .d_c = 0 }}}))); - println( str_intp(2, _MOV((StrIntpData[]){{_SLIT("For usage information, use "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT(": provide only one help topic."), 0, { .d_c = 0 }}}))); + eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("For usage information, use "), /*115 &string*/0xfe10, {.d_s = term__highlight_command(_SLIT("v help"))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); } +VV_LOCAL_SYMBOL void main__rebuild(v__pref__Preferences* prefs) { + + if (prefs->backend == (v__pref__Backend__c)) { + v__builder__compile(_SLIT("build"), prefs, (voidptr)v__builder__cbuilder__compile_c); + } + else if (prefs->backend == (v__pref__Backend__js_node) || prefs->backend == (v__pref__Backend__js_freestanding) || prefs->backend == (v__pref__Backend__js_browser)) { + Array_string _t1; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/js_builder"), (_t1 = _const_os__args, array_slice(_t1, 1, _t1.len))); + VUNREACHABLE(); + } + else if (prefs->backend == (v__pref__Backend__native)) { + Array_string _t2; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/native_builder"), (_t2 = _const_os__args, array_slice(_t2, 1, _t2.len))); + VUNREACHABLE(); + } + else if (prefs->backend == (v__pref__Backend__interpret)) { + Array_string _t3; + v__util__launch_tool(prefs->is_verbose, _SLIT("builders/interpret_builder"), (_t3 = _const_os__args, array_slice(_t3, 1, _t3.len))); + VUNREACHABLE(); + }; +} + void _vinit(int ___argc, voidptr ___argv) { #if __STDC_HOSTED__ == 1 signal(11, v_segmentation_fault_handler); #endif as_cast_type_indexes = new_array_from_c_array(102, 102, sizeof(VCastTypeIndexName), _MOV((VCastTypeIndexName[102]){ (VCastTypeIndexName){.tindex = 0, .tname = _SLIT("unknown")} - , (VCastTypeIndexName){.tindex = 472, .tname = _SLIT("v.ast.Aggregate")} - , (VCastTypeIndexName){.tindex = 474, .tname = _SLIT("v.ast.Alias")} + , (VCastTypeIndexName){.tindex = 473, .tname = _SLIT("v.ast.Aggregate")} + , (VCastTypeIndexName){.tindex = 475, .tname = _SLIT("v.ast.Alias")} , (VCastTypeIndexName){.tindex = 454, .tname = _SLIT("v.ast.Array")} - , (VCastTypeIndexName){.tindex = 482, .tname = _SLIT("v.ast.ArrayFixed")} - , (VCastTypeIndexName){.tindex = 483, .tname = _SLIT("v.ast.Chan")} - , (VCastTypeIndexName){.tindex = 488, .tname = _SLIT("v.ast.Enum")} - , (VCastTypeIndexName){.tindex = 486, .tname = _SLIT("v.ast.FnType")} - , (VCastTypeIndexName){.tindex = 487, .tname = _SLIT("v.ast.GenericInst")} - , (VCastTypeIndexName){.tindex = 477, .tname = _SLIT("v.ast.Interface")} + , (VCastTypeIndexName){.tindex = 483, .tname = _SLIT("v.ast.ArrayFixed")} + , (VCastTypeIndexName){.tindex = 484, .tname = _SLIT("v.ast.Chan")} + , (VCastTypeIndexName){.tindex = 489, .tname = _SLIT("v.ast.Enum")} + , (VCastTypeIndexName){.tindex = 487, .tname = _SLIT("v.ast.FnType")} + , (VCastTypeIndexName){.tindex = 488, .tname = _SLIT("v.ast.GenericInst")} + , (VCastTypeIndexName){.tindex = 478, .tname = _SLIT("v.ast.Interface")} , (VCastTypeIndexName){.tindex = 455, .tname = _SLIT("v.ast.Map")} - , (VCastTypeIndexName){.tindex = 485, .tname = _SLIT("v.ast.MultiReturn")} + , (VCastTypeIndexName){.tindex = 486, .tname = _SLIT("v.ast.MultiReturn")} , (VCastTypeIndexName){.tindex = 459, .tname = _SLIT("v.ast.Struct")} - , (VCastTypeIndexName){.tindex = 478, .tname = _SLIT("v.ast.SumType")} - , (VCastTypeIndexName){.tindex = 484, .tname = _SLIT("v.ast.Thread")} + , (VCastTypeIndexName){.tindex = 479, .tname = _SLIT("v.ast.SumType")} + , (VCastTypeIndexName){.tindex = 485, .tname = _SLIT("v.ast.Thread")} , (VCastTypeIndexName){.tindex = 418, .tname = _SLIT("v.ast.IdentFn")} , (VCastTypeIndexName){.tindex = 419, .tname = _SLIT("v.ast.IdentVar")} , (VCastTypeIndexName){.tindex = 287, .tname = _SLIT("v.ast.AnonFn")} @@ -95182,7 +97830,6 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__util__const_tabs = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT(""), _SLIT("\t"), _SLIT("\t\t"), _SLIT("\t\t\t"), _SLIT("\t\t\t\t"), _SLIT("\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t\t")})); - _const_v__util__builtin_module_names = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("builtin"), _SLIT("strconv"), _SLIT("strings"), _SLIT("dlmalloc"), _SLIT("math")})); lines_cache = ((v__util__LinesCache*)memdup(&(v__util__LinesCache){.lines = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__util__LinesCache))); // 3global g_timers = v__util__new_timers(((v__util__TimerParams){.should_print = false,.label = _SLIT("g_timers"),})); // 3global } @@ -95453,7 +98100,7 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), string_clone(_const_v__gen__c__option_name), string_clone(_const_v__gen__c__result_name)})); - _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #ifdef V_USE_SIGNAL_H\n #include // signal and SIGSEGV for segmentation fault handler\n #endif\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); _const_v__gen__c__skip_struct_init = new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("struct stat"), _SLIT("struct addrinfo")})); }