diff --git a/v.c b/v.c index a2ba69e..dbe7e5a 100644 --- a/v.c +++ b/v.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "398db2138" +#define V_COMMIT_HASH "460c2ee77" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "88d69dca7" + #define V_COMMIT_HASH "398db2138" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "398db21" + #define V_CURRENT_COMMIT_HASH "460c2ee" #endif #define V_USE_SIGNAL_H @@ -322,6 +322,7 @@ typedef struct v__markused__Walker v__markused__Walker; typedef struct v__gen__c__UnsupportedAssertCtempTransform v__gen__c__UnsupportedAssertCtempTransform; typedef struct v__gen__c__StrType v__gen__c__StrType; typedef struct v__gen__c__Gen v__gen__c__Gen; +typedef struct v__gen__c__GlobalConstDef v__gen__c__GlobalConstDef; typedef struct v__gen__c__SumtypeCastingFn v__gen__c__SumtypeCastingFn; typedef struct v__gen__c__GenSafeIntegerCfg v__gen__c__GenSafeIntegerCfg; typedef struct v__gen__c__ProfileCounterMeta v__gen__c__ProfileCounterMeta; @@ -400,6 +401,7 @@ typedef struct _option_Array_v__ast__Type _option_Array_v__ast__Type; typedef struct _option_v__ast__ConstField _option_v__ast__ConstField; typedef struct _option_v__ast__GlobalField _option_v__ast__GlobalField; typedef struct _option_v__ast__FnDecl _option_v__ast__FnDecl; +typedef struct _option_v__gen__c__GlobalConstDef _option_v__gen__c__GlobalConstDef; typedef struct _option_v__ast__Stmt_ptr _option_v__ast__Stmt_ptr; typedef struct _option_v__scanner__Scanner_ptr _option_v__scanner__Scanner_ptr; typedef struct _option_v__builder__MsvcResult _option_v__builder__MsvcResult; @@ -2935,7 +2937,9 @@ typedef map Map_string_v__ast__FnDecl; typedef map Map_string_v__ast__ConstField; typedef map Map_string_v__ast__GlobalField; typedef array Array_v__depgraph__DepGraphNode; +typedef map Map_string_i64; typedef map Map_string_strings__Builder; +typedef map Map_string_v__gen__c__GlobalConstDef; typedef map Map_string_v__ast__Stmt_ptr; typedef array Array_v__gen__c__StrType; typedef array Array_v__gen__c__SumtypeCastingFn; @@ -3922,6 +3926,7 @@ struct v__builder__CcompilerOptions { struct v__depgraph__DepGraph { bool acyclic; Array_v__depgraph__DepGraphNode nodes; + Map_string_i64 values; }; @@ -4353,6 +4358,7 @@ struct v__markused__Walker { struct v__depgraph__DepGraphNode { string name; + i64 value; Array_string deps; }; @@ -4412,6 +4418,16 @@ struct v__gen__c__StrType { +struct v__gen__c__GlobalConstDef { + string mod; + string def; + string init; + Array_string dep_names; + int order; +}; + + + struct v__gen__c__SumtypeCastingFn { string fn_name; v__ast__Type got; @@ -5152,6 +5168,7 @@ struct v__ast__ParExpr { struct v__ast__PostfixExpr { v__token__Kind op; v__token__Pos pos; + bool is_c2v_prefix; v__ast__Expr expr; string auto_locked; }; @@ -5836,6 +5853,7 @@ struct v__ast__IfGuardVar { struct v__ast__Fn { Array_v__ast__Param params; Array_string generic_names; + Array_string dep_names; Array_v__ast__Attr attrs; string mod; string file; @@ -5907,6 +5925,7 @@ struct v__parser__Parser { bool inside_vlib_file : 1; bool inside_test_file : 1; bool inside_if : 1; + bool inside_comptime_if : 1; bool inside_if_expr : 1; bool inside_if_cond : 1; bool inside_ct_if_expr : 1; @@ -6299,14 +6318,9 @@ struct v__gen__c__Gen { strings__Builder hotcode_definitions; strings__Builder channel_definitions; strings__Builder comptime_definitions; - Map_string_strings__Builder global_inits; - strings__Builder global_init; - Map_string_strings__Builder inits; - strings__Builder init; strings__Builder cleanup; Map_string_strings__Builder cleanups; strings__Builder gowrappers; - strings__Builder stringliterals; strings__Builder auto_str_funcs; strings__Builder dump_funcs; strings__Builder pcs_declarations; @@ -6317,6 +6331,8 @@ struct v__gen__c__Gen { strings__Builder out_results; strings__Builder json_forward_decls; strings__Builder sql_buf; + Map_string_v__gen__c__GlobalConstDef global_const_defs; + Array_string sorted_global_const_names; v__ast__File* file; u64 unique_file_path_hash; v__ast__FnDecl* fn_decl; @@ -6439,6 +6455,7 @@ struct v__gen__c__Gen { Map_int_bool generated_free_methods; Array_string autofree_scope_stmts; bool use_segfault_handler; + Array_string test_function_names; }; @@ -7172,6 +7189,12 @@ struct _option_v__ast__FnDecl { byte data[sizeof(v__ast__FnDecl) > 0 ? sizeof(v__ast__FnDecl) : 1]; }; +struct _option_v__gen__c__GlobalConstDef { + byte state; + IError err; + byte data[sizeof(v__gen__c__GlobalConstDef) > 0 ? sizeof(v__gen__c__GlobalConstDef) : 1]; +}; + struct _option_v__ast__Stmt_ptr { byte state; IError err; @@ -7246,17 +7269,6 @@ string strings__find_between_pair_u8(string input, u8 start, u8 end); string strings__find_between_pair_rune(string input, rune start, rune end); string strings__find_between_pair_string(string input, string start, string end); Array_string strings__split_capital(string s); -u32 _const_math__bits__de_bruijn32 = 125613361; // precomputed -Array_u8 _const_math__bits__de_bruijn32tab; // inited later -u64 _const_math__bits__de_bruijn64 = 285870213051353865U; // precomputed -Array_u8 _const_math__bits__de_bruijn64tab; // inited later -u64 _const_math__bits__m0 = 6148914691236517205U; // precomputed -u64 _const_math__bits__m1 = 3689348814741910323U; // precomputed -u64 _const_math__bits__m2 = 1085102592571150095U; // precomputed -u64 _const_math__bits__m3 = 71777214294589695U; // precomputed -u64 _const_math__bits__m4 = 281470681808895U; // precomputed -u32 _const_math__bits__max_u32 = 4294967295; // precomputed -u64 _const_math__bits__max_u64 = 18446744073709551615U; // precomputed int math__bits__leading_zeros_8(u8 x); int math__bits__leading_zeros_16(u16 x); int math__bits__leading_zeros_32(u32 x); @@ -7269,10 +7281,6 @@ 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); @@ -7292,10 +7300,6 @@ multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry); multi_return_u64_u64 math__bits__add_64(u64 x, u64 y, u64 carry); multi_return_u32_u32 math__bits__sub_32(u32 x, u32 y, u32 borrow); multi_return_u64_u64 math__bits__sub_64(u64 x, u64 y, u64 borrow); -u64 _const_math__bits__two32 = 4294967296U; // precomputed -u64 _const_math__bits__mask32 = 4294967295U; // precomputed -string _const_math__bits__overflow_error; // a string literal, inited later -string _const_math__bits__divide_error; // a string literal, inited later multi_return_u32_u32 math__bits__mul_32(u32 x, u32 y); multi_return_u64_u64 math__bits__mul_64(u64 x, u64 y); multi_return_u32_u32 math__bits__div_32(u32 hi, u32 lo, u32 y); @@ -7303,25 +7307,6 @@ 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); u64 math__bits__rem_64(u64 hi, u64 lo, u64 y); multi_return_f64_int math__bits__normalize(f64 x); -Array_u8 _const_math__bits__ntz_8_tab; // inited later -Array_u8 _const_math__bits__pop_8_tab; // inited later -Array_u8 _const_math__bits__rev_8_tab; // inited later -Array_u8 _const_math__bits__len_8_tab; // inited later -u32 _const_strconv__single_plus_zero = 0; // precomputed -u32 _const_strconv__single_minus_zero = 2147483648; // precomputed -u32 _const_strconv__single_plus_infinity = 2139095040; // precomputed -u32 _const_strconv__single_minus_infinity = 4286578688; // precomputed -#define _const_strconv__digits 18 -u64 _const_strconv__double_plus_zero = 0U; // precomputed -u64 _const_strconv__double_minus_zero = 9223372036854775808U; // precomputed -u64 _const_strconv__double_plus_infinity = 9218868437227405312U; // precomputed -u64 _const_strconv__double_minus_infinity = 18442240474082181120U; // precomputed -rune _const_strconv__c_dpoint = '.'; // precomputed -rune _const_strconv__c_plus = '+'; // precomputed -rune _const_strconv__c_minus = '-'; // precomputed -rune _const_strconv__c_zero = '0'; // precomputed -rune _const_strconv__c_nine = '9'; // precomputed -u32 _const_strconv__c_ten = 10; // precomputed VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__lsr96(u32 s2, u32 s1, u32 s0); VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__lsl96(u32 s2, u32 s1, u32 s0); VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__add96(u32 s2, u32 s1, u32 s0, u32 d2, u32 d1, u32 d0); @@ -7333,10 +7318,6 @@ VV_LOCAL_SYMBOL multi_return_strconv__ParserState_strconv__PrepNumber strconv__p VV_LOCAL_SYMBOL u64 strconv__converter(strconv__PrepNumber* pn); _option_f64 strconv__atof64(string s); f64 strconv__atof_quick(string s); -Array_u64 _const_strconv__pos_exp; // inited later -Array_u64 _const_strconv__neg_exp; // inited later -#define _const_strconv__int_size 32 -u64 _const_strconv__max_u64 = 18446744073709551615U; // precomputed u8 strconv__byte_to_lower(u8 c); _option_u64 strconv__common_parse_uint(string s, int _base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit); multi_return_u64_int strconv__common_parse_uint2(string s, int _base, int _bit_size); @@ -7345,11 +7326,6 @@ _option_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool e _option_i64 strconv__parse_int(string _s, int base, int _bit_size); _option_int strconv__atoi(string s); VV_LOCAL_SYMBOL bool strconv__underscore_ok(string s); -Array_u32 _const_strconv__ten_pow_table_32; // inited later -u32 _const_strconv__mantbits32 = 23; // precomputed -u32 _const_strconv__expbits32 = 8; // precomputed -#define _const_strconv__bias32 127 -#define _const_strconv__maxexp32 255 string strconv__Dec32_get_string_32(strconv__Dec32 d, bool neg, int i_n_digit, int i_pad_digit); VV_LOCAL_SYMBOL multi_return_strconv__Dec32_bool strconv__f32_to_decimal_exact_int(u32 i_mant, u32 exp); VV_LOCAL_SYMBOL strconv__Dec32 strconv__f32_to_decimal(u32 mant, u32 exp); @@ -7360,16 +7336,8 @@ VV_LOCAL_SYMBOL multi_return_strconv__Dec64_bool strconv__f64_to_decimal_exact_i VV_LOCAL_SYMBOL strconv__Dec64 strconv__f64_to_decimal(u64 mant, u64 exp); string strconv__f64_to_str(f64 f, int n_digit); string strconv__f64_to_str_pad(f64 f, int n_digit); -Array_u64 _const_strconv__ten_pow_table_64; // inited later -u32 _const_strconv__mantbits64 = 52; // precomputed -u32 _const_strconv__expbits64 = 11; // precomputed -#define _const_strconv__bias64 1023 -#define _const_strconv__maxexp64 2047 -Array_f64 _const_strconv__dec_round; // inited later string strconv__format_str(string s, strconv__BF_param p); 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); string strconv__f64_to_str_lnd1(f64 f, int dec_digit); string strconv__format_fl(f64 f, strconv__BF_param p); @@ -7379,18 +7347,8 @@ string strconv__ftoa_64(f64 f); string strconv__ftoa_long_64(f64 f); string strconv__ftoa_32(f32 f); string strconv__ftoa_long_32(f32 f); -string _const_strconv__base_digits; // a string literal, inited later string strconv__format_int(i64 n, int radix); string strconv__format_uint(u64 n, int radix); -#define _const_strconv__pow5_num_bits_32 61 -#define _const_strconv__pow5_inv_num_bits_32 59 -#define _const_strconv__pow5_num_bits_64 121 -#define _const_strconv__pow5_inv_num_bits_64 122 -Array_u64 _const_strconv__powers_of_10; // inited later -Array_u64 _const_strconv__pow5_split_32; // inited later -Array_u64 _const_strconv__pow5_inv_split_32; // inited later -Array_strconv__Uint128 _const_strconv__pow5_split_64; // inited later -Array_strconv__Uint128 _const_strconv__pow5_inv_split_64; // inited later string strconv__f32_to_str_l(f32 f); string strconv__f32_to_str_l_no_dot(f32 f); string strconv__f64_to_str_l(f64 f); @@ -7498,9 +7456,9 @@ void print(string s); void println(string s); VV_LOCAL_SYMBOL void _writeln_to_fd(int fd, string s); VV_LOCAL_SYMBOL void _write_buf_to_fd(int fd, u8* buf, int buf_len); -i64 total_m = ((i64)(0)); // global4 u8* _v_malloc(isize n); u8* malloc_noscan(isize n); +u8* malloc_uncollectable(isize n); u8* v_realloc(u8* b, isize n); u8* realloc_data(u8* old_data, int old_size, int new_size); u8* vcalloc(isize n); @@ -7508,12 +7466,10 @@ u8* vcalloc_noscan(isize n); void _v_free(voidptr ptr); voidptr memdup(voidptr src, int sz); voidptr memdup_noscan(voidptr src, int sz); +voidptr memdup_uncollectable(voidptr src, int sz); VV_LOCAL_SYMBOL int v_fixed_index(int i, int len); void print_backtrace(void); -int g_main_argc = ((int)(0)); // global4 -voidptr g_main_argv = ((voidptr)(0)); // global4 bool isnil(voidptr v); -Array_VCastTypeIndexName as_cast_type_indexes; // global4 VV_LOCAL_SYMBOL voidptr __as_cast(voidptr obj, int obj_type, int expected_type); void VAssertMetaInfo_free(VAssertMetaInfo* ami); VV_LOCAL_SYMBOL void __print_assert_failure(VAssertMetaInfo* i); @@ -7561,7 +7517,6 @@ string ptr_str(voidptr ptr); string isize_str(isize x); string usize_str(usize x); string char_str(char* cptr); -string _const_digit_pairs; // a string literal, inited later VV_LOCAL_SYMBOL string int_str_l(int nn, int max); string i8_str(i8 n); string i16_str(i16 n); @@ -7613,15 +7568,6 @@ VV_LOCAL_SYMBOL u64 map_hash_int_2(voidptr pkey); VV_LOCAL_SYMBOL u64 map_hash_int_4(voidptr pkey); VV_LOCAL_SYMBOL u64 map_hash_int_8(voidptr pkey); VV_LOCAL_SYMBOL void DenseArray_zeros_to_end(DenseArray* d); -#define _const_hashbits 24 -#define _const_max_cached_hashbits 16 -#define _const_init_log_capicity 5 -#define _const_init_capicity 32 -f64 _const_max_load_factor = 0.8; // precomputed -#define _const_init_even_index 30 -#define _const_extra_metas_inc 4 -u32 _const_hash_mask = 16777215; // precomputed -u32 _const_probe_inc = 16777216; // precomputed VV_LOCAL_SYMBOL DenseArray new_dense_array(int key_bytes, int value_bytes); VV_LOCAL_SYMBOL voidptr DenseArray_key(DenseArray* d, int i); VV_LOCAL_SYMBOL voidptr DenseArray_value(DenseArray* d, int i); @@ -7669,7 +7615,6 @@ int Error_code(Error err); string MessageError_msg(MessageError err); int MessageError_code(MessageError err); void MessageError_free(MessageError* err); -IError _const_none__; // inited later VV_LOCAL_SYMBOL string None___str(None__ _d1); IError _v_error(string message); IError error_with_code(string message, int code); @@ -7677,8 +7622,6 @@ VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void opt_ok2(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void _result_ok(voidptr data, _result* res, int size); string none_str(none _d2); -#define _const_prealloc_block_size 16777216 -VMemoryBlock* g_memory_block; // global4 VV_LOCAL_SYMBOL VMemoryBlock* vmemory_block_new(VMemoryBlock* prev, isize at_least); VV_LOCAL_SYMBOL byte* vmemory_block_malloc(isize n); VV_LOCAL_SYMBOL void prealloc_vinit(void); @@ -7691,10 +7634,6 @@ string Array_rune_string(Array_rune ra); string rune_repeat(rune c, int count); Array_u8 rune_bytes(rune c); int rune_length_in_bytes(rune c); -#define _const_degree 6 -#define _const_mid_index 5 -#define _const_max_len 11 -u32 _const_children_bytes; // inited later VV_LOCAL_SYMBOL SortedMap new_sorted_map(int n, int value_bytes); VV_LOCAL_SYMBOL SortedMap new_sorted_map_init(int n, int value_bytes, string* keys, voidptr values); VV_LOCAL_SYMBOL mapnode* new_node(void); @@ -7738,7 +7677,7 @@ string string_clone(string a); string string_replace_once(string s, string rep, string with); string string_replace(string s, string rep, string with); string string_replace_each(string s, Array_string vals); -VV_LOCAL_SYMBOL int compare_3079424758118292824_RepIndex_by_idx(RepIndex* a, RepIndex* b) { +VV_LOCAL_SYMBOL int compare_5406533740619829871_RepIndex_by_idx(RepIndex* a, RepIndex* b) { if (a->idx < b->idx) return -1; else return 1; } @@ -7853,15 +7792,11 @@ u64 get_str_intp_u64_format(StrIntpType fmt_type, int in_width, int in_precision u32 get_str_intp_u32_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, byte in_pad_ch, int in_base, bool in_upper_case); VV_LOCAL_SYMBOL void StrIntpData_process_str_intp_data(StrIntpData* data, strings__Builder* sb); string str_intp(int data_len, voidptr in_data); -string _const_si_s_code; // a string literal, inited later -string _const_si_g32_code; // a string literal, inited later -string _const_si_g64_code; // a string literal, inited later string str_intp_sq(string in_str); string str_intp_rune(string in_str); string str_intp_g32(string in_str); string str_intp_g64(string in_str); string str_intp_sub(string base_str, string in_str); -#define _const_cp_utf8 65001 u16* string_to_wide(string _str); string string_from_wide(u16* _wstr); string string_from_wide2(u16* _wstr, int len); @@ -7902,9 +7837,8 @@ Array_string os__cmdline__options_before(Array_string args, Array_string what); Array_string os__cmdline__options_after(Array_string args, Array_string what); Array_string os__cmdline__only_non_options(Array_string args); Array_string os__cmdline__only_options(Array_string args); -#define _const_v__token__max_keyword_len 20 v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); -VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { +VV_LOCAL_SYMBOL int compare_11195941112940057302_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { if (string__lt(a->word, b->word)) return -1; else return 1; } @@ -7918,11 +7852,6 @@ v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end); v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line); void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line); v__token__Pos v__token__Token_pos(v__token__Token* tok); -Array_v__token__Kind _const_v__token__assign_tokens; // inited later -Array_string _const_v__token__valid_at_tokens; // inited later -Array_string _const_v__token__token_str; // inited later -Map_string_v__token__Kind _const_v__token__keywords; // inited later -v__token__KeywordsMatcher _const_v__token__matcher; // inited later VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void); VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void); bool v__token__is_key(string key); @@ -7932,7 +7861,6 @@ string v__token__Kind_str(v__token__Kind t); string v__token__Token_str(v__token__Token t); string v__token__Token_debug(v__token__Token t); Array_v__token__Precedence v__token__build_precedences(void); -Array_v__token__Precedence _const_v__token__precedences; // inited later int v__token__Token_precedence(v__token__Token tok); bool v__token__Token_is_scalar(v__token__Token tok); bool v__token__Token_is_unary(v__token__Token tok); @@ -7958,9 +7886,6 @@ string time__Time_ymmdd(time__Time t); string time__Time_ddmmy(time__Time t); string time__Time_md(time__Time t); VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); -Array_string _const_time__tokens_2; // inited later -Array_string _const_time__tokens_3; // inited later -Array_string _const_time__tokens_4; // inited later string time__Time_custom_format(time__Time t, string s); string time__Time_clean(time__Time t); string time__Time_clean12(time__Time t); @@ -7993,21 +7918,6 @@ i64 time__ticks(void); string time__Time_str(time__Time t); VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_string _const_time__long_days; // inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -Array_string _const_time__long_months; // inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -#define _const_time__days_in_year 365 -Array_int _const_time__days_before; // inited later string time__Time_smonth(time__Time* t); i64 time__Time_unix_time(time__Time* t); i64 time__Time_unix_time_milli(time__Time* t); @@ -8024,13 +7934,6 @@ string time__Time_long_weekday_str(time__Time* t); bool time__is_leap_year(int year); _option_int time__days_in_month(int month, int year); string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later i64 time__Duration_nanoseconds(time__Duration d); i64 time__Duration_microseconds(time__Duration d); i64 time__Duration_milliseconds(time__Duration d); @@ -8061,7 +7964,7 @@ time__Time time__unix2(i64 abs, int microsecond); VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); void v__dotgraph__start_digraph(void); -VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void); +VV_LOCAL_SYMBOL void anon_fn_6b7dbc3eb6b094a7__82(void); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); @@ -8072,27 +7975,11 @@ u64 hash__wyhash_c(u8* key, u64 len, u64 seed); u64 hash__wyhash64_c(u64 a, u64 b); u64 hash__sum64_string(string key, u64 seed); u64 hash__sum64(Array_u8 key, u64 seed); -u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed -u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed -u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed -u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed -u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k); u64 hash__wymum(u64 a, u64 b); VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k); VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p); VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p); -u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed -#define _const_rand__constants__max_u32 4294967295 -u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed -f32 _const_rand__constants__max_u32_as_f32; // inited later -f64 _const_rand__constants__max_u64_as_f64; // inited later -u32 _const_rand__constants__u31_mask = 2147483647; // precomputed -u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed -u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed -u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed -u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed -u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed u32 hash__fnv1a__sum32_string(string data); u32 hash__fnv1a__sum32(Array_u8 data); u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); @@ -8105,9 +7992,6 @@ VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); string flag__Flag_str(flag__Flag f); string Array_flag__Flag_str(Array_flag__Flag af); VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f); -string _const_flag__space; // a string literal, inited later -string _const_flag__underline; // a string literal, inited later -#define _const_flag__max_args_number 4048 flag__FlagParser* flag__new_flag_parser(Array_string args); void flag__FlagParser_usage_example(flag__FlagParser* fs, string example); void flag__FlagParser_footer(flag__FlagParser* fs, string footer); @@ -8145,10 +8029,6 @@ VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2); -#define _const_semver__ver_major 0 -#define _const_semver__ver_minor 1 -#define _const_semver__ver_patch 2 -Array_int _const_semver__versions; // inited later VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input); VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver); VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ); @@ -8156,10 +8036,6 @@ VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVer VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver); VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver); VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver); -string _const_semver__comparator_sep; // a string literal, inited later -string _const_semver__comparator_set_sep; // a string literal, inited later -string _const_semver__hyphen_range_sep; // a string literal, inited later -string _const_semver__x_range_symbols; // a string literal, inited later VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver); VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver); VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver); @@ -8194,7 +8070,6 @@ VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input); VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ); VV_LOCAL_SYMBOL bool semver__is_valid_string(string input); VV_LOCAL_SYMBOL bool semver__is_valid_number(string input); -#define _const_sync__stdatomic__used 1 bool sync__stdatomic__add_u64(u64* ptr, int delta); bool sync__stdatomic__sub_u64(u64* ptr, int delta); bool sync__stdatomic__add_i64(i64* ptr, int delta); @@ -8205,17 +8080,6 @@ void sync__stdatomic__store_i64(i64* ptr, i64 val); i64 sync__stdatomic__load_i64(i64* ptr); Array_string os__args_after(string cut_word); Array_string os__args_before(string cut_word); -#define _const_os__o_rdonly 0 -#define _const_os__o_wronly 1 -#define _const_os__o_rdwr 2 -#define _const_os__o_binary 0 -#define _const_os__o_create 64 -#define _const_os__o_excl 128 -#define _const_os__o_noctty 256 -#define _const_os__o_trunc 512 -#define _const_os__o_append 1024 -#define _const_os__o_nonblock 2048 -#define _const_os__o_sync 1052672 string os__getenv(string key); _option_string os__getenv_opt(string key); int os__setenv(string name, string value, bool overwrite); @@ -8254,14 +8118,6 @@ VV_LOCAL_SYMBOL IError os__error_file_not_opened(void); VV_LOCAL_SYMBOL IError os__error_size_of_type_0(void); _option_void os__File_seek(os__File* f, i64 pos, os__SeekMode mode); _option_i64 os__File_tell(os__File* f); -rune _const_os__fslash = '/'; // precomputed -#define _const_os__bslash '\\' -rune _const_os__dot = '.'; // precomputed -rune _const_os__qmark = '?'; // precomputed -string _const_os__fslash_str; // a string literal, inited later -string _const_os__dot_dot; // a string literal, inited later -string _const_os__empty_str; // a string literal, inited later -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); @@ -8278,7 +8134,6 @@ VV_LOCAL_SYMBOL bool os__is_curr_dir_ref(int byte_one, int byte_two, int byte_th u32 os__FilePermission_bitmask(os__FilePermission p); u32 os__FileMode_bitmask(os__FileMode m); os__FileMode os__inode(string path); -Array_string _const_os__args; // inited later _option_Array_u8 os__read_bytes(string path); _option_string os__read_file(string path); _option_void os__truncate(string path, u64 len); @@ -8322,18 +8177,12 @@ _option_void os__execve(string cmdpath, Array_string cmdargs, Array_string envs) int os__is_atty(int fd); _option_void os__write_file_array(string path, array buffer); _option_Array_string os__glob(Array_string patterns); -VV_LOCAL_SYMBOL int compare_3677745349018262865_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_5811885252942183168_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } IError os__last_error(void); -#define _const_os__max_path_len 4096 -string _const_os__wd_at_startup; // inited later -#define _const_os__f_ok 0 -#define _const_os__x_ok 1 -#define _const_os__w_ok 2 -#define _const_os__r_ok 4 void os__Result_free(os__Result* result); _option_void os__cp_all(string src, string dst, bool overwrite); _option_void os__mv_by_cp(string source, string target); @@ -8380,35 +8229,6 @@ os__Result os__execute_or_panic(string cmd); os__Result os__execute_or_exit(string cmd); string os__quoted_path(string path); _option_string os__config_dir(void); -#define _const_os__prot_read 1 -#define _const_os__prot_write 2 -#define _const_os__map_private 2 -#define _const_os__map_anonymous 32 -#define _const_os__sys_write 1 -#define _const_os__sys_open 2 -#define _const_os__sys_close 3 -#define _const_os__sys_mkdir 83 -#define _const_os__sys_creat 85 -string _const_os__path_separator; // a string literal, inited later -string _const_os__path_delimiter; // a string literal, inited later -#define _const_os__stdin_value 0 -#define _const_os__stdout_value 1 -#define _const_os__stderr_value 2 -#define _const_os__s_ifmt 61440 -#define _const_os__s_ifdir 16384 -#define _const_os__s_iflnk 40960 -#define _const_os__s_isuid 2048 -#define _const_os__s_isgid 1024 -#define _const_os__s_isvtx 512 -#define _const_os__s_irusr 256 -#define _const_os__s_iwusr 128 -#define _const_os__s_ixusr 64 -#define _const_os__s_irgrp 32 -#define _const_os__s_iwgrp 16 -#define _const_os__s_ixgrp 8 -#define _const_os__s_iroth 4 -#define _const_os__s_iwoth 2 -#define _const_os__s_ixoth 1 VV_LOCAL_SYMBOL Array_string os__glob_match(string dir, string pattern, string next_pattern, Array_string* matches); VV_LOCAL_SYMBOL _option_void os__native_glob_pattern(string pattern, Array_string* matches); _option_void os__utime(string path, int actime, int modtime); @@ -8490,6 +8310,7 @@ void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o); v__depgraph__DepGraph* v__depgraph__new_dep_graph(void); void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps); +void v__depgraph__DepGraph_add_with_value(v__depgraph__DepGraph* graph, string mod, Array_string deps, i64 value); v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph); v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph); string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); @@ -8566,8 +8387,6 @@ void term__erase_line_clear(void); void term__show_cursor(void); void term__hide_cursor(void); void term__clear_previous_line(void); -#define _const_term__default_columns_size 80 -#define _const_term__default_rows_size 25 bool term__can_show_color_on_stdout(void); bool term__can_show_color_on_stderr(void); string term__failed(string s); @@ -8586,7 +8405,6 @@ multi_return_int_int term__get_terminal_size(void); _option_term__Coord term__get_cursor_position(void); bool term__set_terminal_title(string title); void term__clear(void); -string _const_v__util__version__v_version; // a string literal, inited later string v__util__version__vhash(void); string v__util__version__full_hash(void); string v__util__version__full_v_version(bool is_verbose); @@ -8604,7 +8422,6 @@ _option_string v__util__diff__find_working_diff_command(void); VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -string _const_v__vmod__err_label; // a string literal, inited later _option_v__vmod__Manifest v__vmod__from_file(string vmod_path); _option_v__vmod__Manifest v__vmod__decode(string contents); VV_LOCAL_SYMBOL void v__vmod__Scanner_tokenize(v__vmod__Scanner* s, v__vmod__TokenKind t_type, string val); @@ -8624,15 +8441,12 @@ VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_add(v__vmod__ModFileCacher* cacher, VV_LOCAL_SYMBOL multi_return_Array_string_v__vmod__ModFileAndFolder v__vmod__ModFileCacher_traverse(v__vmod__ModFileCacher* mcache, string mfolder); VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_mark_folders_with_vmod(v__vmod__ModFileCacher* mcache, Array_string folders_so_far, v__vmod__ModFileAndFolder vmod); VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_mark_folders_as_vmod_free(v__vmod__ModFileCacher* mcache, Array_string folders_so_far); -Array_string _const_v__vmod__mod_file_stop_paths; // inited later VV_LOCAL_SYMBOL bool v__vmod__ModFileCacher_check_for_stop(v__vmod__ModFileCacher* mcache, string cfolder, Array_string files); VV_LOCAL_SYMBOL Array_string v__vmod__ModFileCacher_get_files(v__vmod__ModFileCacher* mcache, string cfolder); -v__vmod__ModFileCacher* _const_v__vmod__private_file_cacher; // inited later v__vmod__ModFileCacher* v__vmod__get_cache(void); string v__util__recompilation__disabling_file(string vroot); void v__util__recompilation__must_be_enabled(string vroot, string error_message); string v__cflag__CFlag_str(v__cflag__CFlag* c); -string _const_v__cflag__fexisting_literal; // a string literal, inited later string v__cflag__CFlag_eval(v__cflag__CFlag* cf); string v__cflag__CFlag_format(v__cflag__CFlag* cf); Array_string Array_v__cflag__CFlag_c_options_before_target_msvc(Array_v__cflag__CFlag cflags); @@ -8642,9 +8456,6 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); -u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed -u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed -#define _const_rand__wyrand__seed_len 2 void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); @@ -8654,7 +8465,7 @@ int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod); _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); -VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_10487185186218018245_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8662,8 +8473,6 @@ VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { _option_string v__pkgconfig__Main_run(v__pkgconfig__Main* m); VV_LOCAL_SYMBOL string v__pkgconfig__filter(Array_string libs, string prefix, string prefix2); VV_LOCAL_SYMBOL v__pkgconfig__MainOptions* v__pkgconfig__parse_options(flag__FlagParser* fp); -Array_string _const_v__pkgconfig__default_paths; // inited later -string _const_v__pkgconfig__version; // a string literal, inited later VV_LOCAL_SYMBOL Array_string v__pkgconfig__PkgConfig_parse_list_no_comma(v__pkgconfig__PkgConfig* pc, string s); VV_LOCAL_SYMBOL Array_string v__pkgconfig__PkgConfig_parse_list(v__pkgconfig__PkgConfig* pc, string s); VV_LOCAL_SYMBOL string v__pkgconfig__PkgConfig_parse_line(v__pkgconfig__PkgConfig* pc, string s); @@ -8685,17 +8494,14 @@ bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); -f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a); VV_LOCAL_SYMBOL f64 rand__mlog(f64 a); VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x); VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_); VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b); VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f); -Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later string rand__uuid_v4(void); VV_LOCAL_SYMBOL string rand__internal_uuid_v4(rand__PRNG* rng); -string _const_rand__ulid_encoding; // a string literal, inited later VV_LOCAL_SYMBOL string rand__internal_ulid_at_millisecond(rand__PRNG* rng, u64 unix_time_milli); VV_LOCAL_SYMBOL string rand__internal_string_from_set(rand__PRNG* rng, string charset, int len); VV_LOCAL_SYMBOL void rand__deinit(void); @@ -8736,7 +8542,6 @@ _option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct _option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf); _option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p); f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda); -rand__PRNG* default_rng; // global4 rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config); rand__PRNG* rand__get_current_rng(void); void rand__set_rng(rand__PRNG* rng); @@ -8765,9 +8570,6 @@ _option_f32 rand__f32_in_range(f32 min, f32 max); _option_f64 rand__f64_in_range(f64 min, f64 max); _option_Array_u8 rand__bytes(int bytes_needed); void rand__read(Array_u8* buf); -string _const_rand__english_letters; // a string literal, inited later -string _const_rand__hex_chars; // a string literal, inited later -string _const_rand__ascii_chars; // a string literal, inited later string rand__ulid(void); string rand__ulid_at_millisecond(u64 unix_time_milli); string rand__string_from_set(string charset, int len); @@ -8779,7 +8581,6 @@ _option_f64 rand__normal(rand__config__NormalConfigStruct conf); _option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf); _option_int rand__binomial(int n, f64 p); f64 rand__exponential(f64 lambda); -string _const_v__pref__default_module_path; // inited later v__pref__Preferences* v__pref__new_preferences(void); VV_LOCAL_SYMBOL void v__pref__Preferences_expand_lookup_paths(v__pref__Preferences* p); void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p); @@ -8793,7 +8594,6 @@ _option_v__pref__OS v__pref__os_from_string(string os_str); string v__pref__OS_str(v__pref__OS o); v__pref__OS v__pref__get_host_os(void); bool v__pref__Backend_is_js(v__pref__Backend b); -Array_string _const_v__pref__list_of_flags_with_param; // inited later multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string known_external_commands, Array_string args); 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); @@ -8809,7 +8609,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); 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) { +VV_LOCAL_SYMBOL int compare_15729605724654494396_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8819,9 +8619,6 @@ bool v__pref__Preferences_should_compile_native(v__pref__Preferences* prefs, str bool v__pref__Preferences_should_compile_c(v__pref__Preferences* prefs, string file); bool v__pref__Preferences_should_compile_asm(v__pref__Preferences* prefs, string path); bool v__pref__Preferences_should_compile_js(v__pref__Preferences* prefs, string file); -#define _const_sync__aops_used 1 -#define _const_sync__spinloops 750 -#define _const_sync__spinloops_sem 4000 VV_LOCAL_SYMBOL sync__Channel* sync__new_channel_st(u32 n, u32 st); VV_LOCAL_SYMBOL sync__Channel* sync__new_channel_st_noscan(u32 n, u32 st); string sync__Channel_auto_str(sync__Channel* ch, string _v_typename); @@ -8867,10 +8664,9 @@ bool sync__Semaphore_try_wait(sync__Semaphore* sem); bool sync__Semaphore_timed_wait(sync__Semaphore* sem, time__Duration timeout); void sync__Semaphore_destroy(sync__Semaphore _v_toheap_sem); u64 sync__thread_id(void); -string _const_help__unknown_topic; // a string literal, inited later void help__print_and_exit(string topic); VV_LOCAL_SYMBOL string help__known_topics(string topicdir); -VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_13139793989557853369_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8878,16 +8674,11 @@ VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) { _option_string v__util__find_working_diff_command(void); string v__util__color_compare_files(string diff_cmd, string file1, string file2); string v__util__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -#define _const_v__util__error_context_before 2 -#define _const_v__util__error_context_after 2 -v__util__EManager* _const_v__util__emanager; // inited later v__util__EManager* v__util__new_error_manager(void); void v__util__EManager_set_support_color(v__util__EManager* e, bool b); string v__util__bold(string msg); VV_LOCAL_SYMBOL string v__util__color(string kind, string msg); -string _const_v__util__normalised_workdir; // inited later string v__util__formatted_error(string kind, string omsg, string filepath, v__token__Pos pos); -v__util__LinesCache* lines_cache; // global4 Array_string v__util__cached_file2sourcelines(string path); Array_string v__util__set_source_for_path(string path, string source); Array_string v__util__source_file_context(string kind, string filepath, v__token__Pos pos); @@ -8896,12 +8687,6 @@ string v__util__vlines_escape_path(string path, string ccompiler); string v__util__qualify_import(v__pref__Preferences* pref, string mod, string file_path); string v__util__qualify_module(v__pref__Preferences* pref, string mod, string file_path); VV_LOCAL_SYMBOL _option_string v__util__mod_path_to_full_name(v__pref__Preferences* pref, string mod, string path); -Array_u8 _const_v__util__invalid_escapes; // inited later -#define _const_v__util__backslash 92 -#define _const_v__util__backslash_r 13 -#define _const_v__util__backslash_n 10 -#define _const_v__util__double_quote 34 -string _const_v__util__double_escape; // a string literal, inited later string v__util__smart_quote(string str, bool raw); bool v__util__is_name_char(u8 c); bool v__util__is_func_char(u8 c); @@ -8913,13 +8698,13 @@ v__util__Suggestion v__util__new_suggestion(string wanted, Array_string possibil void v__util__Suggestion_add(v__util__Suggestion* s, string val); void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many); void v__util__Suggestion_sort(v__util__Suggestion* s); -VV_LOCAL_SYMBOL int compare_15123029833316296960_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { +VV_LOCAL_SYMBOL int compare_14781029812553904099_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { if (a->similarity < b->similarity) return -1; else return 1; } string v__util__Suggestion_say(v__util__Suggestion s, string msg); -VV_LOCAL_SYMBOL int compare_15123029833316296960_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_14781029812553904099_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8933,7 +8718,6 @@ string v__util__Surrounder_after(v__util__Surrounder* s); void v__util__Surrounder_builder_write_befores(v__util__Surrounder* s, strings__Builder* sb); void v__util__Surrounder_builder_write_afters(v__util__Surrounder* s, strings__Builder* sb); void v__util__Surrounder_free(v__util__Surrounder* s); -v__util__Timers* g_timers; // global4 v__util__Timers* v__util__new_timers(v__util__TimerParams params); v__util__Timers* v__util__get_timers(void); void v__util__timing_start(string label); @@ -8951,10 +8735,6 @@ void v__util__Timers_show_if_exists(v__util__Timers* t, string label); void v__util__Timers_show_remaining(v__util__Timers* t); void v__util__Timers_dump_all(v__util__Timers* t); string v__util__skip_bom(string file_content); -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 bool v__util__module_is_builtin(string mod); string v__util__tabs(int n); void v__util__set_vroot_folder(string vroot_path); @@ -8975,7 +8755,6 @@ void v__util__ensure_modules_for_all_tools_are_installed(bool is_verbose); string v__util__strip_mod_name(string name); string v__util__strip_main_name(string name); string v__util__no_dots(string s); -string _const_v__util__map_prefix; // a string literal, inited later string v__util__no_cur_mod(string _v_typename, string cur_mod); void v__util__prepare_tool_when_needed(string source_name); void v__util__recompile_file(string vexe, string file); @@ -8984,7 +8763,6 @@ bool v__util__should_bundle_module(string mod); _option_Array_string v__util__find_all_v_files(Array_string roots); void v__util__free_caches(void); _option_string v__util__read_file(string file_path); -voidptr _const_sync__pool__no_result; // inited later sync__pool__PoolProcessor* sync__pool__new_pool_processor(sync__pool__PoolProcessorConfig context); void sync__pool__PoolProcessor_set_max_jobs(sync__pool__PoolProcessor* pool, int njobs); void sync__pool__PoolProcessor_work_on_items_T___ptr__v__ast__File(sync__pool__PoolProcessor* pool, Array_v__ast__File_ptr items); @@ -9005,12 +8783,6 @@ bool v__ast__StructField_equals(v__ast__StructField* f, v__ast__StructField* o); void v__ast__File_free(v__ast__File* f); bool v__ast__Ident_is_mut(v__ast__Ident* i); v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i); -Map_int_Array_string _const_v__ast__x86_no_number_register_list; // inited later -Map_int_Map_string_int _const_v__ast__x86_with_number_register_list; // inited later -Array_string _const_v__ast__arm_no_number_register_list; // inited later -Map_string_int _const_v__ast__arm_with_number_register_list; // inited later -Array_string _const_v__ast__riscv_no_number_register_list; // inited later -Map_string_int _const_v__ast__riscv_with_number_register_list; // inited later 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); @@ -9053,7 +8825,6 @@ bool v__ast__ConstField_is_simple_define_const(v__ast__ConstField* obj); bool v__ast__ScopeObject_is_simple_define_const(v__ast__ScopeObject obj); u64 v__ast__EmbeddedFile_hash(v__ast__EmbeddedFile e); v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ast__Table* t); -Array_string _const_v__ast__native_builtins; // inited later void v__ast__Scope_free(v__ast__Scope* s); VV_LOCAL_SYMBOL bool v__ast__Scope_dont_lookup_parent(v__ast__Scope* s); _option_v__ast__ScopeObject v__ast__Scope_find(v__ast__Scope* s, string name); @@ -9087,7 +8858,6 @@ string v__ast__Stmt_str(v__ast__Stmt node); VV_LOCAL_SYMBOL string v__ast__field_to_string(v__ast__ConstField f); string v__ast__ComptimeForKind_str(v__ast__ComptimeForKind e); void v__ast__Table_free(v__ast__Table* t); -#define _const_v__ast__invalid_type_idx -1 VV_LOCAL_SYMBOL void v__ast__default_table_panic_handler(v__ast__Table* t, string message); void v__ast__Table_panic(v__ast__Table* t, string message); VV_LOCAL_SYMBOL bool v__ast__Fn_method_equals(v__ast__Fn* f, v__ast__Fn* o); @@ -9096,7 +8866,6 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o); VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ast__Param o); v__ast__Table* v__ast__new_table(void); -v__ast__Table* global_table = ((v__ast__Table*)(0)); // global4 void v__ast__set_global_table(v__ast__Table* t); string v__ast__Table_fn_type_signature(v__ast__Table* t, v__ast__Fn* f); string v__ast__Table_fn_type_source_signature(v__ast__Table* t, v__ast__Fn* f); @@ -9125,7 +8894,6 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS int v__ast__Table_find_type_idx(v__ast__Table* t, string name); _option_v__ast__TypeSymbol_ptr v__ast__Table_find_sym(v__ast__Table* t, string name); multi_return_ref_v__ast__TypeSymbol_int v__ast__Table_find_sym_and_type_idx(v__ast__Table* t, string name); -v__ast__TypeSymbol* _const_v__ast__invalid_type_symbol; // inited later v__ast__TypeSymbol* v__ast__Table_sym_by_idx(v__ast__Table* t, int idx); v__ast__TypeSymbol* v__ast__Table_sym(v__ast__Table* t, v__ast__Type typ); v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Type typ); @@ -9179,6 +8947,8 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Array_v__ast__Type generic_types); void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t); bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__ComptimeType y); +Array_string v__ast__Table_dependent_names_in_expr(v__ast__Table* t, v__ast__Expr expr); +Array_string v__ast__Table_dependent_names_in_stmt(v__ast__Table* t, v__ast__Stmt stmt); v__ast__Language v__ast__pref_arch_to_table_language(v__pref__Arch pref_arch); string v__ast__ShareType_str(v__ast__ShareType t); string v__ast__Type_atomic_typename(v__ast__Type t); @@ -9222,80 +8992,9 @@ bool v__ast__Type_is_int_literal(v__ast__Type typ); bool v__ast__Type_is_number(v__ast__Type typ); bool v__ast__Type_is_string(v__ast__Type typ); bool v__ast__Type_is_bool(v__ast__Type typ); -#define _const_v__ast__void_type_idx 1 -#define _const_v__ast__voidptr_type_idx 2 -#define _const_v__ast__byteptr_type_idx 3 -#define _const_v__ast__charptr_type_idx 4 -#define _const_v__ast__i8_type_idx 5 -#define _const_v__ast__i16_type_idx 6 -#define _const_v__ast__int_type_idx 7 -#define _const_v__ast__i64_type_idx 8 -#define _const_v__ast__isize_type_idx 9 -#define _const_v__ast__byte_type_idx 10 -#define _const_v__ast__u16_type_idx 11 -#define _const_v__ast__u32_type_idx 12 -#define _const_v__ast__u64_type_idx 13 -#define _const_v__ast__usize_type_idx 14 -#define _const_v__ast__f32_type_idx 15 -#define _const_v__ast__f64_type_idx 16 -#define _const_v__ast__char_type_idx 17 -#define _const_v__ast__bool_type_idx 18 -#define _const_v__ast__none_type_idx 19 -#define _const_v__ast__string_type_idx 20 -#define _const_v__ast__rune_type_idx 21 -#define _const_v__ast__array_type_idx 22 -#define _const_v__ast__map_type_idx 23 -#define _const_v__ast__chan_type_idx 24 -#define _const_v__ast__any_type_idx 25 -#define _const_v__ast__float_literal_type_idx 26 -#define _const_v__ast__int_literal_type_idx 27 -#define _const_v__ast__thread_type_idx 28 -#define _const_v__ast__error_type_idx 29 -Array_string _const_v__ast__builtin_type_names; // inited later -v__token__KeywordsMatcher _const_v__ast__builtin_type_names_matcher; // inited later -Array_int _const_v__ast__integer_type_idxs; // inited later -Array_int _const_v__ast__signed_integer_type_idxs; // inited later -Array_int _const_v__ast__unsigned_integer_type_idxs; // inited later -Array_int _const_v__ast__int_promoted_type_idxs; // inited later -Array_int _const_v__ast__float_type_idxs; // inited later -Array_int _const_v__ast__number_type_idxs; // inited later -Array_int _const_v__ast__pointer_type_idxs; // inited later -Array_int _const_v__ast__string_type_idxs; // inited later -v__ast__Type _const_v__ast__void_type; // inited later -v__ast__Type _const_v__ast__ovoid_type; // inited later -v__ast__Type _const_v__ast__rvoid_type; // inited later -v__ast__Type _const_v__ast__voidptr_type; // inited later -v__ast__Type _const_v__ast__byteptr_type; // inited later -v__ast__Type _const_v__ast__charptr_type; // inited later -v__ast__Type _const_v__ast__i8_type; // inited later -v__ast__Type _const_v__ast__int_type; // inited later -v__ast__Type _const_v__ast__i16_type; // inited later -v__ast__Type _const_v__ast__i64_type; // inited later -v__ast__Type _const_v__ast__isize_type; // inited later -v__ast__Type _const_v__ast__byte_type; // inited later -v__ast__Type _const_v__ast__u16_type; // inited later -v__ast__Type _const_v__ast__u32_type; // inited later -v__ast__Type _const_v__ast__u64_type; // inited later -v__ast__Type _const_v__ast__usize_type; // inited later -v__ast__Type _const_v__ast__f32_type; // inited later -v__ast__Type _const_v__ast__f64_type; // inited later -v__ast__Type _const_v__ast__char_type; // inited later -v__ast__Type _const_v__ast__bool_type; // inited later -v__ast__Type _const_v__ast__none_type; // inited later -v__ast__Type _const_v__ast__string_type; // inited later -v__ast__Type _const_v__ast__rune_type; // inited later -v__ast__Type _const_v__ast__array_type; // inited later -v__ast__Type _const_v__ast__map_type; // inited later -v__ast__Type _const_v__ast__chan_type; // inited later -v__ast__Type _const_v__ast__any_type; // inited later -v__ast__Type _const_v__ast__float_literal_type; // inited later -v__ast__Type _const_v__ast__int_literal_type; // inited later -v__ast__Type _const_v__ast__thread_type; // inited later -v__ast__Type _const_v__ast__error_type; // inited later -Array_v__ast__Type _const_v__ast__charptr_types; // inited later -Array_v__ast__Type _const_v__ast__byteptr_types; // inited later -Array_v__ast__Type _const_v__ast__voidptr_types; // inited later -Array_v__ast__Type _const_v__ast__cptr_types; // inited later +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_charptr_types(void); +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_byteptr_types(void); +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_voidptr_types(void); Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params); v__ast__Type v__ast__mktyp(v__ast__Type typ); v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ); @@ -9362,21 +9061,6 @@ _option_void v__checker__Checker_check_expected(v__checker__Checker* c, v__ast__ VV_LOCAL_SYMBOL string v__checker__Checker_expected_msg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_symmetric_check(v__checker__Checker* c, v__ast__Type left, v__ast__Type right); void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__Fn func, v__ast__CallExpr* node); -int _const_v__checker__int_min; // inited later -int _const_v__checker__int_max = 2147483647; // precomputed -#define _const_v__checker__expr_level_cutoff_limit 40 -#define _const_v__checker__stmt_level_cutoff_limit 40 -#define _const_v__checker__iface_level_cutoff_limit 100 -Array_string _const_v__checker__valid_comptime_if_os; // inited later -Array_string _const_v__checker__valid_comptime_compression_types; // inited later -Array_string _const_v__checker__valid_comptime_if_compilers; // inited later -Array_string _const_v__checker__valid_comptime_if_platforms; // inited later -Array_string _const_v__checker__valid_comptime_if_cpu_features; // inited later -Array_string _const_v__checker__valid_comptime_if_other; // inited later -Array_string _const_v__checker__valid_comptime_not_user_defined; // inited later -Array_string _const_v__checker__array_builtin_methods; // inited later -Array_string _const_v__checker__reserved_type_names; // inited later -string _const_v__checker__vroot_is_deprecated_message; // a string literal, inited later 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); VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_file(v__checker__Checker* c); @@ -9504,13 +9188,12 @@ 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 v__ast__Type v__checker__Checker_string_lit(v__checker__Checker* c, v__ast__StringLiteral* node); v__ast__Type v__checker__Checker_int_lit(v__checker__Checker* c, v__ast__IntegerLiteral* node); void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node); VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b); v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node); -VV_LOCAL_SYMBOL int compare_5995660241070764127_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { +VV_LOCAL_SYMBOL int compare_6602916910409314308_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { if (a->i < b->i) return -1; else return 1; } @@ -9580,13 +9263,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index(v__gen__c__Gen* g, v__ast__C VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_wait(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__CallExpr node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement); -IError _const_v__gen__c__unsupported_ctemp_assert_transform; // inited later +VV_LOCAL_SYMBOL void v__gen__c__Gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement); VV_LOCAL_SYMBOL _option_v__ast__Expr v__gen__c__Gen_assert_subexpression_to_ctemp(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type expr_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_postfailure_mode(v__gen__c__Gen* g, v__ast__AssertStmt node); VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ast__AssertStmt node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type typ); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_); +VV_LOCAL_SYMBOL void v__gen__c__Gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node, v__ast__Type return_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_vars_autofree(v__gen__c__Gen* g, v__ast__AssignStmt* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node); @@ -9607,7 +9289,6 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_struct(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string fn_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string fn_name); VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp); -string _const_v__gen__c__si_s_code; // a string literal, inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name); VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__StrType typ); @@ -9632,12 +9313,6 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_struct(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x); VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); -Array_string _const_v__gen__c__c_reserved; // inited later -Map_string_bool _const_v__gen__c__c_reserved_map; // inited later -Array_string _const_v__gen__c__cmp_str; // inited later -Array_string _const_v__gen__c__cmp_rev; // inited later -string _const_v__gen__c__result_name; // a string literal, inited later -string _const_v__gen__c__option_name; // a string literal, inited later VV_LOCAL_SYMBOL Map_string_bool v__gen__c__string_array_to_map(Array_string a); string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pref__Preferences* pref); VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__PoolProcessor* p, int idx, int wid); @@ -9700,7 +9375,7 @@ VV_LOCAL_SYMBOL string v__gen__c__cescape_nonascii(string original); VV_LOCAL_SYMBOL string v__gen__c__cestring(string s); VV_LOCAL_SYMBOL string v__gen__c__ctoslit(string s); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_attrs(v__gen__c__Gen* g, Array_v__ast__Attr attrs); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt); +VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt); VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg arg, v__ast__AsmStmt stmt); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_ios(v__gen__c__Gen* g, Array_v__ast__AsmIO ios); VV_LOCAL_SYMBOL string v__gen__c__cnewlines(string s); @@ -9733,9 +9408,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_result_error(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_optional_error(v__gen__c__Gen* g, v__ast__Type target_type, v__ast__Expr expr); VV_LOCAL_SYMBOL void v__gen__c__Gen_return_stmt(v__gen__c__Gen* g, v__ast__Return node); VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl(v__gen__c__Gen* g, v__ast__ConstDecl node); -VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ); -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string styp, string cname, string ct_value); -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val); +VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, string field_name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string mod, string styp, string cname, string field_name, string ct_value); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string mod, string name, string val); VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, string mod, string name, v__ast__Expr expr, v__ast__Type typ, bool unwrap_option); VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__GlobalDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_assoc(v__gen__c__Gen* g, v__ast__Assoc node); @@ -9743,10 +9418,10 @@ VV_LOCAL_SYMBOL void v__gen__c__verror(string s); VV_LOCAL_SYMBOL void v__gen__c__Gen_error(v__gen__c__Gen* g, string s, v__token__Pos pos); VV_LOCAL_SYMBOL void v__gen__c__Gen_checker_bug(v__gen__c__Gen* g, string s, v__token__Pos pos); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_init_function(v__gen__c__Gen* g); -Array_string _const_v__gen__c__builtins; // inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_write_builtin_types(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sorted_types(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr symbols); +VV_LOCAL_SYMBOL void v__gen__c__Gen_sort_globals_consts(v__gen__c__Gen* g); VV_LOCAL_SYMBOL Array_v__ast__TypeSymbol_ptr v__gen__c__Gen_sort_structs(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr typesa); VV_LOCAL_SYMBOL int v__gen__c__Gen_nth_stmt_pos(v__gen__c__Gen* g, int n); VV_LOCAL_SYMBOL void v__gen__c__Gen_set_current_pos_as_last_stmt_pos(v__gen__c__Gen* g); @@ -9770,17 +9445,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_trace(v__gen__c__Gen* g, string fbase, strin int v__gen__c__Gen_get_array_depth(v__gen__c__Gen* g, v__ast__Type el_typ); bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ); VV_LOCAL_SYMBOL string v__gen__c__Gen_check_noscan(v__gen__c__Gen* g, v__ast__Type elem_typ); -string _const_v__gen__c__c_commit_hash_default; // a string literal, inited later -string _const_v__gen__c__c_current_commit_hash_default; // a string literal, inited later -string _const_v__gen__c__c_concurrency_helpers; // a string literal, inited later VV_LOCAL_SYMBOL string v__gen__c__c_closure_helpers(v__pref__Preferences* pref); -string _const_v__gen__c__c_common_macros; // a string literal, inited later -string _const_v__gen__c__c_unsigned_comparison_functions; // a string literal, inited later -string _const_v__gen__c__c_helper_macros; // a string literal, inited later -string _const_v__gen__c__c_headers; // str inited later -string _const_v__gen__c__c_builtin_types; // a string literal, inited later -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); @@ -9817,7 +9482,6 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_used_by_main(v__gen__c__Gen* g, v__ast__F VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl* node, bool skip); VV_LOCAL_SYMBOL _option_string v__gen__c__Gen_c_fn_name(v__gen__c__Gen* g, v__ast__FnDecl* node); -string _const_v__gen__c__closure_ctx; // a string literal, inited later VV_LOCAL_SYMBOL string v__gen__c__closure_ctx(v__ast__FnDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonFn* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn_decl(v__gen__c__Gen* g, v__ast__AnonFn* node); @@ -9881,8 +9545,6 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type VV_LOCAL_SYMBOL string v__gen__c__Gen_encode_map(v__gen__c__Gen* g, v__ast__Type key_type, v__ast__Type value_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloading_declarations(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloader_code(v__gen__c__Gen* g); -string _const_v__gen__c__posix_hotcode_definitions_1; // a string literal, inited later -string _const_v__gen__c__windows_hotcode_definitions_1; // a string literal, inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloading_main_caller(v__gen__c__Gen* g); VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_match(v__gen__c__Gen* g, v__ast__MatchExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr(v__gen__c__Gen* g, v__ast__MatchExpr node); @@ -9914,18 +9576,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen* g, v__ast__StringInterLiteral node, int i); VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInterLiteral node, int i); VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal(v__gen__c__Gen* g, v__ast__StringInterLiteral node); -Array_string _const_v__gen__c__skip_struct_init; // inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_struct_init(v__gen__c__Gen* g, v__ast__StructInit node); VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast__StructField field); VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_empty_struct(v__gen__c__Gen* g, v__gen__c__Type t); VV_LOCAL_SYMBOL v__ast__Type v__gen__c__Gen_unwrap_generic(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL v__gen__c__Type v__gen__c__Gen_unwrap(v__gen__c__Gen* g, v__ast__Type typ); -#define _const_v__scanner__single_quote '\'' -#define _const_v__scanner__double_quote '"' -rune _const_v__scanner__num_sep = '_'; // precomputed -#define _const_v__scanner__b_lf 10 -#define _const_v__scanner__b_cr 13 -#define _const_v__scanner__backslash '\\' _option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); void v__scanner__Scanner_free(v__scanner__Scanner* s); @@ -9975,12 +9630,9 @@ _option_void v__ast__walker__Inspector_visit(v__ast__walker__Inspector* i, v__as void v__ast__walker__inspect(v__ast__Node* node, voidptr data, bool (*inspector_callback)(v__ast__Node* node, voidptr data)); void v__ast__walker__walk(v__ast__walker__Visitor* visitor, v__ast__Node* node); VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_assign_stmt(v__parser__Parser* p); -#define _const_v__parser__max_expr_level 100 VV_LOCAL_SYMBOL _option_void v__parser__Parser_check_undefined_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val); VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val); 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); -Array_string _const_v__parser__supported_comptime_calls; // inited later -Array_string _const_v__parser__comptime_types; // inited later v__ast__ComptimeType v__parser__Parser_parse_comptime_type(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__HashStmt v__parser__Parser_hash(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__Parser* p); @@ -10023,7 +9675,6 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_is_used_import(v__parser__Parser* p, stri VV_LOCAL_SYMBOL void v__parser__Parser_register_used_import(v__parser__Parser* p, string alias); VV_LOCAL_SYMBOL void v__parser__Parser_register_auto_import(v__parser__Parser* p, string alias); VV_LOCAL_SYMBOL void v__parser__Parser_check_unused_imports(v__parser__Parser* p); -#define _const_v__parser__maximum_inline_sum_type_variants 3 v__ast__Type v__parser__Parser_parse_array_type(v__parser__Parser* p, v__token__Kind expecting); v__ast__Type v__parser__Parser_parse_map_type(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_chan_type(v__parser__Parser* p); @@ -10033,7 +9684,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name); v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut); v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p); -VV_LOCAL_SYMBOL int compare_14364895672131222426_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_16311103228414776939_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -10044,7 +9695,6 @@ v__ast__Type v__parser__Parser_parse_any_type(v__parser__Parser* p, v__ast__Lang v__ast__Type v__parser__Parser_find_type_or_add_placeholder(v__parser__Parser* p, string name, v__ast__Language language); v__ast__Type v__parser__Parser_parse_generic_type(v__parser__Parser* p, string name); v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, string name); -Array_v__ast__File_ptr codegen_files; // global4 v__ast__Stmt v__parser__parse_stmt(string text, v__ast__Table* table, v__ast__Scope* scope); v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__Table* table, v__pref__Preferences* pref, v__ast__Scope* scope); v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* table, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); @@ -10100,7 +9750,6 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Language language); VV_LOCAL_SYMBOL bool v__parser__Parser_is_typename(v__parser__Parser* p, v__token__Token t); VV_LOCAL_SYMBOL bool v__parser__Parser_is_generic_call(v__parser__Parser* p); -Array_v__token__Kind _const_v__parser__valid_tokens_inside_types; // inited later VV_LOCAL_SYMBOL bool v__parser__Parser_is_generic_cast(v__parser__Parser* p); v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser* p, v__ast__Expr left, bool is_gated); @@ -10140,7 +9789,6 @@ VV_LOCAL_SYMBOL v__ast__StructDecl v__parser__Parser_struct_decl(v__parser__Pars VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Parser* p, string typ_str, bool short_syntax); VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser__Parser* p); VV_LOCAL_SYMBOL void v__parser__State_update(v__parser__State* state, string line); -string _const_v__parser__tmpl_str_end; // a string literal, inited later VV_LOCAL_SYMBOL bool v__parser__is_html_open_tag(string name, string s); VV_LOCAL_SYMBOL string v__parser__insert_template_code(string fn_name, string tmpl_str_start, string line); string v__parser__Parser_compile_template_file(v__parser__Parser* p, string template_file, string fn_name); @@ -10165,9 +9813,6 @@ void v__builder__Builder_show_total_warns_and_errors_stats(v__builder__Builder* void v__builder__Builder_print_warnings_and_errors(v__builder__Builder* b); v__errors__Error v__builder__Builder_error_with_pos(v__builder__Builder* b, string s, string fpath, v__token__Pos pos); void v__builder__verror(string s); -string _const_v__builder__c_verror_message_marker; // a string literal, inited later -string _const_v__builder__c_error_info; // a string literal, inited later -string _const_v__builder__no_compiler_error; // a string literal, inited later _option_void v__builder__Builder_find_win_cc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_show_c_compiler_output(v__builder__Builder* v, os__Result res); VV_LOCAL_SYMBOL void v__builder__Builder_post_process_c_compiler_output(v__builder__Builder* v, os__Result res); @@ -10201,10 +9846,6 @@ void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods); void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files); VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list); -v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later -#define _const_v__builder__key_query_value 1 -#define _const_v__builder__key_wow64_32key 512 -#define _const_v__builder__key_enumerate_sub_keys 8 VV_LOCAL_SYMBOL _option_string v__builder__find_windows_kit_internal(v__builder__RegKey key, Array_string versions); VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__find_windows_kit_root(string target_arch); VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__find_windows_kit_root_by_reg(string target_arch); @@ -10225,7 +9866,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, 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) { +VV_LOCAL_SYMBOL int compare_7770354126342877024_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -10237,8 +9878,6 @@ 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); void v__builder__cbuilder__build_c(v__builder__Builder* b, Array_string v_files, string out_file); -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); @@ -10511,6 +10150,411 @@ void v__ast__Param_free(v__ast__Param* it); // auto void Array_v__ast__Attr_free(Array_v__ast__Attr* it); // auto void v__ast__Attr_free(v__ast__Attr* it); // auto +// V global/const definitions: +string _const_math__bits__overflow_error; // a string literal, inited later +string _const_math__bits__divide_error; // a string literal, inited later +#define _const_strconv__digits 18 +#define _const_strconv__int_size 32 +#define _const_strconv__bias32 127 +#define _const_strconv__maxexp32 255 +#define _const_strconv__bias64 1023 +#define _const_strconv__maxexp64 2047 +#define _const_strconv__max_size_f64_char 32 +string _const_strconv__digit_pairs; // a string literal, inited later +string _const_strconv__base_digits; // a string literal, inited later +#define _const_strconv__pow5_num_bits_32 61 +#define _const_strconv__pow5_inv_num_bits_32 59 +#define _const_strconv__pow5_num_bits_64 121 +#define _const_strconv__pow5_inv_num_bits_64 122 +string _const_digit_pairs; // a string literal, inited later +#define _const_hashbits 24 +#define _const_max_cached_hashbits 16 +#define _const_init_log_capicity 5 +#define _const_init_capicity 32 +#define _const_init_even_index 30 +#define _const_extra_metas_inc 4 +#define _const_prealloc_block_size 16777216 +#define _const_degree 6 +#define _const_mid_index 5 +#define _const_max_len 11 +string _const_si_s_code; // a string literal, inited later +string _const_si_g32_code; // a string literal, inited later +string _const_si_g64_code; // a string literal, inited later +#define _const_cp_utf8 65001 +#define _const_v__token__max_keyword_len 20 +string _const_time__days_string; // a string literal, inited later +string _const_time__months_string; // a string literal, inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +#define _const_time__days_in_year 365 +#define _const_rand__constants__max_u32 4294967295 +string _const_flag__space; // a string literal, inited later +string _const_flag__underline; // a string literal, inited later +#define _const_flag__max_args_number 4048 +#define _const_semver__ver_major 0 +#define _const_semver__ver_minor 1 +#define _const_semver__ver_patch 2 +string _const_semver__comparator_sep; // a string literal, inited later +string _const_semver__comparator_set_sep; // a string literal, inited later +string _const_semver__hyphen_range_sep; // a string literal, inited later +string _const_semver__x_range_symbols; // a string literal, inited later +#define _const_sync__stdatomic__used 1 +#define _const_os__o_rdonly 0 +#define _const_os__o_wronly 1 +#define _const_os__o_rdwr 2 +#define _const_os__o_binary 0 +#define _const_os__o_create 64 +#define _const_os__o_excl 128 +#define _const_os__o_noctty 256 +#define _const_os__o_trunc 512 +#define _const_os__o_append 1024 +#define _const_os__o_nonblock 2048 +#define _const_os__o_sync 1052672 +#define _const_os__bslash '\\' +string _const_os__fslash_str; // a string literal, inited later +string _const_os__dot_dot; // a string literal, inited later +string _const_os__empty_str; // a string literal, inited later +string _const_os__dot_str; // a string literal, inited later +#define _const_os__max_path_len 4096 +#define _const_os__f_ok 0 +#define _const_os__x_ok 1 +#define _const_os__w_ok 2 +#define _const_os__r_ok 4 +#define _const_os__prot_read 1 +#define _const_os__prot_write 2 +#define _const_os__map_private 2 +#define _const_os__map_anonymous 32 +#define _const_os__sys_write 1 +#define _const_os__sys_open 2 +#define _const_os__sys_close 3 +#define _const_os__sys_mkdir 83 +#define _const_os__sys_creat 85 +string _const_os__path_separator; // a string literal, inited later +string _const_os__path_delimiter; // a string literal, inited later +#define _const_os__stdin_value 0 +#define _const_os__stdout_value 1 +#define _const_os__stderr_value 2 +#define _const_os__s_ifmt 61440 +#define _const_os__s_ifdir 16384 +#define _const_os__s_iflnk 40960 +#define _const_os__s_isuid 2048 +#define _const_os__s_isgid 1024 +#define _const_os__s_isvtx 512 +#define _const_os__s_irusr 256 +#define _const_os__s_iwusr 128 +#define _const_os__s_ixusr 64 +#define _const_os__s_irgrp 32 +#define _const_os__s_iwgrp 16 +#define _const_os__s_ixgrp 8 +#define _const_os__s_iroth 4 +#define _const_os__s_iwoth 2 +#define _const_os__s_ixoth 1 +#define _const_term__default_columns_size 80 +#define _const_term__default_rows_size 25 +string _const_v__util__version__v_version; // a string literal, inited later +string _const_v__vmod__err_label; // a string literal, inited later +string _const_v__cflag__fexisting_literal; // a string literal, inited later +#define _const_rand__wyrand__seed_len 2 +string _const_v__pkgconfig__version; // a string literal, inited later +string _const_rand__ulid_encoding; // a string literal, inited later +string _const_rand__english_letters; // a string literal, inited later +string _const_rand__hex_chars; // a string literal, inited later +string _const_rand__ascii_chars; // a string literal, inited later +#define _const_sync__aops_used 1 +#define _const_sync__spinloops 750 +#define _const_sync__spinloops_sem 4000 +string _const_help__unknown_topic; // a string literal, inited later +#define _const_v__util__error_context_before 2 +#define _const_v__util__error_context_after 2 +#define _const_v__util__backslash 92 +#define _const_v__util__backslash_r 13 +#define _const_v__util__backslash_n 10 +#define _const_v__util__double_quote 34 +string _const_v__util__double_escape; // a string literal, inited later +string _const_v__util__map_prefix; // a string literal, inited later +#define _const_v__ast__invalid_type_idx -1 +#define _const_v__ast__void_type_idx 1 +#define _const_v__ast__voidptr_type_idx 2 +#define _const_v__ast__byteptr_type_idx 3 +#define _const_v__ast__charptr_type_idx 4 +#define _const_v__ast__i8_type_idx 5 +#define _const_v__ast__i16_type_idx 6 +#define _const_v__ast__int_type_idx 7 +#define _const_v__ast__i64_type_idx 8 +#define _const_v__ast__isize_type_idx 9 +#define _const_v__ast__byte_type_idx 10 +#define _const_v__ast__u16_type_idx 11 +#define _const_v__ast__u32_type_idx 12 +#define _const_v__ast__u64_type_idx 13 +#define _const_v__ast__usize_type_idx 14 +#define _const_v__ast__f32_type_idx 15 +#define _const_v__ast__f64_type_idx 16 +#define _const_v__ast__char_type_idx 17 +#define _const_v__ast__bool_type_idx 18 +#define _const_v__ast__none_type_idx 19 +#define _const_v__ast__string_type_idx 20 +#define _const_v__ast__rune_type_idx 21 +#define _const_v__ast__array_type_idx 22 +#define _const_v__ast__map_type_idx 23 +#define _const_v__ast__chan_type_idx 24 +#define _const_v__ast__any_type_idx 25 +#define _const_v__ast__float_literal_type_idx 26 +#define _const_v__ast__int_literal_type_idx 27 +#define _const_v__ast__thread_type_idx 28 +#define _const_v__ast__error_type_idx 29 +#define _const_v__checker__expr_level_cutoff_limit 40 +#define _const_v__checker__stmt_level_cutoff_limit 40 +#define _const_v__checker__iface_level_cutoff_limit 100 +string _const_v__checker__vroot_is_deprecated_message; // a string literal, inited later +string _const_v__checker__unicode_lit_overflow_message; // a string literal, inited later +string _const_v__gen__c__si_s_code; // a string literal, inited later +string _const_v__gen__c__result_name; // a string literal, inited later +string _const_v__gen__c__option_name; // a string literal, inited later +string _const_v__gen__c__c_commit_hash_default; // a string literal, inited later +string _const_v__gen__c__c_current_commit_hash_default; // a string literal, inited later +string _const_v__gen__c__c_concurrency_helpers; // a string literal, inited later +string _const_v__gen__c__c_common_macros; // a string literal, inited later +string _const_v__gen__c__c_unsigned_comparison_functions; // a string literal, inited later +string _const_v__gen__c__c_helper_macros; // a string literal, inited later +string _const_v__gen__c__c_headers; // str inited later +string _const_v__gen__c__c_builtin_types; // a string literal, inited later +string _const_v__gen__c__c_bare_headers; // str inited later +string _const_v__gen__c__c_wyhash_headers; // a string literal, inited later +string _const_v__gen__c__closure_ctx; // a string literal, inited later +string _const_v__gen__c__posix_hotcode_definitions_1; // a string literal, inited later +string _const_v__gen__c__windows_hotcode_definitions_1; // a string literal, inited later +#define _const_v__scanner__single_quote '\'' +#define _const_v__scanner__double_quote '"' +#define _const_v__scanner__b_lf 10 +#define _const_v__scanner__b_cr 13 +#define _const_v__scanner__backslash '\\' +#define _const_v__parser__max_expr_level 100 +#define _const_v__parser__maximum_inline_sum_type_variants 3 +string _const_v__parser__tmpl_str_end; // a string literal, inited later +string _const_v__builder__c_verror_message_marker; // a string literal, inited later +string _const_v__builder__c_error_info; // a string literal, inited later +string _const_v__builder__no_compiler_error; // a string literal, inited later +#define _const_v__builder__key_query_value 1 +#define _const_v__builder__key_wow64_32key 512 +#define _const_v__builder__key_enumerate_sub_keys 8 +u32 _const_math__bits__de_bruijn32 = 125613361; // precomputed +Array_u8 _const_math__bits__de_bruijn32tab; // inited later +u64 _const_math__bits__de_bruijn64 = 285870213051353865U; // precomputed +Array_u8 _const_math__bits__de_bruijn64tab; // inited later +u64 _const_math__bits__m0 = 6148914691236517205U; // precomputed +u64 _const_math__bits__m1 = 3689348814741910323U; // precomputed +u64 _const_math__bits__m2 = 1085102592571150095U; // precomputed +u64 _const_math__bits__m3 = 71777214294589695U; // precomputed +u64 _const_math__bits__m4 = 281470681808895U; // precomputed +u32 _const_math__bits__max_u32 = 4294967295; // precomputed +u64 _const_math__bits__max_u64 = 18446744073709551615U; // precomputed +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 +u64 _const_math__bits__two32 = 4294967296U; // precomputed +u64 _const_math__bits__mask32 = 4294967295U; // precomputed +Array_u8 _const_math__bits__ntz_8_tab; // inited later +Array_u8 _const_math__bits__pop_8_tab; // inited later +Array_u8 _const_math__bits__rev_8_tab; // inited later +Array_u8 _const_math__bits__len_8_tab; // inited later +u32 _const_strconv__single_plus_zero = 0; // precomputed +u32 _const_strconv__single_minus_zero = 2147483648; // precomputed +u32 _const_strconv__single_plus_infinity = 2139095040; // precomputed +u32 _const_strconv__single_minus_infinity = 4286578688; // precomputed +u64 _const_strconv__double_plus_zero = 0U; // precomputed +u64 _const_strconv__double_minus_zero = 9223372036854775808U; // precomputed +u64 _const_strconv__double_plus_infinity = 9218868437227405312U; // precomputed +u64 _const_strconv__double_minus_infinity = 18442240474082181120U; // precomputed +rune _const_strconv__c_dpoint = '.'; // precomputed +rune _const_strconv__c_plus = '+'; // precomputed +rune _const_strconv__c_minus = '-'; // precomputed +rune _const_strconv__c_zero = '0'; // precomputed +rune _const_strconv__c_nine = '9'; // precomputed +u32 _const_strconv__c_ten = 10; // precomputed +Array_u64 _const_strconv__pos_exp; // inited later +Array_u64 _const_strconv__neg_exp; // inited later +u64 _const_strconv__max_u64 = 18446744073709551615U; // precomputed +Array_u32 _const_strconv__ten_pow_table_32; // inited later +u32 _const_strconv__mantbits32 = 23; // precomputed +u32 _const_strconv__expbits32 = 8; // precomputed +Array_u64 _const_strconv__ten_pow_table_64; // inited later +u32 _const_strconv__mantbits64 = 52; // precomputed +u32 _const_strconv__expbits64 = 11; // precomputed +Array_f64 _const_strconv__dec_round; // inited later +Array_u64 _const_strconv__powers_of_10; // inited later +Array_u64 _const_strconv__pow5_split_32; // inited later +Array_u64 _const_strconv__pow5_inv_split_32; // inited later +Array_strconv__Uint128 _const_strconv__pow5_split_64; // inited later +Array_strconv__Uint128 _const_strconv__pow5_inv_split_64; // inited later +i64 total_m = ((i64)(0)); // global4 + +int g_main_argc = ((int)(0)); // global4 + +voidptr g_main_argv = ((voidptr)(0)); // global4 + +Array_VCastTypeIndexName as_cast_type_indexes; // global4 + +f64 _const_max_load_factor = 0.8; // precomputed +u32 _const_hash_mask = 16777215; // precomputed +u32 _const_probe_inc = 16777216; // precomputed +IError _const_none__; // inited later +VMemoryBlock* g_memory_block; // global4 + +Array_v__token__Kind _const_v__token__assign_tokens; // inited later +Array_string _const_v__token__valid_at_tokens; // inited later +Array_string _const_v__token__token_str; // inited later +Map_string_v__token__Kind _const_v__token__keywords; // inited later +Array_v__token__Precedence _const_v__token__precedences; // inited later +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +Array_int _const_time__days_before; // inited later +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__infinite; // inited later +u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed +u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed +u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed +u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed +u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed +u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed +u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed +u32 _const_rand__constants__u31_mask = 2147483647; // precomputed +u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed +u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed +u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed +u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed +u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed +rune _const_os__fslash = '/'; // precomputed +rune _const_os__dot = '.'; // precomputed +rune _const_os__qmark = '?'; // precomputed +Array_string _const_os__args; // inited later +string _const_os__wd_at_startup; // inited later +Array_string _const_v__vmod__mod_file_stop_paths; // inited later +v__vmod__ModFileCacher* _const_v__vmod__private_file_cacher; // inited later +u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed +u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed +Array_string _const_v__pkgconfig__default_paths; // inited later +f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed +Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later +rand__PRNG* default_rng; // global4 + +Array_string _const_v__pref__list_of_flags_with_param; // inited later +v__util__EManager* _const_v__util__emanager; // inited later +string _const_v__util__normalised_workdir; // inited later +v__util__LinesCache* lines_cache; // global4 + +Array_u8 _const_v__util__invalid_escapes; // inited later +v__util__Timers* g_timers; // global4 + +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 +voidptr _const_sync__pool__no_result; // inited later +Map_int_Array_string _const_v__ast__x86_no_number_register_list; // inited later +Map_int_Map_string_int _const_v__ast__x86_with_number_register_list; // inited later +Array_string _const_v__ast__arm_no_number_register_list; // inited later +Map_string_int _const_v__ast__arm_with_number_register_list; // inited later +Array_string _const_v__ast__riscv_no_number_register_list; // inited later +Map_string_int _const_v__ast__riscv_with_number_register_list; // inited later +Array_string _const_v__ast__native_builtins; // inited later +v__ast__Table* global_table = ((v__ast__Table*)(0)); // global4 + +Array_string _const_v__ast__builtin_type_names; // inited later +v__ast__Type _const_v__ast__ovoid_type; // inited later +v__ast__Type _const_v__ast__rvoid_type; // inited later +int _const_v__checker__int_min; // inited later +int _const_v__checker__int_max = 2147483647; // precomputed +Array_string _const_v__checker__valid_comptime_if_os; // inited later +Array_string _const_v__checker__valid_comptime_compression_types; // inited later +Array_string _const_v__checker__valid_comptime_if_compilers; // inited later +Array_string _const_v__checker__valid_comptime_if_platforms; // inited later +Array_string _const_v__checker__valid_comptime_if_cpu_features; // inited later +Array_string _const_v__checker__valid_comptime_if_other; // inited later +Array_string _const_v__checker__array_builtin_methods; // inited later +Array_string _const_v__checker__reserved_type_names; // inited later +IError _const_v__gen__c__unsupported_ctemp_assert_transform; // inited later +Array_string _const_v__gen__c__c_reserved; // inited later +Array_string _const_v__gen__c__cmp_str; // inited later +Array_string _const_v__gen__c__cmp_rev; // inited later +Array_string _const_v__gen__c__skip_struct_init; // inited later +rune _const_v__scanner__num_sep = '_'; // precomputed +Array_string _const_v__parser__supported_comptime_calls; // inited later +Array_string _const_v__parser__comptime_types; // inited later +Array_v__ast__File_ptr codegen_files; // global4 + +Array_v__token__Kind _const_v__parser__valid_tokens_inside_types; // inited later +v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later +Array_string _const_main__external_tools; // inited later +Array_string _const_main__list_of_flags_that_allow_duplicates; // inited later +u32 _const_children_bytes; // inited later +v__token__KeywordsMatcher _const_v__token__matcher; // inited later +time__Duration _const_time__microsecond; // inited later +f32 _const_rand__constants__max_u32_as_f32; // inited later +f64 _const_rand__constants__max_u64_as_f64; // inited later +Array_int _const_semver__versions; // inited later +string _const_v__pref__default_module_path; // inited later +v__ast__TypeSymbol* _const_v__ast__invalid_type_symbol; // inited later +v__token__KeywordsMatcher _const_v__ast__builtin_type_names_matcher; // inited later +Array_int _const_v__ast__integer_type_idxs; // inited later +Array_int _const_v__ast__signed_integer_type_idxs; // inited later +Array_int _const_v__ast__unsigned_integer_type_idxs; // inited later +Array_int _const_v__ast__int_promoted_type_idxs; // inited later +Array_int _const_v__ast__float_type_idxs; // inited later +Array_int _const_v__ast__number_type_idxs; // inited later +Array_int _const_v__ast__pointer_type_idxs; // inited later +Array_int _const_v__ast__string_type_idxs; // inited later +v__ast__Type _const_v__ast__void_type; // inited later +v__ast__Type _const_v__ast__voidptr_type; // inited later +v__ast__Type _const_v__ast__byteptr_type; // inited later +v__ast__Type _const_v__ast__charptr_type; // inited later +v__ast__Type _const_v__ast__i8_type; // inited later +v__ast__Type _const_v__ast__int_type; // inited later +v__ast__Type _const_v__ast__i16_type; // inited later +v__ast__Type _const_v__ast__i64_type; // inited later +v__ast__Type _const_v__ast__isize_type; // inited later +v__ast__Type _const_v__ast__byte_type; // inited later +v__ast__Type _const_v__ast__u16_type; // inited later +v__ast__Type _const_v__ast__u32_type; // inited later +v__ast__Type _const_v__ast__u64_type; // inited later +v__ast__Type _const_v__ast__usize_type; // inited later +v__ast__Type _const_v__ast__f32_type; // inited later +v__ast__Type _const_v__ast__f64_type; // inited later +v__ast__Type _const_v__ast__char_type; // inited later +v__ast__Type _const_v__ast__bool_type; // inited later +v__ast__Type _const_v__ast__none_type; // inited later +v__ast__Type _const_v__ast__string_type; // inited later +v__ast__Type _const_v__ast__rune_type; // inited later +v__ast__Type _const_v__ast__array_type; // inited later +v__ast__Type _const_v__ast__map_type; // inited later +v__ast__Type _const_v__ast__chan_type; // inited later +v__ast__Type _const_v__ast__any_type; // inited later +v__ast__Type _const_v__ast__float_literal_type; // inited later +v__ast__Type _const_v__ast__int_literal_type; // inited later +v__ast__Type _const_v__ast__thread_type; // inited later +v__ast__Type _const_v__ast__error_type; // inited later +Array_string _const_v__checker__valid_comptime_not_user_defined; // inited later +Map_string_bool _const_v__gen__c__c_reserved_map; // inited later +Array_string _const_v__gen__c__builtins; // inited later +time__Duration _const_time__millisecond; // inited later +Array_v__ast__Type _const_v__ast__charptr_types; // inited later +Array_v__ast__Type _const_v__ast__byteptr_types; // inited later +Array_v__ast__Type _const_v__ast__voidptr_types; // inited later +time__Duration _const_time__second; // inited later +Array_v__ast__Type _const_v__ast__cptr_types; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later + // V interface table: static IError I_None___to_Interface_IError(None__* x); const int _IError_None___index = 0; @@ -10980,67 +11024,6 @@ static inline void __sort_ptr(uintptr_t a[], bool b[], int l) { } } -// V stringliterals: - -// >> string literal consts -void vinit_string_literals(void){ - _const_math__bits__overflow_error = _SLIT("Overflow Error"); - _const_math__bits__divide_error = _SLIT("Divide Error"); - _const_strconv__digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); - _const_strconv__base_digits = _SLIT("0123456789abcdefghijklmnopqrstuvwxyz"); - _const_digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); - _const_si_s_code = _SLIT("0xfe10"); - _const_si_g32_code = _SLIT("0xfe0e"); - _const_si_g64_code = _SLIT("0xfe0f"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); - _const_flag__space = _SLIT(" "); - _const_flag__underline = _SLIT("-----------------------------------------------"); - _const_semver__comparator_sep = _SLIT(" "); - _const_semver__comparator_set_sep = _SLIT(" || "); - _const_semver__hyphen_range_sep = _SLIT(" - "); - _const_semver__x_range_symbols = _SLIT("Xx*"); - _const_os__fslash_str = _SLIT("/"); - _const_os__dot_dot = _SLIT(".."); - _const_os__empty_str = _SLIT(""); - _const_os__dot_str = _SLIT("."); - _const_os__path_separator = _SLIT("/"); - _const_os__path_delimiter = _SLIT(":"); - _const_v__util__version__v_version = _SLIT("0.2.4"); - _const_v__vmod__err_label = _SLIT("vmod:"); - _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); - _const_v__pkgconfig__version = _SLIT("0.3.2"); - _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); - _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); - _const_rand__hex_chars = _SLIT("abcdef0123456789"); - _const_rand__ascii_chars = _SLIT("!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~"); - _const_help__unknown_topic = _SLIT("`v help`: unknown help topic provided. Use `v help` for usage information."); - _const_v__util__double_escape = _SLIT("\\\\"); - _const_v__util__map_prefix = _SLIT("map[string]"); - _const_v__checker__vroot_is_deprecated_message = _SLIT("@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead"); - _const_v__checker__unicode_lit_overflow_message = _SLIT("unicode character exceeds max allowed value of 0x10ffff, consider using a unicode literal (\\u####)"); - _const_v__gen__c__si_s_code = _SLIT("0xfe10"); - _const_v__gen__c__result_name = _SLIT("_result"); - _const_v__gen__c__option_name = _SLIT("_option"); - _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); - _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); - _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); - _const_v__gen__c__c_common_macros = _SLIT("\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\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n\011#define __V_arm32 1\n\011#undef __V_architecture\n\011#define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n\011#define __V_x86 1\n\011#undef __V_architecture\n\011#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\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#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\011#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\011#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\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#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\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n\011#if defined(__MINGW32__) || defined(__MINGW64__)\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); - _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\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"); - _const_v__gen__c__c_helper_macros = _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"); - _const_v__gen__c__c_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\n"); - _const_v__gen__c__c_wyhash_headers = _SLIT("\n// ============== wyhash ==============\n#ifndef wyhash_final_version_3\n#define wyhash_final_version_3\n\n#ifndef WYHASH_CONDOM\n// protections that produce different results:\n// 1: normal valid behavior\n// 2: extra protection against entropy loss (probability=2^-63), aka. \"blind multiplication\"\n#define WYHASH_CONDOM 1\n#endif\n\n#ifndef WYHASH_32BIT_MUM\n// 0: normal version, slow on 32 bit systems\n// 1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function\n#define WYHASH_32BIT_MUM 0\n#endif\n\n// includes\n#include \n#if defined(_MSC_VER) && defined(_M_X64)\n\011#include \n\011#pragma intrinsic(_umul128)\n#endif\n\n// 128bit multiply function\nstatic inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); }\nstatic inline void _wymum(uint64_t *A, uint64_t *B){\n#if(WYHASH_32BIT_MUM)\n\011uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll;\n\011#else\n\011*A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll;\n\011#endif\n#elif defined(__SIZEOF_INT128__) && !defined(VWASM)\n\011__uint128_t r=*A; r*=*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=(uint64_t)r; *B^=(uint64_t)(r>>64);\n\011#else\n\011*A=(uint64_t)r; *B=(uint64_t)(r>>64);\n\011#endif\n#elif defined(_MSC_VER) && defined(_M_X64)\n\011#if(WYHASH_CONDOM>1)\n\011uint64_t a, b;\n\011a=_umul128(*A,*B,&b);\n\011*A^=a; *B^=b;\n\011#else\n\011*A=_umul128(*A,*B,B);\n\011#endif\n#else\n\011uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo;\n\011uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t>32)+(rm1>>32)+c;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=lo; *B^=hi;\n\011#else\n\011*A=lo; *B=hi;\n\011#endif\n#endif\n}\n\n// multiply and xor mix function, aka MUM\nstatic inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; }\n\n// endian macros\n#ifndef WYHASH_LITTLE_ENDIAN\n\011#ifdef TARGET_ORDER_IS_LITTLE\n\011\011#define WYHASH_LITTLE_ENDIAN 1\n\011#else\n\011\011#define WYHASH_LITTLE_ENDIAN 0\n\011#endif\n#endif\n\n// read functions\n#if (WYHASH_LITTLE_ENDIAN)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;}\n#elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);}\n#elif defined(_MSC_VER)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);}\n#else\n\011static inline uint64_t _wyr8(const uint8_t *p) {\n\011\011uint64_t v; memcpy(&v, p, 8);\n\011\011return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000));\n\011}\n\011static inline uint64_t _wyr4(const uint8_t *p) {\n\011\011uint32_t v; memcpy(&v, p, 4);\n\011\011return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000));\n\011}\n#endif\nstatic inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];}\n// wyhash main function\nstatic inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){\n\011const uint8_t *p=(const uint8_t *)key; seed^=*secret;\011uint64_t a, b;\n\011if (_likely_(len<=16)) {\n\011\011if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); }\n\011\011else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; }\n\011\011else a=b=0;\n\011} else {\n\011\011size_t i=len;\n\011\011if (_unlikely_(i>48)) {\n\011\011\011uint64_t see1=seed, see2=seed;\n\011\011\011do {\n\011\011\011\011seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed);\n\011\011\011\011see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1);\n\011\011\011\011see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2);\n\011\011\011\011p+=48; i-=48;\n\011\011\011} while(_likely_(i>48));\n\011\011\011seed^=see1^see2;\n\011\011}\n\011\011while(_unlikely_(i>16)) { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; }\n\011\011a=_wyr8(p+i-16); b=_wyr8(p+i-8);\n\011}\n\011return _wymix(secret[1]^len,_wymix(a^secret[1],b^seed));\n}\n// the default secret parameters\nstatic const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};\n\n// a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand\nstatic inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642full; B^=0xe7037ed1a0b428dbull; _wymum(&A,&B); return _wymix(A^0xa0761d6478bd642full,B^0xe7037ed1a0b428dbull);}\n\n// the wyrand PRNG that pass BigCrush and PractRand\nstatic inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}\n\n#ifndef __vinix__\n// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;}\n\n// convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;}\n#endif\n\n#if(!WYHASH_32BIT_MUM)\n// fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; }\n#endif\n#endif\n\n#define _IN_MAP(val, m) map_exists(m, val)\n\n"); - _const_v__gen__c__closure_ctx = _SLIT("_V_closure_ctx"); - _const_v__gen__c__posix_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); - _const_v__gen__c__windows_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); - _const_v__parser__tmpl_str_end = _SLIT("')\n"); - _const_v__builder__c_verror_message_marker = _SLIT("VERROR_MESSAGE "); - _const_v__builder__c_error_info = _SLIT("\n==================\nC error. This should never happen.\n\nThis is a compiler bug, please report it using `v bug file.v`.\n\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use #help on Discord: https://discord.gg/vlang\n"); - _const_v__builder__no_compiler_error = _SLIT("\n==================\nError: no C compiler detected.\n\nYou can find instructions on how to install one in the V wiki:\nhttps://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows\n\nIf you think you have one installed, make sure it is in your PATH.\nIf you do have one in your PATH, please raise an issue on GitHub:\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use `v doctor`, to see what V knows about your current environment.\n\nYou can also seek #help on Discord: https://discord.gg/vlang\n"); -} -// << string literal consts - - // V auto str functions: static string time__FormatTime_str(time__FormatTime it) { /* gen_str_for_enum */ switch(it) { @@ -11098,7 +11081,7 @@ static string indent_Array_v__ast__Expr_str(Array_v__ast__Expr a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Expr it = *(v__ast__Expr*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Expr_str( it); + string x = v__ast__Expr_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11146,7 +11129,7 @@ static string indent_Array_v__ast__Attr_str(Array_v__ast__Attr a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Attr it = *(v__ast__Attr*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Attr_str( & it); + string x = v__ast__Attr_str(&it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11164,7 +11147,7 @@ static string indent_Array_v__ast__Type_str(Array_v__ast__Type a, int indent_cou for (int i = 0; i < a.len; ++i) { int it = *(int*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = int_str( it); + string x = int_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11258,7 +11241,7 @@ static string indent_Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a, int inde for (int i = 0; i < a.len; ++i) { v__cflag__CFlag it = *(v__cflag__CFlag*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__cflag__CFlag_str( & it); + string x = v__cflag__CFlag_str(&it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11296,7 +11279,7 @@ static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int inde for (int i = 0; i < a.len; ++i) { v__ast__CallArg it = *(v__ast__CallArg*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__CallArg_str( it); + string x = v__ast__CallArg_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11362,7 +11345,7 @@ static string indent_Array_v__ast__Stmt_str(Array_v__ast__Stmt a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Stmt it = *(v__ast__Stmt*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Stmt_str( it); + string x = v__ast__Stmt_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11578,30 +11561,32 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); string _t18 = indent_Array_v__ast__Param_str(it.params, indent_count + 1); string _t19 = Array_string_str(it.generic_names); - string _t20 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t21 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t22 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); - string _t23 = v__ast__Type_str(it.return_type); - string _t24 = v__ast__Type_str(it.receiver_type); - string _t25 = v__ast__Language_str(it.language); - string _t26 = v__ast__Language_str(it.file_mode); - string res = str_intp( 115, _MOV((StrIntpData[]){ + string _t20 = Array_string_str(it.dep_names); + string _t21 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t22 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t23 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); + string _t24 = v__ast__Type_str(it.return_type); + string _t25 = v__ast__Type_str(it.receiver_type); + string _t26 = v__ast__Language_str(it.language); + string _t27 = v__ast__Language_str(it.file_mode); + string res = str_intp( 119, _MOV((StrIntpData[]){ {_SLIT("v.ast.Fn{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" params: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t18}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t19}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" dep_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t21}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" mod: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.mod}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.file}}, {_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=_t21}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" usages: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.usages}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" ctdefine_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.ctdefine_idx}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" source_fn: "), 0, {.d_c=0}}, {_SLIT(""), 17, {.d_p=(voidptr) it.source_fn}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t27}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_variadic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_variadic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_pub: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_pub ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_ctor_new: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_ctor_new ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11617,6 +11602,7 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_conditional: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_conditional ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t27); string_free(&_t26); string_free(&_t25); string_free(&_t24); @@ -11647,30 +11633,30 @@ static string indent_v__token__Pos_str(v__token__Pos it, int indent_count) { static string indent_v__gen__c__StrType_str(v__gen__c__StrType it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t27 = v__ast__Type_str(it.typ); + string _t28 = v__ast__Type_str(it.typ); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.gen.c.StrType{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" styp: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.styp}}, {_SLIT("'"), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t27}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t28}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t27); + string_free(&_t28); string_free(&indents); return res; } static string indent_v__ast__Enum_str(v__ast__Enum it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t28 = Array_string_str(it.vals); + string _t29 = Array_string_str(it.vals); string res = str_intp( 19, _MOV((StrIntpData[]){ {_SLIT("v.ast.Enum{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" vals: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t28}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" vals: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t29}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_flag: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_flag ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi_allowed: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi_allowed ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" uses_exprs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.uses_exprs ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t28); + string_free(&_t29); string_free(&indents); return res; } @@ -11735,13 +11721,13 @@ static string indent_v__ast__ComptTimeConstValue_str(v__ast__ComptTimeConstValue static string indent_v__builder__CcompilerOptions_str(v__builder__CcompilerOptions it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t29 = Array_string_str(it.args); - string _t30 = Array_string_str(it.wargs); - string _t31 = Array_string_str(it.pre_args); - string _t32 = Array_string_str(it.o_args); - string _t33 = Array_string_str(it.source_args); - string _t34 = Array_string_str(it.post_args); - string _t35 = Array_string_str(it.linker_flags); + string _t30 = Array_string_str(it.args); + string _t31 = Array_string_str(it.wargs); + string _t32 = Array_string_str(it.pre_args); + string _t33 = Array_string_str(it.o_args); + string _t34 = Array_string_str(it.source_args); + string _t35 = Array_string_str(it.post_args); + string _t36 = Array_string_str(it.linker_flags); string res = str_intp( 67, _MOV((StrIntpData[]){ {_SLIT("v.builder.CcompilerOptions{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" guessed_compiler: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.guessed_compiler}}, {_SLIT("'"), 0, {.d_c=0}}, @@ -11753,148 +11739,134 @@ static string indent_v__builder__CcompilerOptions_str(v__builder__CcompilerOptio {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_cc_clang: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_cc_clang ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" env_cflags: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.env_cflags}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" env_ldflags: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.env_ldflags}}, {_SLIT("'"), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t29}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" wargs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t30}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pre_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t31}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" o_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t32}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" source_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t33}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" post_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t34}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" linker_flags: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t35}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t30}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" wargs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t31}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pre_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t32}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" o_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t33}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" source_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t34}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" post_args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t35}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" linker_flags: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t36}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t36); string_free(&_t35); string_free(&_t34); string_free(&_t33); string_free(&_t32); string_free(&_t31); string_free(&_t30); - string_free(&_t29); string_free(&indents); return res; } static string indent_v__ast__OrExpr_str(v__ast__OrExpr it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t36 = indent_Array_v__ast__Stmt_str(it.stmts, indent_count + 1); - string _t37 = v__ast__OrKind_str(it.kind); - string _t38 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t37 = indent_Array_v__ast__Stmt_str(it.stmts, indent_count + 1); + string _t38 = v__ast__OrKind_str(it.kind); + string _t39 = indent_v__token__Pos_str(it.pos, indent_count + 1); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.OrExpr{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" stmts: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t36}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" kind: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t37}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" stmts: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t37}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" kind: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t39}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t39); string_free(&_t38); string_free(&_t37); - string_free(&_t36); string_free(&indents); return res; } static string indent_v__ast__Aggregate_str(v__ast__Aggregate it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t39 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t40 = v__ast__Type_str(it.sum_type); - string _t41 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t40 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t41 = v__ast__Type_str(it.sum_type); + string _t42 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.Aggregate{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t39}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" sum_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t40}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t41}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t40}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" sum_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t41}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t42}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t42); string_free(&_t41); string_free(&_t40); - string_free(&_t39); string_free(&indents); return res; } static string indent_v__ast__Alias_str(v__ast__Alias it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t42 = v__ast__Type_str(it.parent_type); - string _t43 = v__ast__Language_str(it.language); + string _t43 = v__ast__Type_str(it.parent_type); + string _t44 = v__ast__Language_str(it.language); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.Alias{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t42}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t43}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t43}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t44}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_import: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_import ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t44); string_free(&_t43); - string_free(&_t42); string_free(&indents); return res; } static string indent_v__ast__Array_str(v__ast__Array it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t44 = v__ast__Type_str(it.elem_type); + string _t45 = v__ast__Type_str(it.elem_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Array{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" nr_dims: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.nr_dims}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t44}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t45}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t44); + string_free(&_t45); string_free(&indents); return res; } static string indent_v__ast__ArrayFixed_str(v__ast__ArrayFixed it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t45 = v__ast__Expr_str(it.size_expr); - string _t46 = v__ast__Type_str(it.elem_type); + string _t46 = v__ast__Expr_str(it.size_expr); + string _t47 = v__ast__Type_str(it.elem_type); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.ArrayFixed{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t45}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t46}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" size: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.size}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t46}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t47); string_free(&_t46); - string_free(&_t45); string_free(&indents); return res; } static string indent_v__ast__Chan_str(v__ast__Chan it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t47 = v__ast__Type_str(it.elem_type); + string _t48 = v__ast__Type_str(it.elem_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Chan{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_SLIT(""), 0, {.d_c=0}}, {_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("}"), 0, {.d_c=0}}, })); - string_free(&_t47); - string_free(&indents); - return res; -} - -static string indent_v__ast__FnType_str(v__ast__FnType it, int indent_count) { - string indents = string_repeat(_SLIT(" "), indent_count); - string _t48 = indent_v__ast__Fn_str(it.func, indent_count + 1); - string res = str_intp( 15, _MOV((StrIntpData[]){ - {_SLIT("v.ast.FnType{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_decl: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_decl ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" func: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, - })); string_free(&_t48); string_free(&indents); return res; } -static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_count) { +static string indent_v__ast__FnType_str(v__ast__FnType it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t49 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string res = str_intp( 11, _MOV((StrIntpData[]){ - {_SLIT("v.ast.GenericInst{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.parent_idx}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t49}}, {_SLIT(""), 0, {.d_c=0}}, + string _t49 = indent_v__ast__Fn_str(it.func, indent_count + 1); + string res = str_intp( 15, _MOV((StrIntpData[]){ + {_SLIT("v.ast.FnType{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_decl: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_decl ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" func: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t49}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t49); @@ -11902,29 +11874,44 @@ static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_ return res; } +static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_count) { + string indents = string_repeat(_SLIT(" "), indent_count); + string _t50 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string res = str_intp( 11, _MOV((StrIntpData[]){ + {_SLIT("v.ast.GenericInst{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.parent_idx}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t50}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, + })); + string_free(&_t50); + string_free(&indents); + return res; +} + static string indent_v__ast__Interface_str(v__ast__Interface it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t50 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); - string _t51 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); - string _t52 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t53 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); - string _t54 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); - string _t55 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t56 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t57 = v__ast__Type_str(it.parent_type); + string _t51 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t52 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t53 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t54 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); + string _t55 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); + string _t56 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t57 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t58 = v__ast__Type_str(it.parent_type); string res = str_intp( 39, _MOV((StrIntpData[]){ {_SLIT("v.ast.Interface{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t50}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t51}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t52}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t53}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t54}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t55}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t57}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t51}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t52}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t53}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t54}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t55}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t57}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t58}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t58); string_free(&_t57); string_free(&_t56); string_free(&_t55); @@ -11932,56 +11919,55 @@ static string indent_v__ast__Interface_str(v__ast__Interface it, int indent_coun string_free(&_t53); string_free(&_t52); string_free(&_t51); - string_free(&_t50); string_free(&indents); return res; } static string indent_v__ast__Map_str(v__ast__Map it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t58 = v__ast__Type_str(it.key_type); - string _t59 = v__ast__Type_str(it.value_type); + string _t59 = v__ast__Type_str(it.key_type); + string _t60 = v__ast__Type_str(it.value_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Map{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" key_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t58}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" value_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t59}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" key_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t59}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" value_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t60}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t60); string_free(&_t59); - string_free(&_t58); string_free(&indents); return res; } static string indent_v__ast__MultiReturn_str(v__ast__MultiReturn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t60 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t61 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); string res = str_intp( 7, _MOV((StrIntpData[]){ {_SLIT("v.ast.MultiReturn{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t60}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t61}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t60); + string_free(&_t61); string_free(&indents); return res; } static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t61 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t62 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); - string _t63 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t64 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t65 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t66 = v__ast__Type_str(it.parent_type); + string _t62 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t63 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); + string _t64 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t65 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t66 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t67 = v__ast__Type_str(it.parent_type); string res = str_intp( 47, _MOV((StrIntpData[]){ {_SLIT("v.ast.Struct{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t61}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t62}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t63}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t66}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t62}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t63}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t66}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t67}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_typedef: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_typedef ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_union: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_union ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_heap: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_heap ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11989,53 +11975,53 @@ static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t67); string_free(&_t66); string_free(&_t65); string_free(&_t64); string_free(&_t63); string_free(&_t62); - string_free(&_t61); string_free(&indents); return res; } static string indent_v__ast__SumType_str(v__ast__SumType it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t67 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t68 = indent_Array_v__ast__Type_str(it.variants, indent_count + 1); - string _t69 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t70 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t71 = v__ast__Type_str(it.parent_type); + string _t68 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t69 = indent_Array_v__ast__Type_str(it.variants, indent_count + 1); + string _t70 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t71 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t72 = v__ast__Type_str(it.parent_type); string res = str_intp( 35, _MOV((StrIntpData[]){ {_SLIT("v.ast.SumType{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t67}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t69}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t69}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" found_fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.found_fields ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t72); string_free(&_t71); string_free(&_t70); string_free(&_t69); string_free(&_t68); - string_free(&_t67); string_free(&indents); return res; } static string indent_v__ast__Thread_str(v__ast__Thread it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t72 = v__ast__Type_str(it.return_type); + string _t73 = v__ast__Type_str(it.return_type); string res = str_intp( 7, _MOV((StrIntpData[]){ {_SLIT("v.ast.Thread{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t72); + string_free(&_t73); string_free(&indents); return res; } @@ -12053,66 +12039,66 @@ static string indent_v__ast__EmptyExpr_str(v__ast__EmptyExpr it, int indent_coun static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t73 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t74 = indent_v__token__Pos_str(it.pos, indent_count + 1); string res = str_intp( 19, _MOV((StrIntpData[]){ {_SLIT("v.ast.Comment{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" text: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.text}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_inline: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_inline ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_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}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t73); + string_free(&_t74); string_free(&indents); return res; } static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t74 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t75 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t76 = v__ast__Type_str(it.typ); + string _t75 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t76 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); + string _t77 = v__ast__Type_str(it.typ); string res = str_intp( 31, _MOV((StrIntpData[]){ {_SLIT("v.ast.Param{\n"), 0, {.d_c=0}}, {_SLIT0, 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}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t75}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t76}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t75}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t76}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t77}}, {_SLIT(""), 0, {.d_c=0}}, {_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_auto_rec: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_auto_rec ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_hidden: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_hidden ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t77); string_free(&_t76); string_free(&_t75); - string_free(&_t74); string_free(&indents); return res; } static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t77 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); - string _t78 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t79 = v__ast__Expr_str(it.default_expr); - string _t80 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t81 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t82 = v__ast__Type_str(it.default_expr_typ); - string _t83 = v__ast__Type_str(it.typ); + string _t78 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t79 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t80 = v__ast__Expr_str(it.default_expr); + string _t81 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t82 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); + string _t83 = v__ast__Type_str(it.default_expr_typ); + string _t84 = v__ast__Type_str(it.typ); 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=_t77}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t78}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t78}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t79}}, {_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=_t79}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t80}}, {_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=_t80}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t81}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t81}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t82}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" i: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.i}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr_typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t82}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t83}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr_typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t83}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t84}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_default_expr ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_pub: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_pub ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_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}}, @@ -12121,13 +12107,13 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ {_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(&_t84); string_free(&_t83); string_free(&_t82); string_free(&_t81); string_free(&_t80); string_free(&_t79); string_free(&_t78); - string_free(&_t77); string_free(&indents); return res; } @@ -14035,6 +14021,7 @@ static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b) { 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) + && a.is_c2v_prefix == b.is_c2v_prefix && v__ast__Expr_sumtype_eq(a.expr, b.expr) && string__eq(a.auto_locked, b.auto_locked); } @@ -14989,6 +14976,7 @@ void Array_v__ast__Attr_free(Array_v__ast__Attr* it) { void v__ast__Fn_free(v__ast__Fn* it) { Array_v__ast__Param_free(&(it->params)); Array_string_free(&(it->generic_names)); + Array_string_free(&(it->dep_names)); Array_v__ast__Attr_free(&(it->attrs)); string_free(&(it->mod)); string_free(&(it->file)); @@ -15011,7 +14999,7 @@ void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) { string_free(&(it->mod)); } -VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void) { +VV_LOCAL_SYMBOL void anon_fn_6b7dbc3eb6b094a7__82(void) { println(_SLIT("}")); } @@ -15042,15 +15030,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 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_flag__UnkownFlagError_index) return 66099; + if (sidx == _IError_flag__ArgsCountError_index) return 66100; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66111; + if (sidx == _IError_semver__EmptyInputError_index) return 66113; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66114; 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; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 505; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -15462,21 +15450,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 499; + return 500; } 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 500; + return 501; } 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 501; + return 502; } 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"; @@ -15485,9 +15473,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 534; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66028; - return 532; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 537; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66029; + return 535; } // << typeof() support for sum types @@ -19541,6 +19529,9 @@ VV_LOCAL_SYMBOL void array_push(array* a, voidptr val) { // Attr: [unsafe] void array_push_many(array* a3, voidptr val, int size) { + if (size <= 0 || isnil(val)) { + return; + } array_ensure_cap(a3, a3->len + size); if (a3->data == val && a3->data != 0) { array copy = array_clone(a3); @@ -20214,6 +20205,61 @@ u8* malloc_noscan(isize n) { return res; } +// Attr: [unsafe] +u8* malloc_uncollectable(isize n) { + if (n <= 0) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("malloc_uncollectable("), /*100 &isize*/0xfe09, {.d_i64 = n}}, {_SLIT(" <= 0)"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + #if defined(CUSTOM_DEFINE_vplayground) + { + if (n > 10000) { + _v_panic(_SLIT("allocating more than 10 KB at once is not allowed in the V playground")); + VUNREACHABLE(); + } + if (total_m > 50 * 1024 * 1024) { + _v_panic(_SLIT("allocating more than 50 MB is not allowed in the V playground")); + VUNREACHABLE(); + } + } + #endif + #if defined(CUSTOM_DEFINE_trace_malloc) + { + total_m += n; + fprintf(stderr, "malloc_uncollectable %6d total %10d\n", n, total_m); + } + #endif + u8* res = ((u8*)(0)); + #if defined(_VPREALLOC) + { + return prealloc_malloc(n); + } + #elif defined(_VGCBOEHM) + { + { // Unsafe block + res = GC_MALLOC_UNCOLLECTABLE(n); + } + } + #elif defined(_VFREESTANDING) + { + } + #else + { + res = malloc(n); + } + #endif + if (res == 0) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("malloc_uncollectable("), /*100 &isize*/0xfe09, {.d_i64 = n}}, {_SLIT(") failed"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + #if defined(CUSTOM_DEFINE_debug_malloc) + { + memset(res, 0x4D, n); + } + #endif + return res; +} + // Attr: [unsafe] u8* v_realloc(u8* b, isize n) { #if defined(CUSTOM_DEFINE_trace_realloc) @@ -20401,6 +20447,18 @@ voidptr memdup_noscan(voidptr src, int sz) { return 0; } +// Attr: [unsafe] +voidptr memdup_uncollectable(voidptr src, int sz) { + if (sz == 0) { + return vcalloc(1); + } + { // Unsafe block + u8* mem = malloc_uncollectable(sz); + return memcpy(mem, src, sz); + } + return 0; +} + // Attr: [inline] inline VV_LOCAL_SYMBOL int v_fixed_index(int i, int len) { #if !defined(CUSTOM_DEFINE_no_bounds_checking) @@ -22919,7 +22977,7 @@ string string_replace_each(string s, Array_string vals) { if (idxs.len == 0) { return string_clone(s); } - qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_3079424758118292824_RepIndex_by_idx); + qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_5406533740619829871_RepIndex_by_idx); u8* b = malloc_noscan(new_len + 1); int idx_pos = 0; RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos]; @@ -25602,7 +25660,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_st } for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_11195941112940057302_v__token__WIndex_by_word); #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) { print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); @@ -25640,7 +25698,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw } for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_11195941112940057302_v__token__WIndex_by_word); #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) { print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); @@ -28517,7 +28575,7 @@ VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 se void v__dotgraph__start_digraph(void) { println(_SLIT("digraph G {")); - atexit((voidptr) anon_fn_6b9593b3d6ef610a__82); + atexit((voidptr) anon_fn_6b7dbc3eb6b094a7__82); } v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { @@ -32819,7 +32877,7 @@ _option_Array_string os__glob(Array_string patterns) { ; } - qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3677745349018262865_string); + qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_5811885252942183168_string); _option_Array_string _t4; opt_ok2(&(Array_string[]) { matches }, (_option*)(&_t4), sizeof(Array_string)); return _t4; @@ -34998,7 +35056,6 @@ void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, string dep = ((string*)deps.data)[_t1]; if (!Array_string_contains(d, dep)) { array_push((array*)&d, _MOV((string[]){ string_clone(dep) })); - } else { } } v__depgraph__OrderedDepMap_set(o, name, d); @@ -35055,13 +35112,20 @@ int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o) { } v__depgraph__DepGraph* v__depgraph__new_dep_graph(void) { - v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),}, sizeof(v__depgraph__DepGraph))); + v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),.values = new_map(sizeof(string), sizeof(i64), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__depgraph__DepGraph))); return _t1; } void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps) { - v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.deps = array_clone_to_depth(&deps, 0),}); + v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.value = 0,.deps = array_clone_to_depth(&deps, 0),}); array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); + map_set(&graph->values, &(string[]){mod}, &(i64[]) { 0 }); +} + +void v__depgraph__DepGraph_add_with_value(v__depgraph__DepGraph* graph, string mod, Array_string deps, i64 value) { + v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.value = value,.deps = array_clone_to_depth(&deps, 0),}); + array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); + map_set(&graph->values, &(string[]){mod}, &(i64[]) { value }); } v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph) { @@ -35090,7 +35154,7 @@ v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* grap g->acyclic = false; for (int _t4 = 0; _t4 < node_deps.keys.len; ++_t4) { string name = ((string*)node_deps.keys.data)[_t4]; - v__depgraph__DepGraph_add(g, name, v__depgraph__OrderedDepMap_get(&node_names, name)); + v__depgraph__DepGraph_add_with_value(g, name, v__depgraph__OrderedDepMap_get(&node_names, name), (*(i64*)map_get(ADDR(map, graph->values), &(string[]){name}, &(i64[]){ 0 }))); } v__depgraph__DepGraph* _t5 = g; return _t5; @@ -35099,7 +35163,7 @@ v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* grap string name = ((string*)ready_set.data)[_t6]; v__depgraph__OrderedDepMap_delete(&node_deps, name); Array_string resolved_deps = v__depgraph__OrderedDepMap_get(&node_names, name); - v__depgraph__DepGraph_add(resolved, name, resolved_deps); + v__depgraph__DepGraph_add_with_value(resolved, name, resolved_deps, (*(i64*)map_get(ADDR(map, graph->values), &(string[]){name}, &(i64[]){ 0 }))); } for (int _t7 = 0; _t7 < node_deps.keys.len; ++_t7) { string name = ((string*)node_deps.keys.data)[_t7]; @@ -35152,9 +35216,9 @@ string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph) { if (_IN_MAP(ADDR(string, k), ADDR(map, nn.is_cycle))) { continue; } - multi_return_bool_Array_string mr_3360 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); - seen = mr_3360.arg0; - cycle_names = mr_3360.arg1; + multi_return_bool_Array_string mr_3691 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); + seen = mr_3691.arg0; + cycle_names = mr_3691.arg1; if (seen) { array_push((array*)&out, _MOV((string[]){ string_clone(string__plus(_SLIT(" * "), Array_string_join(cycle_names, _SLIT(" -> ")))) })); nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) @@ -35185,9 +35249,9 @@ VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of for (int _t6 = 0; _t6 < deps.len; ++_t6) { string d = ((string*)deps.data)[_t6]; Array_string d_already_seen = array_clone_to_depth(&new_already_seen, 0); - multi_return_bool_Array_string mr_4093 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); - seen = mr_4093.arg0; - d_already_seen = mr_4093.arg1; + multi_return_bool_Array_string mr_4424 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); + seen = mr_4424.arg0; + d_already_seen = mr_4424.arg1; if (seen) { new_already_seen = array_clone_to_depth(&d_already_seen, 0); map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); @@ -37022,7 +37086,7 @@ _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args) { m->res = _const_v__pkgconfig__version; } else if (opt->listall) { Array_string modules = v__pkgconfig__list(); - qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10129308118656229290_string); + qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10487185186218018245_string); if (opt->description) { for (int _t1 = 0; _t1 < modules.len; ++_t1) { string mod = ((string*)modules.data)[_t1]; @@ -37178,9 +37242,9 @@ VV_LOCAL_SYMBOL v__pkgconfig__MainOptions* v__pkgconfig__parse_options(flag__Fla .description = flag__FlagParser_bool(fp, _SLIT("description"), 'd', false, _SLIT("show pkg module description")), .help = flag__FlagParser_bool(fp, _SLIT("help"), 'h', false, _SLIT("show this help message")), .debug = flag__FlagParser_bool(fp, _SLIT("debug"), 'D', false, _SLIT("show debug information")), - .listall = flag__FlagParser_bool(fp, _SLIT("list-all"), 'l', false, _SLIT("list all pkgmodules")), + .listall = flag__FlagParser_bool(fp, _SLIT("list-all"), 'p', false, _SLIT("list all pkgmodules")), .exists = flag__FlagParser_bool(fp, _SLIT("exists"), 'e', false, _SLIT("return 0 if pkg exists")), - .variables = flag__FlagParser_bool(fp, _SLIT("print-variables"), 'V', false, _SLIT("display variable names")), + .variables = flag__FlagParser_bool(fp, _SLIT("print-variables"), 'P', false, _SLIT("display variable names")), .requires = flag__FlagParser_bool(fp, _SLIT("print-requires"), 'r', false, _SLIT("display requires of the module")), .atleast = flag__FlagParser_string(fp, _SLIT("atleast-version"), 'a', _SLIT(""), _SLIT("return 0 if pkg version is at least the given one")), .atleastpc = flag__FlagParser_string(fp, _SLIT("atleast-pkgconfig-version"), 'A', _SLIT(""), _SLIT("return 0 if pkgconfig version is at least the given one")), @@ -38555,6 +38619,9 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { v__pref__Preferences_parse_define(p, _SLIT("gcboehm_opt")); } } + if (p->is_debug) { + v__pref__Preferences_parse_define(p, _SLIT("debug")); + } if (p->os == v__pref__OS___auto) { p->os = v__pref__get_host_os(); } @@ -38577,7 +38644,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("88d69dca7"); + string vhash = _SLIT("398db2138"); 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; @@ -39416,6 +39483,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } else if (string__eq(arg, _SLIT("-translated"))) { res->translated = true; + res->gc_mode = v__pref__GarbageCollectionMode__no_gc; } else if (string__eq(arg, _SLIT("-m32")) || string__eq(arg, _SLIT("-m64"))) { res->m64 = string_at(arg, 2) == '6'; @@ -39578,6 +39646,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } i++; } + else if (string__eq(arg, _SLIT("-is_o"))) { + res->is_o = true; + } else if (string__eq(arg, _SLIT("-b")) || string__eq(arg, _SLIT("-backend"))) { string sbackend = os__cmdline__option(current_args, arg, _SLIT("c")); array_push((array*)&res->build_options, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = sbackend}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); @@ -39668,9 +39739,6 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); }; } - if (res->is_debug) { - v__pref__Preferences_parse_define(res, _SLIT("debug")); - } if (string__eq(command, _SLIT("crun"))) { res->is_crun = true; } @@ -40009,7 +40077,7 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__P 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); - qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_11540237029762306605_string); + qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_15729605724654494396_string); Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0); for (int _t1 = 0; _t1 < files.len; ++_t1) { string file = ((string*)files.data)[_t1]; @@ -40403,9 +40471,9 @@ VV_LOCAL_SYMBOL ChanState sync__Channel_try_push_priv(sync__Channel* ch, voidptr ChanState _t1 = ChanState__closed; return _t1; } - multi_return_int_int mr_4420 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); - int spinloops_sem_ = mr_4420.arg0; - int spinloops_ = mr_4420.arg1; + multi_return_int_int mr_4424 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); + int spinloops_sem_ = mr_4424.arg0; + int spinloops_ = mr_4424.arg1; bool have_swapped = false; for (;;) { bool got_sem = false; @@ -40592,9 +40660,9 @@ inline ChanState sync__Channel_try_pop(sync__Channel* ch, voidptr dest) { } VV_LOCAL_SYMBOL ChanState sync__Channel_try_pop_priv(sync__Channel* ch, voidptr dest, bool no_block) { - multi_return_int_int mr_9405 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); - int spinloops_sem_ = mr_9405.arg0; - int spinloops_ = mr_9405.arg1; + multi_return_int_int mr_9409 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); + int spinloops_sem_ = mr_9409.arg0; + int spinloops_ = mr_9409.arg1; bool have_swapped = false; bool write_in_progress = false; for (;;) { @@ -40767,7 +40835,7 @@ int sync__channel_select(Array_sync__Channel_ptr* channels, Array_sync__Directio // assert if (!(channels->len == dir.len)) { VAssertMetaInfo v_assert_meta_info__t1 = {0}; - v_assert_meta_info__t1.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v/vlib/sync/channels.c.v"); + v_assert_meta_info__t1.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v/vlib/sync/channels.c.v"); v_assert_meta_info__t1.line_nr = 550; v_assert_meta_info__t1.fn_name = _SLIT("sync.channel_select"); v_assert_meta_info__t1.src = _SLIT("channels.len == dir.len"); @@ -40782,7 +40850,7 @@ int sync__channel_select(Array_sync__Channel_ptr* channels, Array_sync__Directio // assert if (!(dir.len == objrefs->len)) { VAssertMetaInfo v_assert_meta_info__t2 = {0}; - v_assert_meta_info__t2.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v/vlib/sync/channels.c.v"); + v_assert_meta_info__t2.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v/vlib/sync/channels.c.v"); v_assert_meta_info__t2.line_nr = 551; v_assert_meta_info__t2.fn_name = _SLIT("sync.channel_select"); v_assert_meta_info__t2.src = _SLIT("dir.len == objrefs.len"); @@ -41256,7 +41324,7 @@ VV_LOCAL_SYMBOL string help__known_topics(string topicdir) { array_push((array*)&_t3, &ti); } Array_string topics =_t3; - qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_1468091262560489642_string); + qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_13139793989557853369_string); array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) })); array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) })); string _t7 = Array_string_join(res, _SLIT("")); @@ -41753,7 +41821,7 @@ void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many) { } void v__util__Suggestion_sort(v__util__Suggestion* s) { - qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_v__util__Possibility_by_similarity); + qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_14781029812553904099_v__util__Possibility_by_similarity); } string v__util__Suggestion_say(v__util__Suggestion s, string msg) { @@ -41782,7 +41850,7 @@ string v__util__Suggestion_say(v__util__Suggestion s, string msg) { array_push((array*)&_t1, &ti); } Array_string values =_t1; - qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_string); + qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_14781029812553904099_string); if (values.len == 1) { res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); } else if (values.len < 25) { @@ -42238,11 +42306,19 @@ VNORETURN void v__util__launch_tool(bool is_verbose, string tool_name, Array_str if (is_verbose) { println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Compiling "), /*115 &string*/0xfe10, {.d_s = tool_name}}, {_SLIT(" with: \""), /*115 &string*/0xfe10, {.d_s = compilation_command}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); } - os__Result tool_compilation = os__execute_or_exit(compilation_command); - if (tool_compilation.exit_code != 0) { - eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot compile `"), /*115 &string*/0xfe10, {.d_s = tool_source}}, {_SLIT("`: \n"), /*115 &string*/0xfe10, {.d_s = tool_compilation.output}}, {_SLIT0, 0, { .d_c = 0 }}}))); - _v_exit(1); - VUNREACHABLE(); + int retry_max_count = 3; + for (int i = 0; i < retry_max_count; ++i) { + os__Result tool_compilation = os__execute(compilation_command); + if (tool_compilation.exit_code == 0) { + break; + } else { + if (i == retry_max_count - 1) { + eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot compile `"), /*115 &string*/0xfe10, {.d_s = tool_source}}, {_SLIT("`: \n"), /*115 &string*/0xfe10, {.d_s = tool_compilation.output}}, {_SLIT0, 0, { .d_c = 0 }}}))); + _v_exit(1); + VUNREACHABLE(); + } + time__sleep(20 * _const_time__millisecond); + } } } #if defined(_WIN32) @@ -42566,9 +42642,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_14763 = v__util__tool_source2name_and_exe(stool); - string tool_name = mr_14763.arg0; - string tool_exe = mr_14763.arg1; + multi_return_string_string mr_14924 = v__util__tool_source2name_and_exe(stool); + string tool_name = mr_14924.arg0; + string tool_exe = mr_14924.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); @@ -46025,7 +46101,7 @@ v__ast__Fn v__ast__Fn_new_method_with_receiver_type(v__ast__Fn* f, v__ast__Type v__ast__Fn _t1 = *new_method; return _t1; } - return (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,.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,}; + return (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,}; } v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v__ast__Type new_type) { @@ -46225,7 +46301,7 @@ void v__ast__Table_mark_module_as_deprecated_after(v__ast__Table* t, string mnam } void v__ast__Table_register_fn(v__ast__Table* t, v__ast__Fn new_fn) { - (*(v__ast__Fn*)map_get_and_set((map*)&t->fns, &(string[]){new_fn.name}, &(v__ast__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,.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,} })) = new_fn; + (*(v__ast__Fn*)map_get_and_set((map*)&t->fns, &(string[]){new_fn.name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })) = new_fn; if (new_fn.is_pub && string__eq(new_fn.mod, _SLIT("builtin"))) { map_set(&t->builtin_pub_fns, &(string[]){new_fn.name}, &(bool[]) { true }); } @@ -46247,7 +46323,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ } 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,}); + 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)),.dep_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) { v__ast__Type typ = ((v__ast__Type*)agg_info.types.data)[_t1]; v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); @@ -46345,9 +46421,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12604 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12604.arg0; + Array_v__ast__Type types = mr_12604.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); @@ -46379,9 +46455,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13262 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13262.arg0; + Array_v__ast__Type types = mr_13262.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); @@ -46404,9 +46480,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13725 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13725.arg0; + Array_v__ast__Type embed_types = mr_13725.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)); @@ -46433,8 +46509,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_14118 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14118.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14186 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14186.arg0; _option_v__ast__Fn _t5; opt_ok2(&(v__ast__Fn[]) { func }, (_option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -46597,9 +46673,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_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; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17433 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17433.arg0; + Array_v__ast__Type types = mr_17433.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); @@ -46622,9 +46698,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_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; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17886 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17886.arg0; + Array_v__ast__Type embed_types = mr_17886.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)); @@ -46655,8 +46731,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_18416 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18416.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18484 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18484.arg0; _option_v__ast__StructField _t5; opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -47188,9 +47264,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_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; + multi_return_string_string mr_31543 = (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_31543.arg0; + string cref = mr_31543.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) { @@ -47364,7 +47440,7 @@ bool v__ast__Table_is_sumtype_or_in_variant(v__ast__Table* t, v__ast__Type paren bool _t1 = false; return _t1; } - if (v__ast__Table_type_kind(t, typ) == v__ast__Kind__sum_type && v__ast__Type_idx(parent) == v__ast__Type_idx(typ) && v__ast__Type_nr_muls(parent) == v__ast__Type_nr_muls(typ)) { + if (v__ast__Table_sym(t, typ)->kind == v__ast__Kind__sum_type && v__ast__Type_idx(parent) == v__ast__Type_idx(typ) && v__ast__Type_nr_muls(parent) == v__ast__Type_nr_muls(typ)) { bool _t2 = true; return _t2; } @@ -48476,7 +48552,7 @@ bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__Co } case v__ast__ComptimeTypeKind__int: { - bool _t2 = (x_kind == v__ast__Kind__i8 || x_kind == v__ast__Kind__i16 || x_kind == v__ast__Kind__int || x_kind == v__ast__Kind__i64 || x_kind == v__ast__Kind__u8 || x_kind == v__ast__Kind__u16 || x_kind == v__ast__Kind__u32 || x_kind == v__ast__Kind__u64 || x_kind == v__ast__Kind__usize || x_kind == v__ast__Kind__int_literal); + bool _t2 = (x_kind == v__ast__Kind__i8 || x_kind == v__ast__Kind__i16 || x_kind == v__ast__Kind__int || x_kind == v__ast__Kind__i64 || x_kind == v__ast__Kind__u8 || x_kind == v__ast__Kind__u16 || x_kind == v__ast__Kind__u32 || x_kind == v__ast__Kind__u64 || x_kind == v__ast__Kind__usize || x_kind == v__ast__Kind__isize || x_kind == v__ast__Kind__int_literal); return _t2; break; } @@ -48521,6 +48597,138 @@ bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__Co return 0; } +Array_string v__ast__Table_dependent_names_in_expr(v__ast__Table* t, v__ast__Expr expr) { + Array_string names = __new_array_with_default(0, 0, sizeof(string), 0); + if (expr._typ == 250 /* v.ast.ArrayInit */) { + for (int _t1 = 0; _t1 < (*expr._v__ast__ArrayInit).exprs.len; ++_t1) { + v__ast__Expr elem_expr = ((v__ast__Expr*)(*expr._v__ast__ArrayInit).exprs.data)[_t1]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, elem_expr)), _t2, Array_string); + } + } + else if (expr._typ == 256 /* v.ast.CallExpr */) { + for (int _t3 = 0; _t3 < (*expr._v__ast__CallExpr).args.len; ++_t3) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*expr._v__ast__CallExpr).args.data)[_t3]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, arg.expr)), _t4, Array_string); + } + _option_v__ast__Fn _t5; + if (_t5 = v__ast__Table_find_fn(t, (*expr._v__ast__CallExpr).name), _t5.state == 0) { + v__ast__Fn func = *(v__ast__Fn*)_t5.data; + _PUSH_MANY(&names, (func.dep_names), _t6, Array_string); + } + } + else if (expr._typ == 257 /* v.ast.CastExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__CastExpr).expr)), _t7, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__CastExpr).arg)), _t8, Array_string); + } + else if (expr._typ == 270 /* v.ast.Ident */) { + if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__global || (*expr._v__ast__Ident).kind == v__ast__IdentKind__constant) { + array_push((array*)&names, _MOV((string[]){ string_clone(v__util__no_dots((*expr._v__ast__Ident).name)) })); + } + } + else if (expr._typ == 271 /* v.ast.IfExpr */) { + for (int _t10 = 0; _t10 < (*expr._v__ast__IfExpr).branches.len; ++_t10) { + v__ast__IfBranch branch = ((v__ast__IfBranch*)(*expr._v__ast__IfExpr).branches.data)[_t10]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, branch.cond)), _t11, Array_string); + for (int _t12 = 0; _t12 < branch.stmts.len; ++_t12) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t12]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt)), _t13, Array_string); + } + } + } + else if (expr._typ == 274 /* v.ast.InfixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__InfixExpr).left)), _t14, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__InfixExpr).right)), _t15, Array_string); + } + else if (expr._typ == 279 /* v.ast.MapInit */) { + for (int _t16 = 0; _t16 < (*expr._v__ast__MapInit).vals.len; ++_t16) { + v__ast__Expr val = ((v__ast__Expr*)(*expr._v__ast__MapInit).vals.data)[_t16]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, val)), _t17, Array_string); + } + } + else if (expr._typ == 280 /* v.ast.MatchExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__MatchExpr).cond)), _t18, Array_string); + for (int _t19 = 0; _t19 < (*expr._v__ast__MatchExpr).branches.len; ++_t19) { + v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*expr._v__ast__MatchExpr).branches.data)[_t19]; + for (int _t20 = 0; _t20 < branch.stmts.len; ++_t20) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t20]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt)), _t21, Array_string); + } + } + } + else if (expr._typ == 285 /* v.ast.ParExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__ParExpr).expr)), _t22, Array_string); + } + else if (expr._typ == 286 /* v.ast.PostfixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__PostfixExpr).expr)), _t23, Array_string); + } + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__PrefixExpr).right)), _t24, Array_string); + } + else if (expr._typ == 295 /* v.ast.StructInit */) { + for (int _t25 = 0; _t25 < (*expr._v__ast__StructInit).fields.len; ++_t25) { + v__ast__StructInitField field = ((v__ast__StructInitField*)(*expr._v__ast__StructInit).fields.data)[_t25]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, field.expr)), _t26, Array_string); + } + } + + else { + } + ; + Array_string _t27 = names; + return _t27; +} + +Array_string v__ast__Table_dependent_names_in_stmt(v__ast__Table* t, v__ast__Stmt stmt) { + Array_string names = __new_array_with_default(0, 0, sizeof(string), 0); + if (stmt._typ == 302 /* v.ast.AssignStmt */) { + for (int _t1 = 0; _t1 < (*stmt._v__ast__AssignStmt).left.len; ++_t1) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__AssignStmt).left.data)[_t1]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t2, Array_string); + } + for (int _t3 = 0; _t3 < (*stmt._v__ast__AssignStmt).right.len; ++_t3) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__AssignStmt).right.data)[_t3]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t4, Array_string); + } + } + else if (stmt._typ == 310 /* v.ast.ExprStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ExprStmt).expr)), _t5, Array_string); + } + else if (stmt._typ == 312 /* v.ast.ForInStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ForInStmt).cond)), _t6, Array_string); + for (int _t7 = 0; _t7 < (*stmt._v__ast__ForInStmt).stmts.len; ++_t7) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForInStmt).stmts.data)[_t7]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t8, Array_string); + } + } + else if (stmt._typ == 313 /* v.ast.ForStmt */) { + for (int _t9 = 0; _t9 < (*stmt._v__ast__ForStmt).stmts.len; ++_t9) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForStmt).stmts.data)[_t9]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t10, Array_string); + } + } + else if (stmt._typ == 311 /* v.ast.ForCStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, (*stmt._v__ast__ForCStmt).init)), _t11, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ForCStmt).cond)), _t12, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, (*stmt._v__ast__ForCStmt).inc)), _t13, Array_string); + for (int _t14 = 0; _t14 < (*stmt._v__ast__ForCStmt).stmts.len; ++_t14) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForCStmt).stmts.data)[_t14]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t15, Array_string); + } + } + else if (stmt._typ == 321 /* v.ast.Return */) { + for (int _t16 = 0; _t16 < (*stmt._v__ast__Return).exprs.len; ++_t16) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__Return).exprs.data)[_t16]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t17, Array_string); + } + } + + else { + } + ; + Array_string _t18 = names; + return _t18; +} + // TypeDecl // TypeDecl v__ast__Language v__ast__pref_arch_to_table_language(v__pref__Arch pref_arch) { @@ -48915,14 +49123,34 @@ inline bool v__ast__Type_is_bool(v__ast__Type typ) { return _t1; } +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_charptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__charptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__char_type_idx), 1)})); + return _t1; +} + +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_byteptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__byteptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__byte_type_idx), 1)})); + return _t1; +} + +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_voidptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__voidptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__voidptr_type_idx), 1)})); + return _t1; +} + Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params) { Array_v__ast__Type res = __new_array_with_default(0, params.len, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < params.len; ++_t1) { Array_v__ast__Type types = ((Array_v__ast__Type*)params.data)[_t1]; - _PUSH_MANY(&res, (types), _t2, Array_v__ast__Type); + for (int _t2 = 0; _t2 < types.len; ++_t2) { + v__ast__Type t = ((v__ast__Type*)types.data)[_t2]; + if (!Array_v__ast__Type_contains(res, t)) { + array_push((array*)&res, _MOV((v__ast__Type[]){ t })); + } + } } - Array_v__ast__Type _t3 = res; - return _t3; + Array_v__ast__Type _t4 = res; + return _t4; } v__ast__Type v__ast__mktyp(v__ast__Type typ) { @@ -49291,9 +49519,9 @@ 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, 436) /*expected idx: 436, name: v.ast.Alias */ ).parent_type); - size = mr_21365.arg0; - align = mr_21365.arg1; + multi_return_int_int mr_21622 = 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_21622.arg0; + align = mr_21622.arg1; break; } case v__ast__Kind__struct_: @@ -49321,9 +49549,9 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) Array_v__ast__Type types = _t4; for (int _t7 = 0; _t7 < types.len; ++_t7) { v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t7]; - multi_return_int_int mr_21676 = v__ast__Table_type_size(t, ftyp); - int field_size = mr_21676.arg0; - int alignment = mr_21676.arg1; + multi_return_int_int mr_21933 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21933.arg0; + int alignment = mr_21933.arg1; if (alignment > max_alignment) { max_alignment = alignment; } @@ -49350,8 +49578,8 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; - multi_return_int_int mr_22237 = v__ast__Table_type_size(t, etyp); - int esize = mr_22237.arg0; + multi_return_int_int mr_22494 = v__ast__Table_type_size(t, etyp); + int esize = mr_22494.arg0; size += esize - 2 * t->pointer_size; } } @@ -49364,9 +49592,9 @@ 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, 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; + multi_return_int_int mr_22691 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22691.arg0; + int elem_align = mr_22691.arg1; size = info.size * elem_size; align = elem_align; break; @@ -50803,6 +51031,11 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } + if ((left)->_typ == 270 /* v.ast.Ident */ && (right)._typ == 270 /* v.ast.Ident */) { + if (!c->inside_unsafe && v__ast__Type_is_ptr(left_type) && v__ast__Ident_is_mut(&(*left->_v__ast__Ident)) && v__ast__Type_is_ptr(right_type) && !v__ast__Ident_is_mut(&(*right._v__ast__Ident))) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*right._v__ast__Ident).name}}, {_SLIT("` is immutable, cannot have a mutable reference to an immutable object"), 0, { .d_c = 0 }}})), (*right._v__ast__Ident).pos); + } + } } else { v__checker__Checker_fail_if_immutable(c, *left); } @@ -51549,22 +51782,26 @@ 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) { + if (c->pref->translated) { + bool _t1 = true; + return _t1; + } 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) { - bool _t1 = false; - return _t1; - } - if (v__ast__Type_has_flag(got_fn.return_type, v__ast__TypeFlag__optional) != v__ast__Type_has_flag(exp_fn.return_type, v__ast__TypeFlag__optional)) { bool _t2 = false; return _t2; } - if (!v__checker__Checker_check_basic(c, got_fn.return_type, exp_fn.return_type)) { + if (v__ast__Type_has_flag(got_fn.return_type, v__ast__TypeFlag__optional) != v__ast__Type_has_flag(exp_fn.return_type, v__ast__TypeFlag__optional)) { bool _t3 = false; return _t3; } + if (!v__checker__Checker_check_basic(c, got_fn.return_type, exp_fn.return_type)) { + bool _t4 = false; + return _t4; + } for (int i = 0; i < got_fn.params.len; ++i) { v__ast__Param got_arg = ((v__ast__Param*)got_fn.params.data)[i]; v__ast__Param exp_arg = (*(v__ast__Param*)/*ee elem_sym */array_get(exp_fn.params, i)); @@ -51574,18 +51811,18 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, string exp_arg_pointedness = (exp_arg_is_ptr ? (_SLIT("a pointer")) : (_SLIT("NOT a pointer"))); string got_arg_pointedness = (got_arg_is_ptr ? (_SLIT("a pointer")) : (_SLIT("NOT a pointer"))); v__checker__Checker_add_error_detail(c, str_intp(6, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = exp_fn.name}}, {_SLIT("`\'s expected fn argument: `"), /*115 &string*/0xfe10, {.d_s = exp_arg.name}}, {_SLIT("` is "), /*115 &string*/0xfe10, {.d_s = exp_arg_pointedness}}, {_SLIT(", but the passed fn argument: `"), /*115 &string*/0xfe10, {.d_s = got_arg.name}}, {_SLIT("` is "), /*115 &string*/0xfe10, {.d_s = got_arg_pointedness}}, {_SLIT0, 0, { .d_c = 0 }}}))); - bool _t4 = false; - return _t4; + bool _t5 = false; + return _t5; } else if (exp_arg_is_ptr && got_arg_is_ptr) { continue; } if (!v__ast__Type_alias_eq(got_arg.typ, exp_arg.typ)) { - bool _t5 = false; - return _t5; + bool _t6 = false; + return _t6; } } - bool _t6 = true; - return _t6; + bool _t7 = true; + return _t7; } 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) { @@ -51718,10 +51955,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_19097 = type_hi; - v__ast__Type _var_19106 = type_lo; - type_hi = _var_19106; - type_lo = _var_19097; + v__ast__Type _var_19157 = type_hi; + v__ast__Type _var_19166 = type_lo; + type_hi = _var_19166; + type_lo = _var_19157; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -52675,19 +52912,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_22286 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_22286.arg0; - pos = mr_22286.arg1; + multi_return_string_v__token__Pos mr_22297 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_22297.arg0; + pos = mr_22297.arg1; } else if (expr._typ == 285 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_22355 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_22355.arg0; - pos = mr_22355.arg1; + multi_return_string_v__token__Pos mr_22366 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_22366.arg0; + pos = mr_22366.arg1; } else if (expr._typ == 287 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_22427 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_22427.arg0; - pos = mr_22427.arg1; + multi_return_string_v__token__Pos mr_22438 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_22438.arg0; + pos = mr_22438.arg1; } else if (expr._typ == 290 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -52737,9 +52974,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_23891 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_23891.arg0; - pos = mr_23891.arg1; + multi_return_string_v__token__Pos mr_23902 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_23902.arg0; + pos = mr_23902.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -52845,9 +53082,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_25714 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_25714.arg0; - pos = mr_25714.arg1; + multi_return_string_v__token__Pos mr_25725 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_25725.arg0; + pos = mr_25725.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -53270,9 +53507,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(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_40154 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_40154.arg0; - embed_types = mr_40154.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40165 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_40165.arg0; + embed_types = mr_40165.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); @@ -53306,9 +53543,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(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_40985 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40985.arg0; - embed_types = mr_40985.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40996 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40996.arg0; + embed_types = mr_40996.arg1; node->from_embed_types = embed_types; } } @@ -55633,8 +55870,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_97972 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_97972.arg0; + multi_return_string_v__token__Pos mr_97983 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_97983.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -56202,6 +56439,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ return (_option_void){0}; } v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, typ); + if (!c->is_builtin_mod && sym->kind == v__ast__Kind__struct_ && !string__eq(sym->mod, c->mod) && !sym->is_pub) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), pos); + return (_option_void){0}; + } switch (sym->kind) { case v__ast__Kind__placeholder: { @@ -58553,11 +58794,9 @@ v__ast__Scope* prev_fn_scope; // Defer end return; } - if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - 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); - } + if ((sym->info)._typ == 439 /* v.ast.Interface */ && v__ast__TypeSymbol_has_method(sym, node->name)) { + 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); } } if ((sym->info)._typ == 420 /* v.ast.Struct */) { @@ -58618,9 +58857,8 @@ v__ast__Scope* prev_fn_scope; } if (!v__ast__Type_is_ptr(param->typ)) { v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, param->typ); - if (arg_typ_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; - if (info.is_heap) { + if ((arg_typ_sym->info)._typ == 420 /* v.ast.Struct */) { + if ((*arg_typ_sym->info._v__ast__Struct).is_heap) { _option_v__ast__Var_ptr _t9 = v__ast__Scope_find_var(node->scope, param->name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -58630,17 +58868,15 @@ v__ast__Scope* prev_fn_scope; v__ast__Var* v = (*(v__ast__Var**)_t9.data); v->is_auto_heap = true; } - if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { + if ((*arg_typ_sym->info._v__ast__Struct).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__Struct).concrete_types.len == 0) { 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, 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) { + } else if ((arg_typ_sym->info)._typ == 439 /* v.ast.Interface */) { + if ((*arg_typ_sym->info._v__ast__Interface).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__Interface).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, 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) { + } else if ((arg_typ_sym->info)._typ == 440 /* v.ast.SumType */) { + if ((*arg_typ_sym->info._v__ast__SumType).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__SumType).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); } } @@ -58756,6 +58992,16 @@ v__ast__Scope* prev_fn_scope; } } node->source_file = c->file; + if (v__ast__Table_known_fn(c->table, node->name) && !string__eq(node->name, _SLIT("main.main"))) { + Array_string dep_names = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t14 = 0; _t14 < node->stmts.len; ++_t14) { + v__ast__Stmt stmt = ((v__ast__Stmt*)node->stmts.data)[_t14]; + _PUSH_MANY(&dep_names, (v__ast__Table_dependent_names_in_stmt(c->table, stmt)), _t15, Array_string); + } + if (dep_names.len > 0) { + (*(v__ast__Fn*)map_get_and_set((map*)&c->table->fns, &(string[]){node->name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).dep_names = dep_names; + } + } // Defer begin if (v__checker__Checker_fn_decl_defer_0) { c->stmt_level = prev_stmt_level; @@ -58969,7 +59215,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Type _t10 = ret_type; return _t10; } - v__ast__Fn func = ((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,}); + v__ast__Fn func = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); bool found = false; bool found_in_args = false; if ((node->left)._typ == 248 /* v.ast.AnonFn */) { @@ -58989,7 +59235,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->name = name_prefixed; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){name_prefixed}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){name_prefixed}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } if (!found && (node->left)._typ == 273 /* v.ast.IndexExpr */) { @@ -59036,15 +59282,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Fn f = *(v__ast__Fn*)_t12.data; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } bool is_native_builtin = false; if (!found && c->pref->backend == v__pref__Backend__native) { if (Array_string_contains(_const_v__ast__native_builtins, fn_name)) { - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; found = true; - func = (*(v__ast__Fn*)map_get(ADDR(map, c->table->fns), &(string[]){fn_name}, &(v__ast__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,.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,} })); + func = (*(v__ast__Fn*)map_get(ADDR(map, c->table->fns), &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })); is_native_builtin = true; } } @@ -59060,7 +59306,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->name = os_name; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){os_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){os_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } if (is_native_builtin) { @@ -59277,9 +59523,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_29240 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_29240.arg0; - v__token__Pos pos = mr_29240.arg1; + multi_return_string_v__token__Pos mr_29410 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_29410.arg0; + v__token__Pos pos = mr_29410.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)); } @@ -59585,7 +59831,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t16 = _const_v__ast__void_type; return _t16; } - v__ast__Fn method = ((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,}); + v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); bool has_method = false; bool is_method_from_embed = false; _option_v__ast__Fn _t17; @@ -59625,12 +59871,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_method = false; - *(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*) _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)),.dep_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_43522 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_43522.arg0; - embed_types = mr_43522.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_43703 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_43703.arg0; + embed_types = mr_43703.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -59678,9 +59924,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_45850 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45850.arg0; - v__token__Pos pos = mr_45850.arg1; + multi_return_string_v__token__Pos mr_46031 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_46031.arg0; + v__token__Pos pos = mr_46031.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)); } @@ -59788,9 +60034,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_49752 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_49752.arg0; - v__token__Pos pos = mr_49752.arg1; + multi_return_string_v__token__Pos mr_49944 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_49944.arg0; + v__token__Pos pos = mr_49944.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)); @@ -59977,8 +60223,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_57228 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); - node->from_embed_types = mr_57228.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_57420 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_57420.arg1; v__ast__Type _t45 = info.func.return_type; return _t45; } @@ -62551,6 +62797,9 @@ v__ast__TypeSymbol old_ts; })))); (*(v__ast__SqlExpr*)map_get_and_set((map*)&sub_structs, &(int[]){((int)(typ))}, &(v__ast__SqlExpr[]){ (v__ast__SqlExpr){.typ = 0,.is_count = 0,.has_where = 0,.has_order = 0,.has_limit = 0,.has_offset = 0,.has_desc = 0,.is_array = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.table_expr = (v__ast__TypeNode){.typ = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlExpr), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),} })) = n; } + if (node->is_count) { + fields = new_array_from_c_array(1, 1, sizeof(v__ast__StructField), _MOV((v__ast__StructField[1]){((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 = _const_v__ast__int_type,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,})})); + } node->fields = fields; node->sub_structs = map_move(&sub_structs); if (node->has_where) { @@ -63553,7 +63802,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str int pos = (*(int*)_t6.data); u8 first_letter = string_at(type_sym->name, pos + 1); - if (!u8_is_capital(first_letter)) { + if (!u8_is_capital(first_letter) && type_sym->kind != v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot initialize builtin type `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } @@ -63612,7 +63861,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->is_short) { int exp_len = info.fields.len; int got_len = node->fields.len; - if (exp_len != got_len) { + if (exp_len != got_len && !c->pref->translated) { string amount = (exp_len < got_len ? (_SLIT("many")) : (_SLIT("few"))); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("too "), /*115 &string*/0xfe10, {.d_s = amount}}, {_SLIT(" fields in `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` literal (expecting "), /*100 &int*/0xfe07, {.d_i32 = exp_len}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = got_len}}, {_SLIT(")"), 0, { .d_c = 0 }}})), node->pos); } @@ -63620,7 +63869,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); if (node->is_short) { info_fields_sorted = array_clone_to_depth(&info.fields, 0); - qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_5995660241070764127_v__ast__StructField_by_i); + qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_6602916910409314308_v__ast__StructField_by_i); } Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); for (int i = 0; i < node->fields.len; ++i) { @@ -64589,8 +64838,10 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ else if (node->_typ == 290 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); if (((*node->_v__ast__SelectorExpr).expr)._typ == 294 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { - v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); - return _t15; + if (!string_contains((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val, _SLIT("\\")) || (*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).is_raw) { + v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); + return _t15; + } } } else if (node->_typ == 291 /* v.ast.SizeOf */) { @@ -65234,20 +65485,20 @@ bool v__markused__mark_used_defer_0 = false; Map_string_v__ast__GlobalField all_globals = mr_434.arg2; v__util__timing_start(_SLIT("mark_used")); v__markused__mark_used_defer_0 = true; - Array_string all_fn_root_names = new_array_from_c_array(101, 101, sizeof(string), _MOV((string[101]){ + Array_string all_fn_root_names = new_array_from_c_array(102, 102, sizeof(string), _MOV((string[102]){ _SLIT("main.main"), _SLIT("__new_array"), _SLIT("str_intp"), _SLIT("format_sb"), _SLIT("__new_array_with_default"), _SLIT("__new_array_with_array_default"), _SLIT("v_realloc"), _SLIT("malloc"), _SLIT("malloc_noscan"), - _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("vstrlen"), _SLIT("__as_cast"), _SLIT("tos"), - _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), _SLIT("utf8_str_visible_length"), - _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), - _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), - _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), - _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), - _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), - _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), - _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), - _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), - _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), - _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); + _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("memdup_uncollectable"), _SLIT("vstrlen"), _SLIT("__as_cast"), + _SLIT("tos"), _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), + _SLIT("utf8_str_visible_length"), _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), + _SLIT("3.vstring"), _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), + _SLIT("20.trim_space"), _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), + _SLIT("20.at"), _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), + _SLIT("20.ge"), _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), + _SLIT("22.clone_to_depth"), _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), + _SLIT("22.slice2"), _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), + _SLIT("65558.reverse"), _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), + _SLIT("json.encode_string"), _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), + _SLIT("main.vtest_new_filemetainfo"), _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); if (pref->is_bare) { _PUSH_MANY(&all_fn_root_names, (new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("strlen"), _SLIT("memcmp"), _SLIT("memcpy"), _SLIT("realloc"), _SLIT("vsnprintf"), _SLIT("vsprintf")}))), _t1, Array_string); } @@ -67100,10 +67351,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index_methods(v__gen__c__Gen* g) { strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); } else if (elem_sym->kind == v__ast__Kind__interface_) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_is_ptr(info.elem_type)) { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(**pelem, *v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + } } else if (elem_sym->kind == v__ast__Kind__sum_type) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_is_ptr(info.elem_type)) { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(**pelem, *v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + } } else if (elem_sym->kind == v__ast__Kind__alias) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); @@ -67313,7 +67572,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_write(g, tmp); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement) { if (!original_assert_statement.is_used) { return; } @@ -67499,9 +67758,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v_ v__gen__c__Gen_write(g, string__plus(string__plus(string__plus(string__plus(_SLIT(" /* typeof: "), charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (expr)._typ ))), _SLIT(" type: ")), v__ast__Type_str(typ)), _SLIT(" */ "))); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_) { -bool v__gen__c__Gen_gen_assign_stmt_defer_0 = false; -bool v__gen__c__Gen_gen_assign_stmt_defer_1 = false; +VV_LOCAL_SYMBOL void v__gen__c__Gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_) { +bool v__gen__c__Gen_assign_stmt_defer_0 = false; +bool v__gen__c__Gen_assign_stmt_defer_1 = false; bool af; string type_to_free; string sref_name; @@ -67515,7 +67774,7 @@ string sref_name; v__ast__Type return_type = _const_v__ast__void_type; bool is_decl = node.op == v__token__Kind__decl_assign; g->assign_op = node.op; - v__gen__c__Gen_gen_assign_stmt_defer_0 = true; + v__gen__c__Gen_assign_stmt_defer_0 = true; v__token__Kind op = (is_decl ? (v__token__Kind__assign) : (node.op)); v__ast__Expr right_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); if (right_expr._typ == 256 /* v.ast.CallExpr */) { @@ -67554,7 +67813,7 @@ string sref_name; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(" = ("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, left0); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("); // free "), /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT(" on re-assignment2"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_gen_assign_stmt_defer_1 = true; + v__gen__c__Gen_assign_stmt_defer_1 = true; } else { af = false; } @@ -67568,14 +67827,14 @@ string sref_name; if (sym->kind == v__ast__Kind__multi_return) { v__gen__c__Gen_gen_multi_return_assign(g, (voidptr)&/*qq*/node, return_type); // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_1) { + if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_0) { + if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -67828,14 +68087,14 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_writeln(g, _SLIT(");")); // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_1) { + if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_0) { + if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -67847,7 +68106,7 @@ string sref_name; IError err = _t7.err; v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignment operator `"), /*115 &string*/0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), /*115 &string*/0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); - *(v__ast__Fn*) _t7.data = ((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,}); + *(v__ast__Fn*) _t7.data = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); } v__ast__Fn method = (*(v__ast__Fn*)_t7.data); @@ -68018,14 +68277,14 @@ string sref_name; } } // Defer begin -if (v__gen__c__Gen_gen_assign_stmt_defer_1) { +if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin -if (v__gen__c__Gen_gen_assign_stmt_defer_0) { +if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -69576,8 +69835,16 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ multi_return_string_string mr_23179 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); string deref = mr_23179.arg0; string deref_label = mr_23179.arg1; - strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" it);"), 0, { .d_c = 0 }}}))); + if (is_elem_ptr) { + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstring x = _SLIT(\"nil\");")); + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tif (it != 0) {")); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t\tx = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it);"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\t}")); + } else { + strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it);"), 0, { .d_c = 0 }}}))); + } } } strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); @@ -69608,9 +69875,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v sym = v__ast__Table_sym(g->table, typ); } bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_24561 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_24561.arg0; - bool str_method_expects_ptr = mr_24561.arg1; + multi_return_bool_bool_int mr_24922 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_24922.arg0; + bool str_method_expects_ptr = mr_24922.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(a, 0);}"), 0, { .d_c = 0 }}}))); @@ -69623,9 +69890,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); } else { - multi_return_string_string mr_25438 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_25438.arg0; - string deref_label = mr_25438.arg1; + multi_return_string_string mr_25799 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_25799.arg0; + string deref_label = mr_25799.arg1; if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { if (is_elem_ptr) { strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); @@ -69853,9 +70120,9 @@ strings__Builder fn_body; } else { strings__Builder_write_string(&fn_body, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\"\\n\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s=indents}}, {_SLIT(\" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = ptr_amp}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("\"), 0, {.d_c=0}}, "), 0, { .d_c = 0 }}}))); } - multi_return_bool_bool_int mr_35399 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_35399.arg0; - bool str_method_expects_ptr = mr_35399.arg1; + multi_return_bool_bool_int mr_35760 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_35760.arg0; + bool str_method_expects_ptr = mr_35760.arg1; string sftyp = v__gen__c__Gen_typ(g, ftyp_noshared); string field_styp = string_replace(sftyp, _SLIT("*"), _SLIT("")); string _t2; /* if prepend */ @@ -69876,9 +70143,9 @@ strings__Builder fn_body; strings__Builder_write_string(&fn_body, str_intp(4, _MOV((StrIntpData[]){{_SLIT("{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = quote_str}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = g_fmt}}, {_SLIT(", {."), /*115 &string*/0xfe10, {.d_s = v__gen__c__data_str(base_fmt)}}, {_SLIT("="), 0, { .d_c = 0 }}}))); } string funcprefix = _SLIT(""); - multi_return_string_bool mr_36191 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); - string func = mr_36191.arg0; - bool caller_should_free = mr_36191.arg1; + multi_return_string_bool mr_36552 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); + string func = mr_36552.arg0; + bool caller_should_free = mr_36552.arg1; if (Array_v__ast__Type_contains(_const_v__ast__cptr_types, field.typ)) { func = str_intp(2, _MOV((StrIntpData[]){{_SLIT("(voidptr) it."), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}})); caller_should_free = false; @@ -69937,8 +70204,8 @@ VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast_ #endif v__ast__Type field_type = (v__ast__Type_has_flag(_field_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(_field_type)) : (_field_type)); string sufix = (v__ast__Type_has_flag(field_type, v__ast__TypeFlag__shared_f) ? (_SLIT("->val")) : (_SLIT(""))); - multi_return_string_string mr_38270 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); - string deref = mr_38270.arg0; + multi_return_string_string mr_38631 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); + string deref = mr_38631.arg0; if (sym->kind == v__ast__Kind__enum_) { return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (v__gen__c__should_use_indent_func(sym->kind)) { @@ -70131,14 +70398,9 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .hotcode_definitions = strings__new_builder(100), .channel_definitions = strings__new_builder(100), .comptime_definitions = strings__new_builder(100), - .global_inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .global_init = __new_array(0, 0, sizeof(u8)), - .inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .init = strings__new_builder(100), .cleanup = __new_array(0, 0, sizeof(u8)), .cleanups = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .gowrappers = strings__new_builder(100), - .stringliterals = strings__new_builder(100), .auto_str_funcs = strings__new_builder(100), .dump_funcs = strings__new_builder(100), .pcs_declarations = strings__new_builder(100), @@ -70149,6 +70411,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .out_results = strings__new_builder(100), .json_forward_decls = strings__new_builder(100), .sql_buf = strings__new_builder(100), + .global_const_defs = new_map(sizeof(string), sizeof(v__gen__c__GlobalConstDef), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .sorted_global_const_names = __new_array(0, 0, sizeof(string)), .file = 0, .unique_file_path_hash = 0, .fn_decl = 0, @@ -70271,6 +70535,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .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), + .test_function_names = __new_array(0, 0, sizeof(string)), }); if (pref->is_test) { v__gen__c__Gen_write_tests_definitions(&global_g); @@ -70278,8 +70543,6 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__util__Timers_start(global_g.timers, _SLIT("cgen init")); for (int _t2 = 0; _t2 < global_g.table->modules.len; ++_t2) { string mod = ((string*)global_g.table->modules.data)[_t2]; - map_set(&global_g.inits, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(200) }); - map_set(&global_g.global_inits, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(100) }); map_set(&global_g.cleanups, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(100) }); } v__gen__c__Gen_init(&global_g); @@ -70367,7 +70630,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t13.data); - _option_int _t14 = strings__Builder_write(&global_g.stringliterals, g->stringliterals); + _option_int _t14 = strings__Builder_write(&global_g.auto_str_funcs, g->auto_str_funcs); if (_t14.state != 0) { /*or block*/ IError err = _t14.err; _v_panic(IError_str(err)); @@ -70376,7 +70639,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t14.data); - _option_int _t15 = strings__Builder_write(&global_g.auto_str_funcs, g->auto_str_funcs); + _option_int _t15 = strings__Builder_write(&global_g.dump_funcs, g->auto_str_funcs); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; _v_panic(IError_str(err)); @@ -70385,7 +70648,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t15.data); - _option_int _t16 = strings__Builder_write(&global_g.dump_funcs, g->auto_str_funcs); + _option_int _t16 = strings__Builder_write(&global_g.comptime_definitions, g->comptime_definitions); if (_t16.state != 0) { /*or block*/ IError err = _t16.err; _v_panic(IError_str(err)); @@ -70394,7 +70657,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t16.data); - _option_int _t17 = strings__Builder_write(&global_g.comptime_definitions, g->comptime_definitions); + _option_int _t17 = strings__Builder_write(&global_g.pcs_declarations, g->pcs_declarations); if (_t17.state != 0) { /*or block*/ IError err = _t17.err; _v_panic(IError_str(err)); @@ -70403,7 +70666,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t17.data); - _option_int _t18 = strings__Builder_write(&global_g.pcs_declarations, g->pcs_declarations); + _option_int _t18 = strings__Builder_write(&global_g.hotcode_definitions, g->hotcode_definitions); if (_t18.state != 0) { /*or block*/ IError err = _t18.err; _v_panic(IError_str(err)); @@ -70412,7 +70675,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t18.data); - _option_int _t19 = strings__Builder_write(&global_g.hotcode_definitions, g->hotcode_definitions); + _option_int _t19 = strings__Builder_write(&global_g.embedded_data, g->embedded_data); if (_t19.state != 0) { /*or block*/ IError err = _t19.err; _v_panic(IError_str(err)); @@ -70421,7 +70684,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t19.data); - _option_int _t20 = strings__Builder_write(&global_g.embedded_data, g->embedded_data); + _option_int _t20 = strings__Builder_write(&global_g.shared_types, g->shared_types); if (_t20.state != 0) { /*or block*/ IError err = _t20.err; _v_panic(IError_str(err)); @@ -70430,7 +70693,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t20.data); - _option_int _t21 = strings__Builder_write(&global_g.shared_types, g->shared_types); + _option_int _t21 = strings__Builder_write(&global_g.shared_functions, g->channel_definitions); if (_t21.state != 0) { /*or block*/ IError err = _t21.err; _v_panic(IError_str(err)); @@ -70439,147 +70702,126 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t21.data); - _option_int _t22 = strings__Builder_write(&global_g.shared_functions, g->channel_definitions); - if (_t22.state != 0) { /*or block*/ - IError err = _t22.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t22.data); global_g.force_main_console = global_g.force_main_console || g->force_main_console; - Map_int_string _t23 = g->shareds; - int _t25 = _t23.key_values.len; - for (int _t24 = 0; _t24 < _t25; ++_t24 ) { - int _t26 = _t23.key_values.len - _t25; - _t25 = _t23.key_values.len; - if (_t26 < 0) { - _t24 = -1; + Map_string_v__gen__c__GlobalConstDef _t22 = g->global_const_defs; + 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(&_t23.key_values, _t24)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t23.key_values, _t24); - string v = (*(string*)DenseArray_value(&_t23.key_values, _t24)); + if (!DenseArray_has_index(&_t22.key_values, _t23)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t22.key_values, _t23); + k = string_clone(k); + v__gen__c__GlobalConstDef v = (*(v__gen__c__GlobalConstDef*)DenseArray_value(&_t22.key_values, _t23)); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&global_g.global_const_defs, &(string[]){k}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = v; + } + Map_int_string _t26 = g->shareds; + int _t28 = _t26.key_values.len; + for (int _t27 = 0; _t27 < _t28; ++_t27 ) { + int _t29 = _t26.key_values.len - _t28; + _t28 = _t26.key_values.len; + if (_t29 < 0) { + _t27 = -1; + continue; + } + if (!DenseArray_has_index(&_t26.key_values, _t27)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t26.key_values, _t27); + string v = (*(string*)DenseArray_value(&_t26.key_values, _t27)); map_set(&global_g.shareds, &(int[]){k}, &(string[]) { v }); } - Map_string_string _t27 = g->chan_pop_optionals; - int _t29 = _t27.key_values.len; - for (int _t28 = 0; _t28 < _t29; ++_t28 ) { - int _t30 = _t27.key_values.len - _t29; - _t29 = _t27.key_values.len; - if (_t30 < 0) { - _t28 = -1; + Map_string_string _t30 = g->chan_pop_optionals; + int _t32 = _t30.key_values.len; + for (int _t31 = 0; _t31 < _t32; ++_t31 ) { + int _t33 = _t30.key_values.len - _t32; + _t32 = _t30.key_values.len; + if (_t33 < 0) { + _t31 = -1; continue; } - if (!DenseArray_has_index(&_t27.key_values, _t28)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t27.key_values, _t28); + if (!DenseArray_has_index(&_t30.key_values, _t31)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t30.key_values, _t31); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t27.key_values, _t28)); + string v = (*(string*)DenseArray_value(&_t30.key_values, _t31)); map_set(&global_g.chan_pop_optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t31 = g->chan_push_optionals; - int _t33 = _t31.key_values.len; - for (int _t32 = 0; _t32 < _t33; ++_t32 ) { - int _t34 = _t31.key_values.len - _t33; - _t33 = _t31.key_values.len; - if (_t34 < 0) { - _t32 = -1; + Map_string_string _t34 = g->chan_push_optionals; + int _t36 = _t34.key_values.len; + for (int _t35 = 0; _t35 < _t36; ++_t35 ) { + int _t37 = _t34.key_values.len - _t36; + _t36 = _t34.key_values.len; + if (_t37 < 0) { + _t35 = -1; continue; } - if (!DenseArray_has_index(&_t31.key_values, _t32)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t31.key_values, _t32); + if (!DenseArray_has_index(&_t34.key_values, _t35)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t34.key_values, _t35); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t31.key_values, _t32)); + string v = (*(string*)DenseArray_value(&_t34.key_values, _t35)); map_set(&global_g.chan_push_optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t35 = g->optionals; - int _t37 = _t35.key_values.len; - for (int _t36 = 0; _t36 < _t37; ++_t36 ) { - int _t38 = _t35.key_values.len - _t37; - _t37 = _t35.key_values.len; - if (_t38 < 0) { - _t36 = -1; + Map_string_string _t38 = g->optionals; + int _t40 = _t38.key_values.len; + for (int _t39 = 0; _t39 < _t40; ++_t39 ) { + int _t41 = _t38.key_values.len - _t40; + _t40 = _t38.key_values.len; + if (_t41 < 0) { + _t39 = -1; continue; } - if (!DenseArray_has_index(&_t35.key_values, _t36)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t35.key_values, _t36); + if (!DenseArray_has_index(&_t38.key_values, _t39)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t38.key_values, _t39); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t35.key_values, _t36)); + string v = (*(string*)DenseArray_value(&_t38.key_values, _t39)); map_set(&global_g.optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t39 = g->results; - int _t41 = _t39.key_values.len; - for (int _t40 = 0; _t40 < _t41; ++_t40 ) { - int _t42 = _t39.key_values.len - _t41; - _t41 = _t39.key_values.len; - if (_t42 < 0) { - _t40 = -1; + Map_string_string _t42 = g->results; + int _t44 = _t42.key_values.len; + for (int _t43 = 0; _t43 < _t44; ++_t43 ) { + int _t45 = _t42.key_values.len - _t44; + _t44 = _t42.key_values.len; + if (_t45 < 0) { + _t43 = -1; continue; } - if (!DenseArray_has_index(&_t39.key_values, _t40)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t39.key_values, _t40); + if (!DenseArray_has_index(&_t42.key_values, _t43)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t42.key_values, _t43); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t39.key_values, _t40)); + string v = (*(string*)DenseArray_value(&_t42.key_values, _t43)); map_set(&global_g.results, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t43 = g->as_cast_type_names; - int _t45 = _t43.key_values.len; - for (int _t44 = 0; _t44 < _t45; ++_t44 ) { - int _t46 = _t43.key_values.len - _t45; - _t45 = _t43.key_values.len; - if (_t46 < 0) { - _t44 = -1; + Map_string_string _t46 = g->as_cast_type_names; + int _t48 = _t46.key_values.len; + for (int _t47 = 0; _t47 < _t48; ++_t47 ) { + int _t49 = _t46.key_values.len - _t48; + _t48 = _t46.key_values.len; + if (_t49 < 0) { + _t47 = -1; continue; } - if (!DenseArray_has_index(&_t43.key_values, _t44)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t43.key_values, _t44); + if (!DenseArray_has_index(&_t46.key_values, _t47)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t46.key_values, _t47); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t43.key_values, _t44)); + string v = (*(string*)DenseArray_value(&_t46.key_values, _t47)); map_set(&global_g.as_cast_type_names, &(string[]){k}, &(string[]) { v }); } - Map_int_bool _t47 = g->sumtype_definitions; - int _t49 = _t47.key_values.len; - for (int _t48 = 0; _t48 < _t49; ++_t48 ) { - int _t50 = _t47.key_values.len - _t49; - _t49 = _t47.key_values.len; - if (_t50 < 0) { - _t48 = -1; + Map_int_bool _t50 = g->sumtype_definitions; + int _t52 = _t50.key_values.len; + for (int _t51 = 0; _t51 < _t52; ++_t51 ) { + int _t53 = _t50.key_values.len - _t52; + _t52 = _t50.key_values.len; + if (_t53 < 0) { + _t51 = -1; continue; } - if (!DenseArray_has_index(&_t47.key_values, _t48)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t47.key_values, _t48); - bool v = (*(bool*)DenseArray_value(&_t47.key_values, _t48)); + if (!DenseArray_has_index(&_t50.key_values, _t51)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t50.key_values, _t51); + bool v = (*(bool*)DenseArray_value(&_t50.key_values, _t51)); map_set(&global_g.sumtype_definitions, &(int[]){k}, &(bool[]) { v }); } - _option_int _t51 = strings__Builder_write(&global_g.json_forward_decls, g->json_forward_decls); - if (_t51.state != 0) { /*or block*/ - IError err = _t51.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t51.data); - _option_int _t52 = strings__Builder_write(&global_g.enum_typedefs, g->enum_typedefs); - if (_t52.state != 0) { /*or block*/ - IError err = _t52.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t52.data); - _option_int _t53 = strings__Builder_write(&global_g.channel_definitions, g->channel_definitions); - if (_t53.state != 0) { /*or block*/ - IError err = _t53.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t53.data); - _option_int _t54 = strings__Builder_write(&global_g.sql_buf, g->sql_buf); + _option_int _t54 = strings__Builder_write(&global_g.json_forward_decls, g->json_forward_decls); if (_t54.state != 0) { /*or block*/ IError err = _t54.err; _v_panic(IError_str(err)); @@ -70588,7 +70830,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t54.data); - _option_int _t55 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->cleanup); + _option_int _t55 = strings__Builder_write(&global_g.enum_typedefs, g->enum_typedefs); if (_t55.state != 0) { /*or block*/ IError err = _t55.err; _v_panic(IError_str(err)); @@ -70597,7 +70839,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t55.data); - _option_int _t56 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.inits), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->init); + _option_int _t56 = strings__Builder_write(&global_g.channel_definitions, g->channel_definitions); if (_t56.state != 0) { /*or block*/ IError err = _t56.err; _v_panic(IError_str(err)); @@ -70606,7 +70848,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t56.data); - _option_int _t57 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.global_inits), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->global_init); + _option_int _t57 = strings__Builder_write(&global_g.sql_buf, g->sql_buf); if (_t57.state != 0) { /*or block*/ IError err = _t57.err; _v_panic(IError_str(err)); @@ -70615,50 +70857,58 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t57.data); - for (int _t58 = 0; _t58 < g->str_types.len; ++_t58) { - v__gen__c__StrType str_type = ((v__gen__c__StrType*)g->str_types.data)[_t58]; + _option_int _t58 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->cleanup); + if (_t58.state != 0) { /*or block*/ + IError err = _t58.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + (*(int*)_t58.data); + for (int _t59 = 0; _t59 < g->str_types.len; ++_t59) { + v__gen__c__StrType str_type = ((v__gen__c__StrType*)g->str_types.data)[_t59]; array_push((array*)&global_g.str_types, _MOV((v__gen__c__StrType[]){ str_type })); } - for (int _t60 = 0; _t60 < g->sumtype_casting_fns.len; ++_t60) { - v__gen__c__SumtypeCastingFn scf = ((v__gen__c__SumtypeCastingFn*)g->sumtype_casting_fns.data)[_t60]; + for (int _t61 = 0; _t61 < g->sumtype_casting_fns.len; ++_t61) { + v__gen__c__SumtypeCastingFn scf = ((v__gen__c__SumtypeCastingFn*)g->sumtype_casting_fns.data)[_t61]; if (!Array_v__gen__c__SumtypeCastingFn_contains(global_g.sumtype_casting_fns, scf)) { array_push((array*)&global_g.sumtype_casting_fns, _MOV((v__gen__c__SumtypeCastingFn[]){ scf })); } } global_g.nr_closures += g->nr_closures; global_g.has_main = global_g.has_main || g->has_main; - _PUSH_MANY(&global_g.auto_fn_definitions, (g->auto_fn_definitions), _t62, Array_string); - _PUSH_MANY(&global_g.anon_fn_definitions, (g->anon_fn_definitions), _t63, Array_string); - _PUSH_MANY(&global_g.needed_equality_fns, (g->needed_equality_fns), _t64, Array_v__ast__Type); - _PUSH_MANY(&global_g.array_contains_types, (g->array_contains_types), _t65, Array_v__ast__Type); - _PUSH_MANY(&global_g.array_index_types, (g->array_index_types), _t66, Array_v__ast__Type); - _PUSH_MANY(&global_g.pcs, (g->pcs), _t67, Array_v__gen__c__ProfileCounterMeta); - _PUSH_MANY(&global_g.json_types, (g->json_types), _t68, Array_v__ast__Type); - _PUSH_MANY(&global_g.hotcode_fn_names, (g->hotcode_fn_names), _t69, Array_string); + _PUSH_MANY(&global_g.auto_fn_definitions, (g->auto_fn_definitions), _t63, Array_string); + _PUSH_MANY(&global_g.anon_fn_definitions, (g->anon_fn_definitions), _t64, Array_string); + _PUSH_MANY(&global_g.needed_equality_fns, (g->needed_equality_fns), _t65, Array_v__ast__Type); + _PUSH_MANY(&global_g.array_contains_types, (g->array_contains_types), _t66, Array_v__ast__Type); + _PUSH_MANY(&global_g.array_index_types, (g->array_index_types), _t67, Array_v__ast__Type); + _PUSH_MANY(&global_g.pcs, (g->pcs), _t68, Array_v__gen__c__ProfileCounterMeta); + _PUSH_MANY(&global_g.json_types, (g->json_types), _t69, Array_v__ast__Type); + _PUSH_MANY(&global_g.hotcode_fn_names, (g->hotcode_fn_names), _t70, Array_string); + _PUSH_MANY(&global_g.test_function_names, (g->test_function_names), _t71, Array_string); v__gen__c__Gen_free_builders(g); - Map_int_bool _t70 = g->autofree_methods; - int _t72 = _t70.key_values.len; - for (int _t71 = 0; _t71 < _t72; ++_t71 ) { - int _t73 = _t70.key_values.len - _t72; - _t72 = _t70.key_values.len; - if (_t73 < 0) { - _t71 = -1; + Map_int_bool _t72 = g->autofree_methods; + int _t74 = _t72.key_values.len; + for (int _t73 = 0; _t73 < _t74; ++_t73 ) { + int _t75 = _t72.key_values.len - _t74; + _t74 = _t72.key_values.len; + if (_t75 < 0) { + _t73 = -1; continue; } - if (!DenseArray_has_index(&_t70.key_values, _t71)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t70.key_values, _t71); - bool v = (*(bool*)DenseArray_value(&_t70.key_values, _t71)); + if (!DenseArray_has_index(&_t72.key_values, _t73)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t72.key_values, _t73); + bool v = (*(bool*)DenseArray_value(&_t72.key_values, _t73)); map_set(&global_g.autofree_methods, &(int[]){k}, &(bool[]) { v }); } } } else { - for (int _t74 = 0; _t74 < files.len; ++_t74) { - v__ast__File* file = ((v__ast__File**)files.data)[_t74]; + for (int _t76 = 0; _t76 < files.len; ++_t76) { + v__ast__File* file = ((v__ast__File**)files.data)[_t76]; global_g.file = file; v__gen__c__Gen_gen_file(&global_g); - strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.inits), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.init, 100); strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.cleanup, 100); - strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.global_inits), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.global_init, 100); } v__util__Timers_start(global_g.timers, _SLIT("cgen unification")); } @@ -70669,8 +70919,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre for (int i = 0; i < global_g.str_types.len; i++) { v__gen__c__Gen_final_gen_str(&global_g, (*(v__gen__c__StrType*)/*ee elem_sym */array_get(global_g.str_types, i))); } - for (int _t75 = 0; _t75 < global_g.sumtype_casting_fns.len; ++_t75) { - v__gen__c__SumtypeCastingFn sumtype_casting_fn = ((v__gen__c__SumtypeCastingFn*)global_g.sumtype_casting_fns.data)[_t75]; + for (int _t77 = 0; _t77 < global_g.sumtype_casting_fns.len; ++_t77) { + v__gen__c__SumtypeCastingFn sumtype_casting_fn = ((v__gen__c__SumtypeCastingFn*)global_g.sumtype_casting_fns.data)[_t77]; v__gen__c__Gen_write_sumtype_casting_fn(&global_g, sumtype_casting_fn); } v__gen__c__Gen_write_shareds(&global_g); @@ -70680,6 +70930,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_gen_array_index_methods(&global_g); v__gen__c__Gen_gen_equality_fns(&global_g); v__gen__c__Gen_gen_free_methods(&global_g); + v__gen__c__Gen_sort_globals_consts(&global_g); v__util__Timers_show(global_g.timers, _SLIT("cgen unification")); v__gen__c__Gen g = global_g; v__util__Timers_start(g.timers, _SLIT("cgen common")); @@ -70738,6 +70989,22 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_write_string(&b, strings__Builder_str(&g.json_forward_decls)); strings__Builder_writeln(&b, _SLIT("\n// V definitions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.definitions)); + strings__Builder_writeln(&b, _SLIT("\n// V global/const definitions:")); + for (int _t78 = 0; _t78 < g.sorted_global_const_names.len; ++_t78) { + string var_name = ((string*)g.sorted_global_const_names.data)[_t78]; + v__gen__c__GlobalConstDef* _t80 = (v__gen__c__GlobalConstDef*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g.global_const_defs), &(string[]){var_name})); + _option_v__gen__c__GlobalConstDef _t79 = {0}; + if (_t80) { + *((v__gen__c__GlobalConstDef*)&_t79.data) = *((v__gen__c__GlobalConstDef*)_t80); + } else { + _t79.state = 2; _t79.err = _v_error(_SLIT("array index out of range")); + } + + if (_t79.state == 0) { + v__gen__c__GlobalConstDef var = (*(v__gen__c__GlobalConstDef*)_t79.data); + strings__Builder_writeln(&b, var.def); + } + } string interface_table = v__gen__c__Gen_interface_table(&g); if (interface_table.len > 0) { strings__Builder_writeln(&b, _SLIT("\n// V interface table:")); @@ -70764,10 +71031,6 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_writeln(&b, _SLIT("\n// V channel code:")); strings__Builder_write_string(&b, strings__Builder_str(&g.channel_definitions)); } - if (g.stringliterals.len > 0) { - strings__Builder_writeln(&b, _SLIT("\n// V stringliterals:")); - strings__Builder_write_string(&b, strings__Builder_str(&g.stringliterals)); - } if (g.auto_str_funcs.len > 0) { strings__Builder_writeln(&b, _SLIT("\n// V auto str functions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.auto_str_funcs)); @@ -70777,8 +71040,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_write_string(&b, strings__Builder_str(&g.dump_funcs)); } if (g.auto_fn_definitions.len > 0) { - for (int _t76 = 0; _t76 < g.auto_fn_definitions.len; ++_t76) { - string fn_def = ((string*)g.auto_fn_definitions.data)[_t76]; + for (int _t81 = 0; _t81 < g.auto_fn_definitions.len; ++_t81) { + string fn_def = ((string*)g.auto_fn_definitions.data)[_t81]; strings__Builder_writeln(&b, fn_def); } } @@ -70787,8 +71050,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_writeln(&b, _SLIT("\n// V closure helpers")); strings__Builder_writeln(&b, v__gen__c__c_closure_helpers(g.pref)); } - for (int _t77 = 0; _t77 < g.anon_fn_definitions.len; ++_t77) { - string fn_def = ((string*)g.anon_fn_definitions.data)[_t77]; + for (int _t82 = 0; _t82 < g.anon_fn_definitions.len; ++_t82) { + string fn_def = ((string*)g.anon_fn_definitions.data)[_t82]; strings__Builder_writeln(&b, fn_def); } } @@ -70800,16 +71063,16 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre #if defined(CUSTOM_DEFINE_trace_all_generic_fn_keys) { Array_string gkeys = map_keys(&g.table->fn_generic_types); - for (int _t78 = 0; _t78 < gkeys.len; ++_t78) { - string gkey = ((string*)gkeys.data)[_t78]; + for (int _t83 = 0; _t83 < gkeys.len; ++_t83) { + string gkey = ((string*)gkeys.data)[_t83]; eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT(">> g.table.fn_generic_types key: "), /*115 &string*/0xfe10, {.d_s = gkey}}, {_SLIT0, 0, { .d_c = 0 }}}))); } } #endif strings__Builder_free(&b); v__gen__c__Gen_free_builders(&g); - string _t79 = res; - return _t79; + string _t84 = res; + return _t84; } VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__PoolProcessor* p, int idx, int wid) { @@ -70831,14 +71094,9 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .hotcode_definitions = strings__new_builder(100), .channel_definitions = strings__new_builder(100), .comptime_definitions = strings__new_builder(100), - .global_inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .global_init = strings__new_builder(0), - .inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .init = strings__new_builder(100), .cleanup = strings__new_builder(100), .cleanups = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .gowrappers = strings__new_builder(100), - .stringliterals = strings__new_builder(100), .auto_str_funcs = strings__new_builder(100), .dump_funcs = __new_array(0, 0, sizeof(u8)), .pcs_declarations = strings__new_builder(100), @@ -70849,6 +71107,8 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .out_results = strings__new_builder(100), .json_forward_decls = strings__new_builder(100), .sql_buf = strings__new_builder(100), + .global_const_defs = new_map(sizeof(string), sizeof(v__gen__c__GlobalConstDef), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .sorted_global_const_names = __new_array(0, 0, sizeof(string)), .file = file, .unique_file_path_hash = 0, .fn_decl = 0, @@ -70971,6 +71231,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .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, + .test_function_names = __new_array(0, 0, sizeof(string)), }, sizeof(v__gen__c__Gen))); v__gen__c__Gen_gen_file(g); v__gen__c__Gen* _t1 = g; @@ -70987,11 +71248,8 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder_free(&g->type_definitions); strings__Builder_free(&g->alias_definitions); strings__Builder_free(&g->definitions); - strings__Builder_free(&g->global_init); - strings__Builder_free(&g->init); strings__Builder_free(&g->cleanup); strings__Builder_free(&g->gowrappers); - strings__Builder_free(&g->stringliterals); strings__Builder_free(&g->auto_str_funcs); strings__Builder_free(&g->dump_funcs); strings__Builder_free(&g->comptime_definitions); @@ -71006,7 +71264,7 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder_free(&g->json_forward_decls); strings__Builder_free(&g->enum_typedefs); strings__Builder_free(&g->sql_buf); - Map_string_strings__Builder _t1 = g->global_inits; + Map_string_strings__Builder _t1 = g->cleanups; int _t3 = _t1.key_values.len; for (int _t2 = 0; _t2 < _t3; ++_t2 ) { int _t4 = _t1.key_values.len - _t3; @@ -71019,32 +71277,6 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t1.key_values, _t2)); strings__Builder_free(v); } - Map_string_strings__Builder _t5 = g->inits; - int _t7 = _t5.key_values.len; - for (int _t6 = 0; _t6 < _t7; ++_t6 ) { - int _t8 = _t5.key_values.len - _t7; - _t7 = _t5.key_values.len; - if (_t8 < 0) { - _t6 = -1; - continue; - } - if (!DenseArray_has_index(&_t5.key_values, _t6)) {continue;} - strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t5.key_values, _t6)); - strings__Builder_free(v); - } - Map_string_strings__Builder _t9 = g->cleanups; - int _t11 = _t9.key_values.len; - for (int _t10 = 0; _t10 < _t11; ++_t10 ) { - int _t12 = _t9.key_values.len - _t11; - _t11 = _t9.key_values.len; - if (_t12 < 0) { - _t10 = -1; - continue; - } - if (!DenseArray_has_index(&_t9.key_values, _t10)) {continue;} - strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t9.key_values, _t10)); - strings__Builder_free(v); - } } } @@ -71120,13 +71352,6 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { v__gen__c__Gen_write_sorted_types(g); v__gen__c__Gen_write_multi_return_types(g); strings__Builder_writeln(&g->definitions, _SLIT("// end of definitions #endif")); - if (!g->pref->no_builtin) { - strings__Builder_writeln(&g->stringliterals, _SLIT("")); - strings__Builder_writeln(&g->stringliterals, _SLIT("// >> string literal consts")); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - strings__Builder_writeln(&g->stringliterals, _SLIT("void vinit_string_literals(void){")); - } - } if (g->pref->compile_defines_all.len > 0) { strings__Builder_writeln(&g->comptime_definitions, _SLIT("// V compile time defines by -d or -define flags:")); strings__Builder_writeln(&g->comptime_definitions, string__plus(_SLIT("// All custom defines : "), Array_string_join(g->pref->compile_defines_all, _SLIT(",")))); @@ -71215,13 +71440,6 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { } void v__gen__c__Gen_finish(v__gen__c__Gen* g) { - if (!g->pref->no_builtin) { - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - strings__Builder_writeln(&g->stringliterals, _SLIT("}")); - } - strings__Builder_writeln(&g->stringliterals, _SLIT("// << string literal consts")); - strings__Builder_writeln(&g->stringliterals, _SLIT("")); - } if (g->pref->is_prof && g->pref->build_mode != v__pref__BuildMode__build_module) { v__gen__c__Gen_gen_vprint_profile_stats(g); } @@ -71440,18 +71658,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_38074 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_38074.arg0; - string base = mr_38074.arg1; + multi_return_string_string mr_37072 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_37072.arg0; + string base = mr_37072.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_38207 = v__gen__c__Gen_result_type_name(g, t); - string styp = mr_38207.arg0; - string base = mr_38207.arg1; + multi_return_string_string mr_37205 = v__gen__c__Gen_result_type_name(g, t); + string styp = mr_37205.arg0; + string base = mr_37205.arg1; map_set(&g->results, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -72138,19 +72356,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - if (node._typ == 308 /* v.ast.EmptyStmt */) { - } - else if (node._typ == 300 /* v.ast.AsmStmt */) { + if (node._typ == 300 /* v.ast.AsmStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AsmStmt).pos); - v__gen__c__Gen_gen_asm_stmt(g, (*node._v__ast__AsmStmt)); + v__gen__c__Gen_asm_stmt(g, (*node._v__ast__AsmStmt)); } else if (node._typ == 301 /* v.ast.AssertStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssertStmt).pos); - v__gen__c__Gen_gen_assert_stmt(g, (*node._v__ast__AssertStmt)); + v__gen__c__Gen_assert_stmt(g, (*node._v__ast__AssertStmt)); } else if (node._typ == 302 /* v.ast.AssignStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssignStmt).pos); - v__gen__c__Gen_gen_assign_stmt(g, (*node._v__ast__AssignStmt)); + v__gen__c__Gen_assign_stmt(g, (*node._v__ast__AssignStmt)); } else if (node._typ == 303 /* v.ast.Block */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__Block).pos); @@ -72246,6 +72462,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_defer_flag_var(g, (voidptr)&/*qq*/defer_stmt)}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); array_push((array*)&g->defer_stmts, _MOV((v__ast__DeferStmt[]){ defer_stmt })); } + else if (node._typ == 308 /* v.ast.EmptyStmt */) { + } else if (node._typ == 309 /* v.ast.EnumDecl */) { v__gen__c__Gen_enum_decl(g, (*node._v__ast__EnumDecl)); } @@ -72518,8 +72736,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, *(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_66950 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66950.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_65936 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_65936.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 }}})); @@ -72733,7 +72951,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_attrs(v__gen__c__Gen* g, Array_v__ast__A } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt) { v__gen__c__Gen_write(g, _SLIT("__asm__")); if (stmt.is_volatile) { v__gen__c__Gen_write(g, _SLIT(" volatile")); @@ -73515,6 +73733,9 @@ 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(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_lock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx);"), 0, { .d_c = 0 }}}))); } g->inside_map_postfix = true; + if ((*node._v__ast__PostfixExpr).is_c2v_prefix) { + v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + } if (v__ast__Expr_is_auto_deref_var((*node._v__ast__PostfixExpr).expr)) { v__gen__c__Gen_write(g, _SLIT("(*")); v__gen__c__Gen_expr(g, (*node._v__ast__PostfixExpr).expr); @@ -73523,7 +73744,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_expr(g, (*node._v__ast__PostfixExpr).expr); } g->inside_map_postfix = false; - v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + if (!(*node._v__ast__PostfixExpr).is_c2v_prefix) { + v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + } if (((*node._v__ast__PostfixExpr).auto_locked).len != 0) { v__gen__c__Gen_writeln(g, _SLIT(";")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_unlock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx)"), 0, { .d_c = 0 }}}))); @@ -73844,7 +74067,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel g->nr_closures++; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(receiver.typ)) { - v__gen__c__Gen_write(g, _SLIT("memdup(")); + v__gen__c__Gen_write(g, _SLIT("memdup_uncollectable(")); } if (!v__ast__Type_is_ptr(node.expr_type)) { v__gen__c__Gen_write(g, _SLIT("&")); @@ -74059,11 +74282,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_108677 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108677.arg0; - string key_eq_fn = mr_108677.arg1; - string clone_fn = mr_108677.arg2; - string free_fn = mr_108677.arg3; + multi_return_string_string_string_string mr_107766 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_107766.arg0; + string key_eq_fn = mr_107766.arg1; + string clone_fn = mr_107766.arg2; + string free_fn = mr_107766.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -74882,22 +75105,15 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; if (field.expr._typ == 250 /* v.ast.ArrayInit */) { if ((*field.expr._v__ast__ArrayInit).is_fixed) { string styp = v__gen__c__Gen_typ(g, (*field.expr._v__ast__ArrayInit).typ); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - string val = v__gen__c__Gen_expr_string(g, field.expr); - strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}}))); - } else { - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}}))); - } + string val = v__gen__c__Gen_expr_string(g, field.expr); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = field.mod,.def = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = v__ast__Table_dependent_names_in_expr(g->table, field_expr),.order = 0,}); } else { v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } } else if (field.expr._typ == 294 /* v.ast.StringLiteral */) { - strings__Builder_writeln(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}}))); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - string val = v__gen__c__Gen_expr_string(g, field.expr); - strings__Builder_writeln(&g->stringliterals, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - } + string val = v__gen__c__Gen_expr_string(g, field.expr); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = field.mod,.def = str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}})),.init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}})),.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } else if (field.expr._typ == 256 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*field.expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional)) { @@ -74916,13 +75132,13 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; _option_v__ast__ComptTimeConstValue _t3; if (_t3 = v__ast__ConstField_comptime_expr_value(&field), _t3.state == 0) { v__ast__ComptTimeConstValue ct_value = *(v__ast__ComptTimeConstValue*)_t3.data; - if (v__gen__c__Gen_const_decl_precomputed(g, field.mod, name, ct_value, field.typ)) { + if (v__gen__c__Gen_const_decl_precomputed(g, field.mod, name, field.name, ct_value, field.typ)) { continue; } } } if (v__ast__ConstField_is_simple_define_const(&field)) { - v__gen__c__Gen_const_decl_simple_define(g, field.name, v__gen__c__Gen_expr_string(g, field_expr)); + v__gen__c__Gen_const_decl_simple_define(g, field.mod, field.name, v__gen__c__Gen_expr_string(g, field_expr)); } else { v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } @@ -74936,7 +75152,7 @@ if (v__gen__c__Gen_const_decl_defer_0) { // Defer end } -VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ) { +VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, string field_name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ) { string styp = v__gen__c__Gen_typ(g, typ); string cname = (g->pref->translated && !g->is_builtin_mod ? (name) : ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})))); #if defined(CUSTOM_DEFINE_trace_const_precomputed) @@ -74945,13 +75161,13 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st } #endif if (ct_value._typ == 5 /* i8 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i8_str((*ct_value._i8))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i8_str((*ct_value._i8))); } else if (ct_value._typ == 6 /* i16 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i16_str((*ct_value._i16))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i16_str((*ct_value._i16))); } else if (ct_value._typ == 7 /* int */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, int_str((*ct_value._int))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, int_str((*ct_value._int))); } else if (ct_value._typ == 8 /* i64 */) { if (v__ast__Type_alias_eq(typ, _const_v__ast__i64_type)) { @@ -74959,33 +75175,33 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t1; } if (v__ast__Type_alias_eq(typ, _const_v__ast__int_type)) { - v__gen__c__Gen_const_decl_simple_define(g, name, i64_str((*ct_value._i64))); + v__gen__c__Gen_const_decl_simple_define(g, mod, name, i64_str((*ct_value._i64))); bool _t2 = true; return _t2; } if (v__ast__Type_alias_eq(typ, _const_v__ast__u64_type)) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, string__plus(i64_str((*ct_value._i64)), _SLIT("U"))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, string__plus(i64_str((*ct_value._i64)), _SLIT("U"))); } else { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i64_str((*ct_value._i64))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i64_str((*ct_value._i64))); } } else if (ct_value._typ == 10 /* u8 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u8_str((*ct_value._u8))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u8_str((*ct_value._u8))); } else if (ct_value._typ == 11 /* u16 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u16_str((*ct_value._u16))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u16_str((*ct_value._u16))); } else if (ct_value._typ == 12 /* u32 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u32_str((*ct_value._u32))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u32_str((*ct_value._u32))); } else if (ct_value._typ == 13 /* u64 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, string__plus(u64_str((*ct_value._u64)), _SLIT("U"))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, string__plus(u64_str((*ct_value._u64)), _SLIT("U"))); } else if (ct_value._typ == 15 /* f32 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, f32_str((*ct_value._f32))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, f32_str((*ct_value._f32))); } else if (ct_value._typ == 16 /* f64 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, f64_str((*ct_value._f64))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, f64_str((*ct_value._f64))); } else if (ct_value._typ == 21 /* rune */) { u32 rune_code = ((u32)((*ct_value._rune))); @@ -74995,15 +75211,14 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t3; } string escval = v__util__smart_quote(u8_ascii_str(((u8)(rune_code))), false); - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = escval}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = escval}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u32_str(((u32)((*ct_value._rune))))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u32_str(((u32)((*ct_value._rune))))); } } else if (ct_value._typ == 20 /* string */) { string escaped_val = v__util__smart_quote((*ct_value._string), false); - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // str inited later"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&g->init, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = escaped_val}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // str inited later"), 0, { .d_c = 0 }}})),.init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = escaped_val}}, {_SLIT("\");"), 0, { .d_c = 0 }}})),.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); if (g->is_autofree) { strings__Builder_writeln(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring_free(&"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } @@ -75017,11 +75232,11 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t5; } -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string styp, string cname, string ct_value) { - strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = ct_value}}, {_SLIT("; // precomputed"), 0, { .d_c = 0 }}}))); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string mod, string styp, string cname, string field_name, string ct_value) { + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = ct_value}}, {_SLIT("; // precomputed"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,}); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string mod, string name, string val) { string x = v__util__no_dots(name); if (g->pref->translated && !g->is_builtin_mod && !v__util__module_is_builtin(string_all_before_last(name, _SLIT(".")))) { if (string_starts_with(x, _SLIT("main__"))) { @@ -75031,35 +75246,32 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, x = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT0, 0, { .d_c = 0 }}})); } if (g->pref->translated) { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("const int "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT("const int "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } else { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("#define "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(&g->definitions, val); - if (g->pref->translated) { - strings__Builder_write_string(&g->definitions, _SLIT(";")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT("#define "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT0, 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } } VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, string mod, string name, v__ast__Expr expr, v__ast__Type typ, bool unwrap_option) { string styp = v__gen__c__Gen_typ(g, typ); string cname = (g->pref->translated && !g->is_builtin_mod ? (name) : ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})))); - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // inited later"), 0, { .d_c = 0 }}}))); + strings__Builder init = strings__new_builder(100); if (string__eq(cname, _SLIT("_const_os__args"))) { if (g->pref->os == v__pref__OS__windows) { - strings__Builder_writeln(&g->init, _SLIT("\t_const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv);")); + strings__Builder_writeln(&init, _SLIT("\t_const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv);")); } else { - strings__Builder_writeln(&g->init, _SLIT("\t_const_os__args = os__init_os_args(___argc, (byte**)___argv);")); + strings__Builder_writeln(&init, _SLIT("\t_const_os__args = os__init_os_args(___argc, (byte**)___argv);")); } } else { if (unwrap_option) { - strings__Builder_writeln(&g->init, _SLIT("{")); - strings__Builder_writeln(&g->init, v__gen__c__Gen_expr_string_surround(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), 0, { .d_c = 0 }}})), expr, _SLIT(".data;"))); - strings__Builder_writeln(&g->init, _SLIT("}")); + strings__Builder_writeln(&init, _SLIT("{")); + strings__Builder_writeln(&init, v__gen__c__Gen_expr_string_surround(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), 0, { .d_c = 0 }}})), expr, _SLIT(".data;"))); + strings__Builder_writeln(&init, _SLIT("}")); } else { - strings__Builder_writeln(&g->init, v__gen__c__Gen_expr_string_surround(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), 0, { .d_c = 0 }}})), expr, _SLIT(";"))); + strings__Builder_writeln(&init, v__gen__c__Gen_expr_string_surround(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), 0, { .d_c = 0 }}})), expr, _SLIT(";"))); } } + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // inited later"), 0, { .d_c = 0 }}})),.init = string_trim_right(strings__Builder_str(&init), _SLIT("\n")),.dep_names = v__ast__Table_dependent_names_in_expr(g->table, expr),.order = 0,}); if (g->is_autofree) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (string_starts_with(styp, _SLIT("Array_"))) { @@ -75104,35 +75316,39 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa if (field.has_expr && (anon_fn_expr)._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn)); string fn_type_name = v__gen__c__Gen_get_anon_fn_type_name(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn), field.name); - 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 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(fn_type_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = 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 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); continue; } + strings__Builder def_builder = strings__new_builder(100); + string init = _SLIT(""); string _v_extern = (cextern ? (_SLIT("extern ")) : (_SLIT(""))); string modifier = (field.is_volatile ? (_SLIT(" volatile ")) : (_SLIT(""))); - 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 }}}))); + strings__Builder_write_string(&def_builder, 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")); + strings__Builder_writeln(&def_builder, _SLIT("; // global5")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = strings__Builder_str(&def_builder),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); 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 }}}))); + strings__Builder_write_string(&def_builder, 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 }}}))); } else if ((v__ast__Expr_is_literal(field.expr) && should_init) || cinit || ((field.expr)._typ == 250 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((field.expr)._v__ast__ArrayInit,(field.expr)._typ, 250) /*expected idx: 250, name: v.ast.ArrayInit */ ).is_fixed)) { - 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 }}}))); + strings__Builder_write_string(&def_builder, 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 }}}))); } else { - strings__Builder_writeln(&g->global_init, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT("; // 3global"), 0, { .d_c = 0 }}}))); + init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT("; // 3global"), 0, { .d_c = 0 }}})); } } else if (!g->pref->translated) { string default_initializer = v__gen__c__Gen_type_default(g, field.typ); if (string__eq(default_initializer, _SLIT("{0}")) && should_init) { - strings__Builder_write_string(&g->definitions, _SLIT(" = {0}")); + strings__Builder_write_string(&def_builder, _SLIT(" = {0}")); } else { if (!(string__eq(field.name, _SLIT("as_cast_type_indexes")) || string__eq(field.name, _SLIT("g_memory_block")) || string__eq(field.name, _SLIT("global_allocator")))) { - strings__Builder_writeln(&g->global_init, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)&(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]){"), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_default(g, field.typ)}}, {_SLIT("}[0]); // global"), 0, { .d_c = 0 }}}))); + init = str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)&(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]){"), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_default(g, field.typ)}}, {_SLIT("}[0]); // global"), 0, { .d_c = 0 }}})); } } } - strings__Builder_writeln(&g->definitions, _SLIT("; // global4")); + strings__Builder_writeln(&def_builder, _SLIT("; // global4")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = strings__Builder_str(&def_builder),.init = init,.dep_names = v__ast__Table_dependent_names_in_expr(g->table, field.expr),.order = 0,}); } } @@ -75218,26 +75434,46 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; v__gen__c__Gen_write(g, _SLIT("\tas_cast_type_indexes = ")); v__gen__c__Gen_writeln(g, v__gen__c__Gen_as_cast_name_table(g)); v__gen__c__Gen_writeln(g, _SLIT("\tbuiltin_init();")); - v__gen__c__Gen_writeln(g, _SLIT("\tvinit_string_literals();")); if (g->nr_closures > 0) { v__gen__c__Gen_writeln(g, _SLIT("\t_closure_mtx_init();")); } for (int _t1 = 0; _t1 < g->table->modules.len; ++_t1) { string mod_name = ((string*)g->table->modules.data)[_t1]; - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t{ // Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(" :"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_write(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->inits), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); - v__gen__c__Gen_write(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->global_inits), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); + bool is_empty = true; + for (int _t2 = 0; _t2 < g->sorted_global_const_names.len; ++_t2) { + string var_name = ((string*)g->sorted_global_const_names.data)[_t2]; + v__gen__c__GlobalConstDef* _t4 = (v__gen__c__GlobalConstDef*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->global_const_defs), &(string[]){var_name})); + _option_v__gen__c__GlobalConstDef _t3 = {0}; + if (_t4) { + *((v__gen__c__GlobalConstDef*)&_t3.data) = *((v__gen__c__GlobalConstDef*)_t4); + } else { + _t3.state = 2; _t3.err = _v_error(_SLIT("array index out of range")); + } + + if (_t3.state == 0) { + v__gen__c__GlobalConstDef var = (*(v__gen__c__GlobalConstDef*)_t3.data); + if (string__eq(var.mod, mod_name) && var.init.len > 0) { + if (is_empty) { + is_empty = false; + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + v__gen__c__Gen_writeln(g, var.init); + } + } + } string init_fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(".init"), 0, { .d_c = 0 }}})); - _option_v__ast__Fn _t2; - if (_t2 = v__ast__Table_find_fn(g->table, init_fn_name), _t2.state == 0) { - v__ast__Fn initfn = *(v__ast__Fn*)_t2.data; + _option_v__ast__Fn _t5; + if (_t5 = v__ast__Table_find_fn(g->table, init_fn_name), _t5.state == 0) { + v__ast__Fn initfn = *(v__ast__Fn*)_t5.data; if (v__ast__Type_alias_eq(initfn.return_type, _const_v__ast__void_type) && initfn.params.len == 0) { + if (is_empty) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } string mod_c_name = v__util__no_dots(mod_name); string init_fn_c_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = mod_c_name}}, {_SLIT("__init"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = init_fn_c_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); } } - v__gen__c__Gen_writeln(g, _SLIT("\t}")); } v__gen__c__Gen_writeln(g, _SLIT("}")); if (g->pref->printfn_list.len > 0 && Array_string_contains(g->pref->printfn_list, _SLIT("_vinit"))) { @@ -75247,8 +75483,8 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; v__gen__c__Gen_writeln(g, _SLIT("void _vcleanup(void) {")); if (g->is_autofree) { Array_string reversed_table_modules = array_reverse(g->table->modules); - for (int _t3 = 0; _t3 < reversed_table_modules.len; ++_t3) { - string mod_name = ((string*)reversed_table_modules.data)[_t3]; + for (int _t6 = 0; _t6 < reversed_table_modules.len; ++_t6) { + string mod_name = ((string*)reversed_table_modules.data)[_t6]; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Cleanups for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(" :"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); } @@ -75360,9 +75596,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_149065 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_149065.arg0; - string base = mr_149065.arg1; + multi_return_string_string mr_149616 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_149616.arg0; + string base = mr_149616.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -75487,6 +75723,45 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } +VV_LOCAL_SYMBOL void v__gen__c__Gen_sort_globals_consts(v__gen__c__Gen* g) { +bool v__gen__c__Gen_sort_globals_consts_defer_0 = false; + v__util__timing_start(_SLIT("Gen.sort_globals_consts")); + v__gen__c__Gen_sort_globals_consts_defer_0 = true; + array_clear(&g->sorted_global_const_names); + v__depgraph__DepGraph* dep_graph = v__depgraph__new_dep_graph(); + Map_string_v__gen__c__GlobalConstDef _t1 = g->global_const_defs; + int _t3 = _t1.key_values.len; + for (int _t2 = 0; _t2 < _t3; ++_t2 ) { + int _t4 = _t1.key_values.len - _t3; + _t3 = _t1.key_values.len; + if (_t4 < 0) { + _t2 = -1; + continue; + } + if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} + string var_name = /*key*/ *(string*)DenseArray_key(&_t1.key_values, _t2); + var_name = string_clone(var_name); + v__gen__c__GlobalConstDef var_info = (*(v__gen__c__GlobalConstDef*)DenseArray_value(&_t1.key_values, _t2)); + v__depgraph__DepGraph_add_with_value(dep_graph, var_name, var_info.dep_names, var_info.order); + } + v__depgraph__DepGraph* dep_graph_sorted = v__depgraph__DepGraph_resolve(dep_graph); + Array_int _t5 = new_array_from_c_array(2, 2, sizeof(int), _MOV((int[2]){-1, 0})); + for (int _t6 = 0; _t6 < _t5.len; ++_t6) { + int order = ((int*)_t5.data)[_t6]; + for (int _t7 = 0; _t7 < dep_graph_sorted->nodes.len; ++_t7) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)dep_graph_sorted->nodes.data)[_t7]; + if (node.value == order) { + array_push((array*)&g->sorted_global_const_names, _MOV((string[]){ string_clone(node.name) })); + } + } + } +// Defer begin +if (v__gen__c__Gen_sort_globals_consts_defer_0) { + v__util__timing_measure(_SLIT("Gen.sort_globals_consts")); +} +// Defer end +} + VV_LOCAL_SYMBOL Array_v__ast__TypeSymbol_ptr v__gen__c__Gen_sort_structs(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr typesa) { bool v__gen__c__Gen_sort_structs_defer_0 = false; v__util__timing_start(_SLIT("Gen.sort_structs")); @@ -75657,11 +75932,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_158929 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158929.arg0; - string pafile = mr_158929.arg1; - string pamod = mr_158929.arg2; - string pafn = mr_158929.arg3; + multi_return_int_string_string_string mr_159987 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_159987.arg0; + string pafile = mr_159987.arg1; + string pamod = mr_159987.arg2; + string pafn = mr_159987.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 }}}))); @@ -75684,11 +75959,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_160199 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_160199.arg0; - string pafile = mr_160199.arg1; - string pamod = mr_160199.arg2; - string pafn = mr_160199.arg3; + multi_return_int_string_string_string mr_161257 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_161257.arg0; + string pafile = mr_161257.arg1; + string pamod = mr_161257.arg2; + string pafn = mr_161257.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 }}}))); @@ -75798,11 +76073,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_162807 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162807.arg0; - string key_eq_fn = mr_162807.arg1; - string clone_fn = mr_162807.arg2; - string free_fn = mr_162807.arg3; + multi_return_string_string_string_string mr_163865 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_163865.arg0; + string key_eq_fn = mr_163865.arg1; + string clone_fn = mr_163865.arg2; + string free_fn = mr_163865.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(""))); @@ -75921,30 +76196,18 @@ VV_LOCAL_SYMBOL Array_string v__gen__c__Gen_get_all_test_function_names(v__gen__ Array_string tfuncs = __new_array_with_default(0, 0, sizeof(string), 0); string tsuite_begin = _SLIT(""); string tsuite_end = _SLIT(""); - Map_string_v__ast__Fn _t1 = g->table->fns; - int _t3 = _t1.key_values.len; - for (int _t2 = 0; _t2 < _t3; ++_t2 ) { - int _t4 = _t1.key_values.len - _t3; - _t3 = _t1.key_values.len; - if (_t4 < 0) { - _t2 = -1; + for (int _t1 = 0; _t1 < g->test_function_names.len; ++_t1) { + string name = ((string*)g->test_function_names.data)[_t1]; + if (string_ends_with(name, _SLIT(".testsuite_begin"))) { + tsuite_begin = name; continue; } - if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} - v__ast__Fn f = (*(v__ast__Fn*)DenseArray_value(&_t1.key_values, _t2)); - if (!f.is_test) { + if (string_contains(name, _SLIT(".test_"))) { + array_push((array*)&tfuncs, _MOV((string[]){ string_clone(name) })); continue; } - if (string_ends_with(f.name, _SLIT(".testsuite_begin"))) { - tsuite_begin = f.name; - continue; - } - if (string_contains(f.name, _SLIT(".test_"))) { - array_push((array*)&tfuncs, _MOV((string[]){ string_clone(f.name) })); - continue; - } - if (string_ends_with(f.name, _SLIT(".testsuite_end"))) { - tsuite_end = f.name; + if (string_ends_with(name, _SLIT(".testsuite_end"))) { + tsuite_end = name; continue; } } @@ -75952,12 +76215,12 @@ VV_LOCAL_SYMBOL Array_string v__gen__c__Gen_get_all_test_function_names(v__gen__ if (tsuite_begin.len > 0) { array_push((array*)&all_tfuncs, _MOV((string[]){ string_clone(tsuite_begin) })); } - _PUSH_MANY(&all_tfuncs, (tfuncs), _t7, Array_string); + _PUSH_MANY(&all_tfuncs, (tfuncs), _t4, Array_string); if (tsuite_end.len > 0) { array_push((array*)&all_tfuncs, _MOV((string[]){ string_clone(tsuite_end) })); } - Array_string _t9 = all_tfuncs; - return _t9; + Array_string _t6 = all_tfuncs; + return _t6; } VV_LOCAL_SYMBOL void v__gen__c__Gen_size_of(v__gen__c__Gen* g, v__ast__SizeOf node) { @@ -76343,8 +76606,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_177871 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_177871.arg0; + multi_return_Array_string_Array_string_Array_bool mr_178892 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_178892.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__")); @@ -76358,11 +76621,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { _option_multi_return_v__ast__Fn_Array_v__ast__Type _t26 = v__ast__Table_find_method_from_embeds(g->table, st_sym, method.name); if (_t26.state != 0) { /*or block*/ IError err = _t26.err; - *(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*) _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)),.dep_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_178335 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_178335.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_179356 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_179356.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 }}})); @@ -76736,6 +76999,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_leak) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_find_leak(1);")); } + v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_pages_executable(0);")); v__gen__c__Gen_writeln(g, _SLIT("\tGC_INIT();")); if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr || g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr_opt) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_enable_incremental();")); @@ -76775,22 +77039,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_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; + multi_return_int_string_string_string mr_5051 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_5051.arg0; + string pafile = mr_5051.arg1; + string pamod = mr_5051.arg2; + string pafn = mr_5051.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_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; + multi_return_int_string_string_string mr_5742 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5742.arg0; + string pafile = mr_5742.arg1; + string pamod = mr_5742.arg2; + string pafn = mr_5742.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);")); @@ -76822,6 +77086,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_leak) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_find_leak(1);")); } + v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_pages_executable(0);")); v__gen__c__Gen_writeln(g, _SLIT("\tGC_INIT();")); if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr || g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr_opt) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_enable_incremental();")); @@ -76848,7 +77113,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { for (int tnumber = 0; tnumber < all_tfuncs.len; ++tnumber) { string tname = ((string*)all_tfuncs.data)[tnumber]; string tcname = v__util__no_dots(tname); - v__ast__Fn testfn = (*(v__ast__Fn*)map_get(ADDR(map, g->table->fns), &(string[]){tname}, &(v__ast__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,.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,} })); + v__ast__Fn testfn = (*(v__ast__Fn*)map_get(ADDR(map, g->table->fns), &(string[]){tname}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })); int lnum = testfn.pos.line_nr + 1; v__gen__c__Gen_writeln(g, _SLIT("\tmain__VTestFnMetaInfo_free(test_runner.fn_test_info);")); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tstring tcname_"), /*100 &int*/0xfe07, {.d_i32 = tnumber}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = tcname}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); @@ -78076,6 +78341,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl no if (node.should_be_skipped) { return; } + if (node.is_test) { + array_push((array*)&g->test_function_names, _MOV((string[]){ string_clone(node.name) })); + } if (node.ninstances == 0 && node.generic_names.len > 0) { #if defined(CUSTOM_DEFINE_trace_generics) { @@ -78335,10 +78603,10 @@ int ctmp; v__gen__c__Gen_write(g, fn_header); } int arg_start_pos = g->out.len; - multi_return_Array_string_Array_string_Array_bool mr_8604 = v__gen__c__Gen_fn_decl_params(g, node->params, node->scope, node->is_variadic); - Array_string fargs = mr_8604.arg0; - Array_string fargtypes = mr_8604.arg1; - Array_bool heap_promoted = mr_8604.arg2; + multi_return_Array_string_Array_string_Array_bool mr_8663 = v__gen__c__Gen_fn_decl_params(g, node->params, node->scope, node->is_variadic); + Array_string fargs = mr_8663.arg0; + Array_string fargtypes = mr_8663.arg1; + Array_bool heap_promoted = mr_8663.arg2; if (is_closure) { g->nr_closures++; } @@ -78569,7 +78837,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF return; } string ctx_struct = v__gen__c__closure_ctx(node->decl); - v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup_uncollectable(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); g->indent++; for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { v__ast__Param var = ((v__ast__Param*)node->inherited_vars.data)[_t1]; @@ -79446,11 +79714,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_39946 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39946.arg0; - string pafile = mr_39946.arg1; - string pamod = mr_39946.arg2; - string pafn = mr_39946.arg3; + multi_return_int_string_string_string mr_40019 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_40019.arg0; + string pafile = mr_40019.arg1; + string pamod = mr_40019.arg2; + string pafn = mr_40019.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(")")); @@ -82389,7 +82657,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\topt_ok2(&res, ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("*)&ret, sizeof(res));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&dec, _SLIT("\treturn ret;\n}")); strings__Builder_writeln(&enc, _SLIT("\treturn o;\n}")); - strings__Builder_writeln(&g->definitions, strings__Builder_str(&dec)); + strings__Builder_writeln(&g->gowrappers, strings__Builder_str(&dec)); strings__Builder_writeln(&g->gowrappers, strings__Builder_str(&enc)); } } @@ -82758,11 +83026,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_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; + multi_return_string_string_string_string mr_20159 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20159.arg0; + string key_eq_fn = mr_20159.arg1; + string clone_fn = mr_20159.arg2; + string free_fn = mr_20159.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)) { @@ -87245,7 +87513,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } else if (lx._typ == 290 /* v.ast.SelectorExpr */) { if (op == v__token__Kind__decl_assign) { - v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("struct fields can only be declared during the initialization"), (*lx._v__ast__SelectorExpr).pos)))); + v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("use assignment `=` instead of declaration `:=` when modifying struct fields"), pos)))); return _t7; } } @@ -87929,7 +88197,7 @@ bool inside_array_lit; } else if (string__eq(p->tok.lit, _SLIT("map")) && p->peek_tok.kind == v__token__Kind__lcbr && !(p->builtin_mod && (string__eq(p->file_base, _SLIT("map.v")) || string__eq(p->file_base, _SLIT("map_d_gcboehm_opt.v"))))) { v__parser__Parser_error_with_pos(p, _SLIT("deprecated map syntax, use syntax like `{'age': 20}`"), v__token__Token_pos(&p->tok)); } else { - if (p->inside_if && v__parser__Parser_is_generic_name(p) && p->peek_tok.kind != v__token__Kind__dot) { + if (p->inside_comptime_if && v__parser__Parser_is_generic_name(p) && p->peek_tok.kind != v__token__Kind__dot) { p->expecting_type = true; } node = v__parser__Parser_name_expr(p); @@ -88437,7 +88705,11 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((node)._typ == 273 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); } - 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},})))); + bool is_c2v_prefix = p->peek_tok.kind == v__token__Kind__dollar; + 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),.is_c2v_prefix = is_c2v_prefix,.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); + if (is_c2v_prefix) { + v__parser__Parser_next(p); + } v__parser__Parser_next(p); } else { v__ast__Expr _t5 = node; @@ -89003,6 +89275,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ .params = params, .generic_names = generic_names, + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = p->mod, .file = p->file_name, @@ -89063,6 +89336,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Table_register_fn(p->table, ((v__ast__Fn){ .params = params, .generic_names = generic_names, + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = p->mod, .file = p->file_name, @@ -89326,7 +89600,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected "), /*115 &v.token.Token*/0xfe10, {.d_s = v__token__Token_str(p->tok)}}, {_SLIT(" after anonymous function signature, expecting `{`"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); } Array_string label_names = __new_array_with_default(0, 0, sizeof(string), 0); - v__ast__Fn func = ((v__ast__Fn){.params = args,.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 = return_type,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = is_variadic,.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 = false,.no_body = 0,.is_conditional = 0,}); + v__ast__Fn func = ((v__ast__Fn){.params = args,.generic_names = __new_array(0, 0, sizeof(string)),.dep_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 = return_type,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = is_variadic,.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 = false,.no_body = 0,.is_conditional = 0,}); string name = str_intp(4, _MOV((StrIntpData[]){{_SLIT("anon_fn_"), /*115 &string*/0xfe10, {.d_s = p->unique_prefix}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_fn_type_signature(p->table, (voidptr)&/*qq*/func)}}, {_SLIT("_"), /*100 &int*/0xfe07, {.d_i32 = p->tok.pos}}, {_SLIT0, 0, { .d_c = 0 }}})); string keep_fn_name = p->cur_fn_name; p->cur_fn_name = name; @@ -89342,7 +89616,19 @@ bool v__parser__Parser_anon_fn_defer_0 = false; int idx = v__ast__Table_find_or_register_fn_type(p->table, p->mod, func, true, 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){ + if (inherited_vars.len > 0 && args.len > 0) { + for (int _t3 = 0; _t3 < args.len; ++_t3) { + v__ast__Param arg = ((v__ast__Param*)args.data)[_t3]; + for (int _t4 = 0; _t4 < inherited_vars.len; ++_t4) { + v__ast__Param var = ((v__ast__Param*)inherited_vars.data)[_t4]; + if (string__eq(arg.name, var.name)) { + v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the parameter name `"), /*115 &string*/0xfe10, {.d_s = arg.name}}, {_SLIT("` conflicts with the captured value name"), 0, { .d_c = 0 }}})), arg.pos); + break; + } + } + } + } + v__ast__AnonFn _t5 = ((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)), @@ -89399,7 +89685,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_close_scope(p); } // Defer end - return _t3; + return _t5; } VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_args(v__parser__Parser* p) { @@ -89887,6 +90173,9 @@ bool was_inside_ct_if_expr; for (;;) { if (!((p->tok.kind == v__token__Kind__key_if || p->tok.kind == v__token__Kind__key_else))) break; p->inside_if = true; + if (is_comptime) { + p->inside_comptime_if = true; + } v__token__Pos start_pos = (is_comptime ? (v__token__Pos_extend(v__token__Token_pos(&p->prev_tok), v__token__Token_pos(&p->tok))) : (v__token__Token_pos(&p->tok))); if (p->tok.kind == v__token__Kind__key_else) { _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t1, Array_v__ast__Comment); @@ -89906,6 +90195,7 @@ bool was_inside_ct_if_expr; if (p->tok.kind == v__token__Kind__lcbr) { has_else = true; p->inside_if = false; + p->inside_comptime_if = false; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); v__token__Pos body_pos = v__token__Token_pos(&p->tok); v__parser__Parser_open_scope(p); @@ -89988,6 +90278,7 @@ bool was_inside_ct_if_expr; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); v__token__Pos body_pos = v__token__Token_pos(&p->tok); p->inside_if = false; + p->inside_comptime_if = false; v__parser__Parser_open_scope(p); Array_v__ast__Stmt stmts = v__parser__Parser_parse_block_no_scope(p, false); array_push((array*)&branches, _MOV((v__ast__IfBranch[]){ ((v__ast__IfBranch){ @@ -90222,9 +90513,9 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars } p->inside_match = true; p->inside_select = true; - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_9380 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_9380.arg0; - Array_v__ast__Comment comments = mr_9380.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_9498 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_9498.arg0; + Array_v__ast__Comment comments = mr_9498.arg1; if (exprs.len != 1) { v__parser__Parser_error(p, _SLIT("only one expression allowed as `select` key")); v__ast__SelectExpr _t3 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); @@ -90765,6 +91056,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) v__ast__Fn func = ((v__ast__Fn){ .params = args, .generic_names = __new_array(0, 0, sizeof(string)), + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = (string){.str=(byteptr)"", .is_lit=1}, .file = (string){.str=(byteptr)"", .is_lit=1}, @@ -90840,7 +91132,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) { array_push((array*)&_t1, &ti); } Array_string variant_names =_t1; - qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_14364895672131222426_string); + qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_16311103228414776939_string); string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}})); Array_v__ast__Type _t3 = {0}; Array_v__ast__TypeNode _t3_orig = variants; @@ -91268,7 +91560,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)),.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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 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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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_comptime_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; @@ -91329,6 +91621,7 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -91420,6 +91713,7 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -91573,6 +91867,7 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -91674,6 +91969,7 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -93386,9 +93682,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_49074 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_49074.arg0; - Array_v__ast__Comment left_comments = mr_49074.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_49106 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_49106.arg0; + Array_v__ast__Comment left_comments = mr_49106.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); } @@ -93401,7 +93697,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse if ((p->tok.kind == v__token__Kind__assign || p->tok.kind == v__token__Kind__decl_assign) || v__token__Kind_is_assign(p->tok.kind)) { v__ast__Stmt _t3 = v__parser__Parser_partial_assign_stmt(p, left, left_comments); return _t3; - } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { + } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !p->pref->is_vet && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr node = ((v__ast__Expr*)left.data)[_t4]; if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 256 /* v.ast.CallExpr */ && (node)._typ != 286 /* v.ast.PostfixExpr */ && (node)._typ != 261 /* v.ast.ComptimeCall */ && (node)._typ != 290 /* v.ast.SelectorExpr */ && (node)._typ != 265 /* v.ast.DumpExpr */) { @@ -93796,7 +94092,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) || (p->inside_match_case && p->tok.kind == v__token__Kind__name && p->peek_tok.pos - p->tok.pos == p->tok.len))) { + } else if (p->peek_tok.kind == v__token__Kind__lcbr && ((p->inside_if && lit0_is_capital && p->tok.lit.len > 1 && !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)) { @@ -94674,9 +94970,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_86019 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_86019.arg0; - Array_v__ast__Comment comments2 = mr_86019.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_86090 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_86090.arg0; + Array_v__ast__Comment comments2 = mr_86090.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)),}); @@ -94946,8 +95242,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_92515 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_92515.arg0; + multi_return_Array_v__ast__Type_Array_string mr_92586 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_92586.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); @@ -96267,6 +96563,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__Fn tmethod = ((v__ast__Fn){ .params = args, .generic_names = __new_array(0, 0, sizeof(string)), + .dep_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}, @@ -97407,7 +97704,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_post_process_c_compiler_output(v__build } return; } - if (res.exit_code != 0 && v->pref->gc_mode != v__pref__GarbageCollectionMode__no_gc && string_contains(res.output, _SLIT("libgc.a"))) { + if (res.exit_code != 0 && v->pref->gc_mode != v__pref__GarbageCollectionMode__no_gc && string_contains(res.output, _SLIT("libgc.a")) && !v->pref->is_o) { #if defined(_WIN32) { v__builder__verror(_SLIT("Your V installation may be out-of-date. Try removing `thirdparty\\tcc\\` and running `.\\make.bat`")); @@ -97556,6 +97853,9 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui if (v->pref->sanitize) { array_push((array*)&ccoptions.args, _MOV((string[]){ string_clone(_SLIT("-fsanitize=leak")) })); } + if (v->pref->is_o) { + array_push((array*)&ccoptions.args, _MOV((string[]){ string_clone(_SLIT("-c")) })); + } ccoptions.shared_postfix = _SLIT(".so"); #if defined(__APPLE__) { @@ -97632,15 +97932,15 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui Array_v__cflag__CFlag cflags = v__builder__Builder_get_os_cflags(v); if (v->pref->build_mode != v__pref__BuildMode__build_module) { Array_string only_o_files = Array_v__cflag__CFlag_c_options_only_object_files(cflags); - _PUSH_MANY(&ccoptions.o_args, (only_o_files), _t40, Array_string); + _PUSH_MANY(&ccoptions.o_args, (only_o_files), _t41, Array_string); } - multi_return_Array_string_Array_string_Array_string mr_12063 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_12063.arg0; - Array_string others = mr_12063.arg1; - Array_string libs = mr_12063.arg2; - _PUSH_MANY(&ccoptions.pre_args, (defines), _t41, Array_string); - _PUSH_MANY(&ccoptions.pre_args, (others), _t42, Array_string); - _PUSH_MANY(&ccoptions.linker_flags, (libs), _t43, Array_string); + multi_return_Array_string_Array_string_Array_string mr_12127 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_12127.arg0; + Array_string others = mr_12127.arg1; + Array_string libs = mr_12127.arg2; + _PUSH_MANY(&ccoptions.pre_args, (defines), _t42, Array_string); + _PUSH_MANY(&ccoptions.pre_args, (others), _t43, Array_string); + _PUSH_MANY(&ccoptions.linker_flags, (libs), _t44, Array_string); if (v->pref->use_cache && v->pref->build_mode != v__pref__BuildMode__build_module) { if (!ccoptions.is_cc_tcc) { #if defined(__linux__) @@ -97828,7 +98128,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) { v__builder__Builder_build_thirdparty_obj_files(v); v__builder__Builder_setup_output_name(v); if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) { - string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); + string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); if (!os__exists(cpp_atomic_h_path)) { for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) { v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4]; @@ -97848,7 +98148,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) { eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> creating "), /*115 &string*/0xfe10, {.d_s = cpp_atomic_h_path}}, {_SLIT(" ..."), 0, { .d_c = 0 }}}))); } #endif - string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); + string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}}))); break; } @@ -98041,10 +98341,10 @@ VV_LOCAL_SYMBOL void v__builder__Builder_cc_linux_cross(v__builder__Builder* b) v__builder__Builder_ensure_linuxroot_exists(b, sysroot); string obj_file = string__plus(b->out_name_c, _SLIT(".o")); Array_v__cflag__CFlag cflags = v__builder__Builder_get_os_cflags(b); - multi_return_Array_string_Array_string_Array_string mr_23306 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_23306.arg0; - Array_string others = mr_23306.arg1; - Array_string libs = mr_23306.arg2; + multi_return_Array_string_Array_string_Array_string mr_23370 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_23370.arg0; + Array_string others = mr_23370.arg1; + Array_string libs = mr_23370.arg2; Array_string cc_args = __new_array_with_default(0, 0, sizeof(string), 0); array_push((array*)&cc_args, _MOV((string[]){ string_clone(_SLIT("-w")) })); array_push((array*)&cc_args, _MOV((string[]){ string_clone(_SLIT("-fPIC")) })); @@ -99662,7 +99962,7 @@ bool v__builder__Builder_should_rebuild(v__builder__Builder* b) { } 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); + qsort(v_program_files.data, v_program_files.len, v_program_files.element_size, (int (*)(const void *, const void *))&compare_7770354126342877024_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); @@ -99980,8 +100280,8 @@ v__util__Timers* timers; VUNREACHABLE(); } else if (string__eq(command, _SLIT("translate"))) { - eprintln(_SLIT("Translating C to V will be available in V 0.3")); - _v_exit(1); + Array_string _t10; + v__util__launch_tool(prefs->is_verbose, _SLIT("translate"), (_t10 = _const_os__args, array_slice(_t10, 1, _t10.len))); VUNREACHABLE(); } else { @@ -100160,10 +100460,9 @@ void _vinit(int ___argc, voidptr ___argv) { builtin_init(); - vinit_string_literals(); - { // Initializations for module strings : - } - { // Initializations for module math.bits : + // Initializations for module math.bits + _const_math__bits__overflow_error = _SLIT("Overflow Error"); + _const_math__bits__divide_error = _SLIT("Divide Error"); _const_math__bits__de_bruijn32tab = new_array_from_c_array(32, 32, sizeof(u8), _MOV((u8[32]){ ((u8)(0)), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, @@ -100310,8 +100609,9 @@ void _vinit(int ___argc, voidptr ___argv) { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08})); - } - { // Initializations for module strconv : + // Initializations for module strconv + _const_strconv__digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); + _const_strconv__base_digits = _SLIT("0123456789abcdefghijklmnopqrstuvwxyz"); _const_strconv__pos_exp = new_array_from_c_array(309, 309, sizeof(u64), _MOV((u64[309]){ ((u64)(0x3ff0000000000000U)), ((u64)(0x4024000000000000U)), ((u64)(0x4059000000000000U)), ((u64)(0x408f400000000000U)), ((u64)(0x40c3880000000000U)), ((u64)(0x40f86a0000000000U)), ((u64)(0x412e848000000000U)), ((u64)(0x416312d000000000U)), ((u64)(0x4197d78400000000U)), ((u64)(0x41cdcd6500000000U)), ((u64)(0x4202a05f20000000U)), ((u64)(0x42374876e8000000U)), ((u64)(0x426d1a94a2000000U)), ((u64)(0x42a2309ce5400000U)), ((u64)(0x42d6bcc41e900000U)), ((u64)(0x430c6bf526340000U)), ((u64)(0x4341c37937e08000U)), @@ -100501,16 +100801,14 @@ void _vinit(int ___argc, voidptr ___argv) { ((strconv__Uint128){.lo = ((u64)(0x4920a0d7a999ac96U)),.hi = ((u64)(0x0229f4fbbdfc73f1U)),}), ((strconv__Uint128){.lo = ((u64)(0x750101590f5c4757U)),.hi = ((u64)(0x037654c5fcc71fe8U)),}), ((strconv__Uint128){.lo = ((u64)(0x2a6734473f7d05dfU)),.hi = ((u64)(0x02c5109e63d27fedU)),}), ((strconv__Uint128){.lo = ((u64)(0xeeb8f69f65fd9e4cU)),.hi = ((u64)(0x0237407eb641fff0U)),}), ((strconv__Uint128){.lo = ((u64)(0xe45b24323cc8fd46U)),.hi = ((u64)(0x038b9a6456cfffe7U)),}), ((strconv__Uint128){.lo = ((u64)(0xb6af502830a0ca9fU)),.hi = ((u64)(0x02d6151d123fffecU)),}), ((strconv__Uint128){.lo = ((u64)(0xf88c402026e7087fU)),.hi = ((u64)(0x0244ddb0db666656U)),}), ((strconv__Uint128){.lo = ((u64)(0x2746cd003e3e73feU)),.hi = ((u64)(0x03a162b4923d708bU)),}), ((strconv__Uint128){.lo = ((u64)(0x1f6bd73364fec332U)),.hi = ((u64)(0x02e7822a0e978d3cU)),}), ((strconv__Uint128){.lo = ((u64)(0xe5efdf5c50cbcf5bU)),.hi = ((u64)(0x0252ce880bac70fcU)),}), ((strconv__Uint128){.lo = ((u64)(0x3cb2fefa1adfb22bU)),.hi = ((u64)(0x03b7b0d9ac471b2eU)),}), ((strconv__Uint128){.lo = ((u64)(0x308f3261af195b56U)),.hi = ((u64)(0x02f95a47bd05af58U)),}), ((strconv__Uint128){.lo = ((u64)(0x5a0c284e25ade2abU)),.hi = ((u64)(0x0261150630d15913U)),}), ((strconv__Uint128){.lo = ((u64)(0x29ad0d49d5e30445U)),.hi = ((u64)(0x03ce8809e7b55b52U)),}), ((strconv__Uint128){.lo = ((u64)(0x548a7107de4f369dU)),.hi = ((u64)(0x030ba007ec9115dbU)),}), ((strconv__Uint128){.lo = ((u64)(0xdd3b8d9fe50c2bb1U)),.hi = ((u64)(0x026fb3398a0dab15U)),}), ((strconv__Uint128){.lo = ((u64)(0x952c15cca1ad12b5U)),.hi = ((u64)(0x03e5eb8f434911bcU)),}), ((strconv__Uint128){.lo = ((u64)(0x775677d6e7bda891U)),.hi = ((u64)(0x031e560c35d40e30U)),}), ((strconv__Uint128){.lo = ((u64)(0xc5dec645863153a7U)),.hi = ((u64)(0x027eab3cf7dcd826U)),})})); - } - { // Initializations for module builtin : + // Initializations for module builtin + _const_digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); + _const_si_s_code = _SLIT("0xfe10"); + _const_si_g32_code = _SLIT("0xfe0e"); + _const_si_g64_code = _SLIT("0xfe0f"); _const_none__ = /*&IError*/I_None___to_Interface_IError(((None__*)memdup(&(None__){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(None__)))); _const_children_bytes = sizeof(voidptr) * (_const_max_len + 1); - } - { // Initializations for module strings.textscanner : - } - { // Initializations for module os.cmdline : - } - { // Initializations for module v.token : + // Initializations for module v.token _const_v__token__assign_tokens = new_array_from_c_array(12, 12, sizeof(v__token__Kind), _MOV((v__token__Kind[12]){ v__token__Kind__assign, v__token__Kind__plus_assign, v__token__Kind__minus_assign, v__token__Kind__mult_assign, v__token__Kind__div_assign, v__token__Kind__xor_assign, v__token__Kind__mod_assign, v__token__Kind__or_assign, v__token__Kind__and_assign, v__token__Kind__right_shift_assign, v__token__Kind__left_shift_assign, v__token__Kind__unsigned_right_shift_assign})); @@ -100519,12 +100817,11 @@ void _vinit(int ___argc, voidptr ___argv) { _SLIT("@LINE"), _SLIT("@COLUMN"), _SLIT("@VHASH"), _SLIT("@VMOD_FILE")})); _const_v__token__token_str = v__token__build_token_str(); _const_v__token__keywords = v__token__build_keys(); - _const_v__token__matcher = v__token__new_keywords_matcher_T_v__token__Kind(_const_v__token__keywords); _const_v__token__precedences = v__token__build_precedences(); - } - { // Initializations for module v.mathutil : - } - { // Initializations for module time : + _const_v__token__matcher = v__token__new_keywords_matcher_T_v__token__Kind(_const_v__token__keywords); + // Initializations for module time + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), _SLIT("HH"), _SLIT("ZZ"), _SLIT("dd"), _SLIT("Qo"), _SLIT("QQ"), _SLIT("wo"), _SLIT("ww")})); @@ -100542,92 +100839,69 @@ void _vinit(int ___argc, voidptr ___argv) { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365})); _const_time__nanosecond = ((time__Duration)(1)); + _const_time__infinite = ((((i64)(9223372036854775807)))); _const_time__microsecond = ((1000 * _const_time__nanosecond)); _const_time__millisecond = ((1000 * _const_time__microsecond)); _const_time__second = ((1000 * _const_time__millisecond)); _const_time__minute = ((60 * _const_time__second)); _const_time__hour = ((60 * _const_time__minute)); - _const_time__infinite = ((((i64)(9223372036854775807)))); - } - { // Initializations for module v.dotgraph : - } - { // Initializations for module hash : - } - { // Initializations for module rand.constants : + // Initializations for module rand.constants _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; - } - { // Initializations for module hash.fnv1a : - } - { // Initializations for module rand.buffer : - } - { // Initializations for module flag : - } - { // Initializations for module semver : + // Initializations for module flag + _const_flag__space = _SLIT(" "); + _const_flag__underline = _SLIT("-----------------------------------------------"); + // Initializations for module semver + _const_semver__comparator_sep = _SLIT(" "); + _const_semver__comparator_set_sep = _SLIT(" || "); + _const_semver__hyphen_range_sep = _SLIT(" - "); + _const_semver__x_range_symbols = _SLIT("Xx*"); _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); - } - { // Initializations for module sync.stdatomic : - } - { // Initializations for module sync.threads : - } - { // Initializations for module os : + // Initializations for module os + _const_os__fslash_str = _SLIT("/"); + _const_os__dot_dot = _SLIT(".."); + _const_os__empty_str = _SLIT(""); + _const_os__dot_str = _SLIT("."); + _const_os__path_separator = _SLIT("/"); + _const_os__path_delimiter = _SLIT(":"); _const_os__args = os__init_os_args(___argc, (byte**)___argv); _const_os__wd_at_startup = os__getwd(); - } - { // Initializations for module v.errors : - } - { // Initializations for module v.depgraph : - } - { // Initializations for module v.vet : - } - { // Initializations for module rand.seed : - } - { // Initializations for module term : - } - { // Initializations for module v.util.version : - } - { // Initializations for module v.vcache : - } - { // Initializations for module v.util.diff : - } - { // Initializations for module v.vmod : + // Initializations for module v.util.version + _const_v__util__version__v_version = _SLIT("0.2.4"); + // Initializations for module v.vmod + _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); - } - { // Initializations for module v.util.recompilation : - } - { // Initializations for module v.cflag : - } - { // Initializations for module rand.config : - } - { // Initializations for module rand.wyrand : - } - { // Initializations for module v.pkgconfig : + // Initializations for module v.cflag + _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); + // Initializations for module v.pkgconfig + _const_v__pkgconfig__version = _SLIT("0.3.2"); _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), _SLIT("/opt/homebrew/lib/pkgconfig"), _SLIT("/usr/local/libdata/pkgconfig")})); - } - { // Initializations for module runtime : - } - { // Initializations for module rand : + // Initializations for module rand + _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); + _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + _const_rand__hex_chars = _SLIT("abcdef0123456789"); + _const_rand__ascii_chars = _SLIT("!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~"); _const_rand__clock_seq_hi_and_reserved_valid_values = new_array_from_c_array(4, 4, sizeof(rune), _MOV((rune[4]){'8', '9', 'a', 'b'})); default_rng = *(rand__PRNG**)&((rand__PRNG*[]){0}[0]); // global rand__init(); - } - { // Initializations for module v.pref : - _const_v__pref__default_module_path = os__vmodules_dir(); + // Initializations for module v.pref _const_v__pref__list_of_flags_with_param = new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ _SLIT("o"), _SLIT("d"), _SLIT("define"), _SLIT("b"), _SLIT("backend"), _SLIT("cc"), _SLIT("os"), _SLIT("target-os"), _SLIT("cf"), _SLIT("cflags"), _SLIT("path"), _SLIT("arch")})); - } - { // Initializations for module sync : - } - { // Initializations for module help : - } - { // Initializations for module v.util : + _const_v__pref__default_module_path = os__vmodules_dir(); + // Initializations for module help + _const_help__unknown_topic = _SLIT("`v help`: unknown help topic provided. Use `v help` for usage information."); + // Initializations for module v.util + _const_v__util__double_escape = _SLIT("\\\\"); + _const_v__util__map_prefix = _SLIT("map[string]"); _const_v__util__emanager = v__util__new_error_manager(); _const_v__util__normalised_workdir = string__plus(string_replace(_const_os__wd_at_startup, _SLIT("\\"), _SLIT("/")), _SLIT("/")); + 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 _const_v__util__invalid_escapes = string_bytes(_SLIT("({$`.")); + g_timers = v__util__new_timers(((v__util__TimerParams){.should_print = false,.label = _SLIT("g_timers"),})); // 3global _const_v__util__builtin_module_parts = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("math.bits"), _SLIT("strconv"), _SLIT("dlmalloc"), _SLIT("strconv.ftoa"), _SLIT("strings"), _SLIT("builtin")})); _const_v__util__bundle_modules = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("clipboard"), _SLIT("fontstash"), _SLIT("gg"), _SLIT("gx"), _SLIT("sokol"), _SLIT("szip"), _SLIT("ui")})); _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), @@ -100643,13 +100917,9 @@ 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")})); - 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 - } - { // Initializations for module sync.pool : + // Initializations for module sync.pool _const_sync__pool__no_result = ((voidptr)(0)); - } - { // Initializations for module v.ast : + // Initializations for module v.ast _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), _MOV((int[4]){ 8, @@ -100806,6 +101076,13 @@ void _vinit(int ___argc, voidptr ___argv) { ; _const_v__ast__native_builtins = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("assert"), _SLIT("print"), _SLIT("eprint"), _SLIT("println"), _SLIT("eprintln"), _SLIT("exit"), _SLIT("C.syscall")})); + _const_v__ast__builtin_type_names = new_array_from_c_array(30, 30, sizeof(string), _MOV((string[30]){ + _SLIT("void"), _SLIT("voidptr"), _SLIT("byteptr"), _SLIT("charptr"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("isize"), + _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("usize"), _SLIT("f32"), _SLIT("f64"), _SLIT("char"), + _SLIT("bool"), _SLIT("none"), _SLIT("string"), _SLIT("rune"), _SLIT("array"), _SLIT("map"), _SLIT("chan"), _SLIT("any"), + _SLIT("float_literal"), _SLIT("int_literal"), _SLIT("thread"), _SLIT("Error"), _SLIT("u8")})); + _const_v__ast__ovoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__optional); + _const_v__ast__rvoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__result); _const_v__ast__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0}, .name = _SLIT("InvalidType"), @@ -100819,11 +101096,6 @@ void _vinit(int ___argc, voidptr ___argv) { .language = v__ast__Language__v, .is_pub = 0, }, sizeof(v__ast__TypeSymbol))); - _const_v__ast__builtin_type_names = new_array_from_c_array(30, 30, sizeof(string), _MOV((string[30]){ - _SLIT("void"), _SLIT("voidptr"), _SLIT("byteptr"), _SLIT("charptr"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("isize"), - _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("usize"), _SLIT("f32"), _SLIT("f64"), _SLIT("char"), - _SLIT("bool"), _SLIT("none"), _SLIT("string"), _SLIT("rune"), _SLIT("array"), _SLIT("map"), _SLIT("chan"), _SLIT("any"), - _SLIT("float_literal"), _SLIT("int_literal"), _SLIT("thread"), _SLIT("Error"), _SLIT("u8")})); _const_v__ast__builtin_type_names_matcher = v__ast__build_builtin_type_names_matcher(); _const_v__ast__integer_type_idxs = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ _const_v__ast__i8_type_idx, _const_v__ast__i16_type_idx, _const_v__ast__int_type_idx, _const_v__ast__i64_type_idx, _const_v__ast__byte_type_idx, _const_v__ast__u16_type_idx, _const_v__ast__u32_type_idx, _const_v__ast__u64_type_idx, _const_v__ast__isize_type_idx, @@ -100838,8 +101110,6 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__pointer_type_idxs = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_v__ast__voidptr_type_idx, _const_v__ast__byteptr_type_idx, _const_v__ast__charptr_type_idx})); _const_v__ast__string_type_idxs = new_array_from_c_array(1, 1, sizeof(int), _MOV((int[1]){_const_v__ast__string_type_idx})); _const_v__ast__void_type = v__ast__new_type(_const_v__ast__void_type_idx); - _const_v__ast__ovoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__optional); - _const_v__ast__rvoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__result); _const_v__ast__voidptr_type = v__ast__new_type(_const_v__ast__voidptr_type_idx); _const_v__ast__byteptr_type = v__ast__new_type(_const_v__ast__byteptr_type_idx); _const_v__ast__charptr_type = v__ast__new_type(_const_v__ast__charptr_type_idx); @@ -100868,12 +101138,13 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__int_literal_type = v__ast__new_type(_const_v__ast__int_literal_type_idx); _const_v__ast__thread_type = v__ast__new_type(_const_v__ast__thread_type_idx); _const_v__ast__error_type = v__ast__new_type(_const_v__ast__error_type_idx); - _const_v__ast__charptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__charptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__char_type_idx), 1)})); - _const_v__ast__byteptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__byteptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__byte_type_idx), 1)})); - _const_v__ast__voidptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__voidptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__voidptr_type_idx), 1)})); + _const_v__ast__charptr_types = v__ast__new_charptr_types(); + _const_v__ast__byteptr_types = v__ast__new_byteptr_types(); + _const_v__ast__voidptr_types = v__ast__new_voidptr_types(); _const_v__ast__cptr_types = v__ast__merge_types(new_array_from_c_array(3, 3, sizeof(Array_v__ast__Type), _MOV((Array_v__ast__Type[3]){_const_v__ast__voidptr_types, _const_v__ast__byteptr_types, _const_v__ast__charptr_types}))); - } - { // Initializations for module v.checker : + // Initializations for module v.checker + _const_v__checker__vroot_is_deprecated_message = _SLIT("@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead"); + _const_v__checker__unicode_lit_overflow_message = _SLIT("unicode character exceeds max allowed value of 0x10ffff, consider using a unicode literal (\\u####)"); _const_v__checker__int_min = ((int)(0x80000000)); _const_v__checker__valid_comptime_if_os = new_array_from_c_array(19, 19, sizeof(string), _MOV((string[19]){ _SLIT("windows"), _SLIT("ios"), _SLIT("macos"), _SLIT("mach"), _SLIT("darwin"), _SLIT("hpux"), _SLIT("gnu"), _SLIT("qnx"), _SLIT("linux"), @@ -100886,19 +101157,30 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__checker__valid_comptime_if_other = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("apk"), _SLIT("js"), _SLIT("debug"), _SLIT("prod"), _SLIT("test"), _SLIT("glibc"), _SLIT("prealloc"), _SLIT("no_bounds_checking"), _SLIT("freestanding"), _SLIT("threads"), _SLIT("js_node"), _SLIT("js_browser"), _SLIT("js_freestanding"), _SLIT("interpreter"), _SLIT("es5"), _SLIT("profile")})); - _const_v__checker__valid_comptime_not_user_defined = v__checker__all_valid_comptime_idents(); _const_v__checker__array_builtin_methods = new_array_from_c_array(15, 15, sizeof(string), _MOV((string[15]){ _SLIT("filter"), _SLIT("clone"), _SLIT("repeat"), _SLIT("reverse"), _SLIT("map"), _SLIT("slice"), _SLIT("sort"), _SLIT("contains"), _SLIT("index"), _SLIT("wait"), _SLIT("any"), _SLIT("all"), _SLIT("first"), _SLIT("last"), _SLIT("pop")})); _const_v__checker__reserved_type_names = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("byte"), _SLIT("bool"), _SLIT("char"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("f32"), _SLIT("f64"), _SLIT("map"), _SLIT("string"), _SLIT("rune")})); - } - { // Initializations for module v.transformer : - } - { // Initializations for module v.markused : - } - { // Initializations for module v.gen.c : + _const_v__checker__valid_comptime_not_user_defined = v__checker__all_valid_comptime_idents(); + // Initializations for module v.gen.c + _const_v__gen__c__si_s_code = _SLIT("0xfe10"); + _const_v__gen__c__result_name = _SLIT("_result"); + _const_v__gen__c__option_name = _SLIT("_option"); + _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); + _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); + _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); + _const_v__gen__c__c_common_macros = _SLIT("\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\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n\011#define __V_arm32 1\n\011#undef __V_architecture\n\011#define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n\011#define __V_x86 1\n\011#undef __V_architecture\n\011#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\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#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\011#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\011#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\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#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\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n\011#if defined(__MINGW32__) || defined(__MINGW64__)\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); + _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\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"); + _const_v__gen__c__c_helper_macros = _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"); + _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_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\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__c_wyhash_headers = _SLIT("\n// ============== wyhash ==============\n#ifndef wyhash_final_version_3\n#define wyhash_final_version_3\n\n#ifndef WYHASH_CONDOM\n// protections that produce different results:\n// 1: normal valid behavior\n// 2: extra protection against entropy loss (probability=2^-63), aka. \"blind multiplication\"\n#define WYHASH_CONDOM 1\n#endif\n\n#ifndef WYHASH_32BIT_MUM\n// 0: normal version, slow on 32 bit systems\n// 1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function\n#define WYHASH_32BIT_MUM 0\n#endif\n\n// includes\n#include \n#if defined(_MSC_VER) && defined(_M_X64)\n\011#include \n\011#pragma intrinsic(_umul128)\n#endif\n\n// 128bit multiply function\nstatic inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); }\nstatic inline void _wymum(uint64_t *A, uint64_t *B){\n#if(WYHASH_32BIT_MUM)\n\011uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll;\n\011#else\n\011*A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll;\n\011#endif\n#elif defined(__SIZEOF_INT128__) && !defined(VWASM)\n\011__uint128_t r=*A; r*=*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=(uint64_t)r; *B^=(uint64_t)(r>>64);\n\011#else\n\011*A=(uint64_t)r; *B=(uint64_t)(r>>64);\n\011#endif\n#elif defined(_MSC_VER) && defined(_M_X64)\n\011#if(WYHASH_CONDOM>1)\n\011uint64_t a, b;\n\011a=_umul128(*A,*B,&b);\n\011*A^=a; *B^=b;\n\011#else\n\011*A=_umul128(*A,*B,B);\n\011#endif\n#else\n\011uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo;\n\011uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t>32)+(rm1>>32)+c;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=lo; *B^=hi;\n\011#else\n\011*A=lo; *B=hi;\n\011#endif\n#endif\n}\n\n// multiply and xor mix function, aka MUM\nstatic inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; }\n\n// endian macros\n#ifndef WYHASH_LITTLE_ENDIAN\n\011#ifdef TARGET_ORDER_IS_LITTLE\n\011\011#define WYHASH_LITTLE_ENDIAN 1\n\011#else\n\011\011#define WYHASH_LITTLE_ENDIAN 0\n\011#endif\n#endif\n\n// read functions\n#if (WYHASH_LITTLE_ENDIAN)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;}\n#elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);}\n#elif defined(_MSC_VER)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);}\n#else\n\011static inline uint64_t _wyr8(const uint8_t *p) {\n\011\011uint64_t v; memcpy(&v, p, 8);\n\011\011return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000));\n\011}\n\011static inline uint64_t _wyr4(const uint8_t *p) {\n\011\011uint32_t v; memcpy(&v, p, 4);\n\011\011return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000));\n\011}\n#endif\nstatic inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];}\n// wyhash main function\nstatic inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){\n\011const uint8_t *p=(const uint8_t *)key; seed^=*secret;\011uint64_t a, b;\n\011if (_likely_(len<=16)) {\n\011\011if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); }\n\011\011else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; }\n\011\011else a=b=0;\n\011} else {\n\011\011size_t i=len;\n\011\011if (_unlikely_(i>48)) {\n\011\011\011uint64_t see1=seed, see2=seed;\n\011\011\011do {\n\011\011\011\011seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed);\n\011\011\011\011see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1);\n\011\011\011\011see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2);\n\011\011\011\011p+=48; i-=48;\n\011\011\011} while(_likely_(i>48));\n\011\011\011seed^=see1^see2;\n\011\011}\n\011\011while(_unlikely_(i>16)) { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; }\n\011\011a=_wyr8(p+i-16); b=_wyr8(p+i-8);\n\011}\n\011return _wymix(secret[1]^len,_wymix(a^secret[1],b^seed));\n}\n// the default secret parameters\nstatic const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};\n\n// a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand\nstatic inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642full; B^=0xe7037ed1a0b428dbull; _wymum(&A,&B); return _wymix(A^0xa0761d6478bd642full,B^0xe7037ed1a0b428dbull);}\n\n// the wyrand PRNG that pass BigCrush and PractRand\nstatic inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}\n\n#ifndef __vinix__\n// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;}\n\n// convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;}\n#endif\n\n#if(!WYHASH_32BIT_MUM)\n// fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; }\n#endif\n#endif\n\n#define _IN_MAP(val, m) map_exists(m, val)\n\n"); + _const_v__gen__c__closure_ctx = _SLIT("_V_closure_ctx"); + _const_v__gen__c__posix_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); + _const_v__gen__c__windows_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); _const_v__gen__c__unsupported_ctemp_assert_transform = I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(((v__gen__c__UnsupportedAssertCtempTransform*)memdup(&(v__gen__c__UnsupportedAssertCtempTransform){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(v__gen__c__UnsupportedAssertCtempTransform)))); _const_v__gen__c__c_reserved = new_array_from_c_array(60, 60, sizeof(string), _MOV((string[60]){ _SLIT("array"), _SLIT("auto"), _SLIT("bool"), _SLIT("break"), _SLIT("calloc"), _SLIT("case"), _SLIT("char"), _SLIT("class"), _SLIT("complex"), @@ -100909,39 +101191,29 @@ void _vinit(int ___argc, voidptr ___argv) { _SLIT("sizeof"), _SLIT("static"), _SLIT("string"), _SLIT("struct"), _SLIT("switch"), _SLIT("typedef"), _SLIT("typename"), _SLIT("union"), _SLIT("unix"), _SLIT("unsigned"), _SLIT("void"), _SLIT("volatile"), _SLIT("while"), _SLIT("template"), _SLIT("true"), _SLIT("small"), _SLIT("stdout"), _SLIT("stdin"), _SLIT("stderr")})); - _const_v__gen__c__c_reserved_map = v__gen__c__string_array_to_map(_const_v__gen__c__c_reserved); _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 #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")})); - } - { // Initializations for module v.scanner : - } - { // Initializations for module v.ast.walker : - } - { // Initializations for module v.parser : + _const_v__gen__c__c_reserved_map = v__gen__c__string_array_to_map(_const_v__gen__c__c_reserved); + _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)})); + // Initializations for module v.parser + _const_v__parser__tmpl_str_end = _SLIT("')\n"); _const_v__parser__supported_comptime_calls = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("html"), _SLIT("tmpl"), _SLIT("env"), _SLIT("embed_file"), _SLIT("pkgconfig"), _SLIT("compile_error"), _SLIT("compile_warn")})); _const_v__parser__comptime_types = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("Map"), _SLIT("Array"), _SLIT("Int"), _SLIT("Float"), _SLIT("Struct"), _SLIT("Interface"), _SLIT("Enum"), _SLIT("Sumtype")})); - _const_v__parser__valid_tokens_inside_types = new_array_from_c_array(7, 7, sizeof(v__token__Kind), _MOV((v__token__Kind[7]){v__token__Kind__lsbr, v__token__Kind__rsbr, v__token__Kind__name, v__token__Kind__dot, v__token__Kind__comma, v__token__Kind__key_fn, v__token__Kind__lt})); codegen_files = __new_array_with_default(0, 0, sizeof(v__ast__File*), 0); // 3global - } - { // Initializations for module v.callgraph : - } - { // Initializations for module v.builder : + _const_v__parser__valid_tokens_inside_types = new_array_from_c_array(7, 7, sizeof(v__token__Kind), _MOV((v__token__Kind[7]){v__token__Kind__lsbr, v__token__Kind__rsbr, v__token__Kind__name, v__token__Kind__dot, v__token__Kind__comma, v__token__Kind__key_fn, v__token__Kind__lt})); + // Initializations for module v.builder + _const_v__builder__c_verror_message_marker = _SLIT("VERROR_MESSAGE "); + _const_v__builder__c_error_info = _SLIT("\n==================\nC error. This should never happen.\n\nThis is a compiler bug, please report it using `v bug file.v`.\n\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use #help on Discord: https://discord.gg/vlang\n"); + _const_v__builder__no_compiler_error = _SLIT("\n==================\nError: no C compiler detected.\n\nYou can find instructions on how to install one in the V wiki:\nhttps://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows\n\nIf you think you have one installed, make sure it is in your PATH.\nIf you do have one in your PATH, please raise an issue on GitHub:\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use `v doctor`, to see what V knows about your current environment.\n\nYou can also seek #help on Discord: https://discord.gg/vlang\n"); _const_v__builder__hkey_local_machine = ((v__builder__RegKey)(0x80000002)); - } - { // Initializations for module v.builder.cbuilder : - } - { // Initializations for module main : + // Initializations for module main _const_main__external_tools = new_array_from_c_array(33, 33, sizeof(string), _MOV((string[33]){ _SLIT("ast"), _SLIT("bin2v"), _SLIT("bug"), _SLIT("build-examples"), _SLIT("build-tools"), _SLIT("build-vbinaries"), _SLIT("bump"), _SLIT("check-md"), _SLIT("complete"), _SLIT("compress"), _SLIT("doc"), _SLIT("doctor"), _SLIT("fmt"), _SLIT("gret"), _SLIT("missdoc"), _SLIT("repl"), _SLIT("self"), _SLIT("setup-freetype"), _SLIT("shader"), _SLIT("should-compile-all"), _SLIT("symlink"), _SLIT("scan"), _SLIT("test"), _SLIT("test-all"), _SLIT("test-cleancode"), _SLIT("test-fmt"), _SLIT("test-parser"), _SLIT("test-self"), _SLIT("tracev"), _SLIT("up"), _SLIT("vet"), _SLIT("wipe-cache"), _SLIT("watch")})); _const_main__list_of_flags_that_allow_duplicates = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("cc"), _SLIT("d"), _SLIT("define"), _SLIT("cf"), _SLIT("cflags")})); - } } void _vcleanup(void) { } diff --git a/v_win.c b/v_win.c index 1d9e40d..c925154 100644 --- a/v_win.c +++ b/v_win.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "398db2138" +#define V_COMMIT_HASH "460c2ee77" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "88d69dca7" + #define V_COMMIT_HASH "398db2138" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "398db21" + #define V_CURRENT_COMMIT_HASH "460c2ee" #endif #define V_USE_SIGNAL_H @@ -337,6 +337,7 @@ typedef struct v__markused__Walker v__markused__Walker; typedef struct v__gen__c__UnsupportedAssertCtempTransform v__gen__c__UnsupportedAssertCtempTransform; typedef struct v__gen__c__StrType v__gen__c__StrType; typedef struct v__gen__c__Gen v__gen__c__Gen; +typedef struct v__gen__c__GlobalConstDef v__gen__c__GlobalConstDef; typedef struct v__gen__c__SumtypeCastingFn v__gen__c__SumtypeCastingFn; typedef struct v__gen__c__GenSafeIntegerCfg v__gen__c__GenSafeIntegerCfg; typedef struct v__gen__c__ProfileCounterMeta v__gen__c__ProfileCounterMeta; @@ -416,6 +417,7 @@ typedef struct _option_Array_v__ast__Type _option_Array_v__ast__Type; typedef struct _option_v__ast__ConstField _option_v__ast__ConstField; typedef struct _option_v__ast__GlobalField _option_v__ast__GlobalField; typedef struct _option_v__ast__FnDecl _option_v__ast__FnDecl; +typedef struct _option_v__gen__c__GlobalConstDef _option_v__gen__c__GlobalConstDef; typedef struct _option_v__ast__Stmt_ptr _option_v__ast__Stmt_ptr; typedef struct _option_v__scanner__Scanner_ptr _option_v__scanner__Scanner_ptr; typedef struct _option_v__builder__MsvcResult _option_v__builder__MsvcResult; @@ -2391,7 +2393,9 @@ typedef map Map_string_v__ast__FnDecl; typedef map Map_string_v__ast__ConstField; typedef map Map_string_v__ast__GlobalField; typedef array Array_v__depgraph__DepGraphNode; +typedef map Map_string_i64; typedef map Map_string_strings__Builder; +typedef map Map_string_v__gen__c__GlobalConstDef; typedef map Map_string_v__ast__Stmt_ptr; typedef array Array_v__gen__c__StrType; typedef array Array_v__gen__c__SumtypeCastingFn; @@ -3489,6 +3493,7 @@ struct v__builder__CcompilerOptions { struct v__depgraph__DepGraph { bool acyclic; Array_v__depgraph__DepGraphNode nodes; + Map_string_i64 values; }; @@ -3933,6 +3938,7 @@ struct v__markused__Walker { struct v__depgraph__DepGraphNode { string name; + i64 value; Array_string deps; }; @@ -3992,6 +3998,16 @@ struct v__gen__c__StrType { +struct v__gen__c__GlobalConstDef { + string mod; + string def; + string init; + Array_string dep_names; + int order; +}; + + + struct v__gen__c__SumtypeCastingFn { string fn_name; v__ast__Type got; @@ -4778,6 +4794,7 @@ struct v__ast__ParExpr { struct v__ast__PostfixExpr { v__token__Kind op; v__token__Pos pos; + bool is_c2v_prefix; v__ast__Expr expr; string auto_locked; }; @@ -5462,6 +5479,7 @@ struct v__ast__IfGuardVar { struct v__ast__Fn { Array_v__ast__Param params; Array_string generic_names; + Array_string dep_names; Array_v__ast__Attr attrs; string mod; string file; @@ -5533,6 +5551,7 @@ struct v__parser__Parser { bool inside_vlib_file; bool inside_test_file; bool inside_if; + bool inside_comptime_if; bool inside_if_expr; bool inside_if_cond; bool inside_ct_if_expr; @@ -5932,14 +5951,9 @@ struct v__gen__c__Gen { strings__Builder hotcode_definitions; strings__Builder channel_definitions; strings__Builder comptime_definitions; - Map_string_strings__Builder global_inits; - strings__Builder global_init; - Map_string_strings__Builder inits; - strings__Builder init; strings__Builder cleanup; Map_string_strings__Builder cleanups; strings__Builder gowrappers; - strings__Builder stringliterals; strings__Builder auto_str_funcs; strings__Builder dump_funcs; strings__Builder pcs_declarations; @@ -5950,6 +5964,8 @@ struct v__gen__c__Gen { strings__Builder out_results; strings__Builder json_forward_decls; strings__Builder sql_buf; + Map_string_v__gen__c__GlobalConstDef global_const_defs; + Array_string sorted_global_const_names; v__ast__File* file; u64 unique_file_path_hash; v__ast__FnDecl* fn_decl; @@ -6072,6 +6088,7 @@ struct v__gen__c__Gen { Map_int_bool generated_free_methods; Array_string autofree_scope_stmts; bool use_segfault_handler; + Array_string test_function_names; }; @@ -6811,6 +6828,12 @@ struct _option_v__ast__FnDecl { byte data[sizeof(v__ast__FnDecl) > 0 ? sizeof(v__ast__FnDecl) : 1]; }; +struct _option_v__gen__c__GlobalConstDef { + byte state; + IError err; + byte data[sizeof(v__gen__c__GlobalConstDef) > 0 ? sizeof(v__gen__c__GlobalConstDef) : 1]; +}; + struct _option_v__ast__Stmt_ptr { byte state; IError err; @@ -6885,17 +6908,6 @@ string strings__find_between_pair_u8(string input, u8 start, u8 end); string strings__find_between_pair_rune(string input, rune start, rune end); string strings__find_between_pair_string(string input, string start, string end); Array_string strings__split_capital(string s); -u32 _const_math__bits__de_bruijn32 = 125613361; // precomputed -Array_u8 _const_math__bits__de_bruijn32tab; // inited later -u64 _const_math__bits__de_bruijn64 = 285870213051353865U; // precomputed -Array_u8 _const_math__bits__de_bruijn64tab; // inited later -u64 _const_math__bits__m0 = 6148914691236517205U; // precomputed -u64 _const_math__bits__m1 = 3689348814741910323U; // precomputed -u64 _const_math__bits__m2 = 1085102592571150095U; // precomputed -u64 _const_math__bits__m3 = 71777214294589695U; // precomputed -u64 _const_math__bits__m4 = 281470681808895U; // precomputed -u32 _const_math__bits__max_u32 = 4294967295; // precomputed -u64 _const_math__bits__max_u64 = 18446744073709551615U; // precomputed int math__bits__leading_zeros_8(u8 x); int math__bits__leading_zeros_16(u16 x); int math__bits__leading_zeros_32(u32 x); @@ -6908,10 +6920,6 @@ 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); @@ -6931,10 +6939,6 @@ multi_return_u32_u32 math__bits__add_32(u32 x, u32 y, u32 carry); multi_return_u64_u64 math__bits__add_64(u64 x, u64 y, u64 carry); multi_return_u32_u32 math__bits__sub_32(u32 x, u32 y, u32 borrow); multi_return_u64_u64 math__bits__sub_64(u64 x, u64 y, u64 borrow); -u64 _const_math__bits__two32 = 4294967296U; // precomputed -u64 _const_math__bits__mask32 = 4294967295U; // precomputed -string _const_math__bits__overflow_error; // a string literal, inited later -string _const_math__bits__divide_error; // a string literal, inited later multi_return_u32_u32 math__bits__mul_32(u32 x, u32 y); multi_return_u64_u64 math__bits__mul_64(u64 x, u64 y); multi_return_u32_u32 math__bits__div_32(u32 hi, u32 lo, u32 y); @@ -6942,25 +6946,6 @@ 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); u64 math__bits__rem_64(u64 hi, u64 lo, u64 y); multi_return_f64_int math__bits__normalize(f64 x); -Array_u8 _const_math__bits__ntz_8_tab; // inited later -Array_u8 _const_math__bits__pop_8_tab; // inited later -Array_u8 _const_math__bits__rev_8_tab; // inited later -Array_u8 _const_math__bits__len_8_tab; // inited later -u32 _const_strconv__single_plus_zero = 0; // precomputed -u32 _const_strconv__single_minus_zero = 2147483648; // precomputed -u32 _const_strconv__single_plus_infinity = 2139095040; // precomputed -u32 _const_strconv__single_minus_infinity = 4286578688; // precomputed -#define _const_strconv__digits 18 -u64 _const_strconv__double_plus_zero = 0U; // precomputed -u64 _const_strconv__double_minus_zero = 9223372036854775808U; // precomputed -u64 _const_strconv__double_plus_infinity = 9218868437227405312U; // precomputed -u64 _const_strconv__double_minus_infinity = 18442240474082181120U; // precomputed -rune _const_strconv__c_dpoint = '.'; // precomputed -rune _const_strconv__c_plus = '+'; // precomputed -rune _const_strconv__c_minus = '-'; // precomputed -rune _const_strconv__c_zero = '0'; // precomputed -rune _const_strconv__c_nine = '9'; // precomputed -u32 _const_strconv__c_ten = 10; // precomputed VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__lsr96(u32 s2, u32 s1, u32 s0); VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__lsl96(u32 s2, u32 s1, u32 s0); VV_LOCAL_SYMBOL multi_return_u32_u32_u32 strconv__add96(u32 s2, u32 s1, u32 s0, u32 d2, u32 d1, u32 d0); @@ -6972,10 +6957,6 @@ VV_LOCAL_SYMBOL multi_return_strconv__ParserState_strconv__PrepNumber strconv__p VV_LOCAL_SYMBOL u64 strconv__converter(strconv__PrepNumber* pn); _option_f64 strconv__atof64(string s); f64 strconv__atof_quick(string s); -Array_u64 _const_strconv__pos_exp; // inited later -Array_u64 _const_strconv__neg_exp; // inited later -#define _const_strconv__int_size 32 -u64 _const_strconv__max_u64 = 18446744073709551615U; // precomputed u8 strconv__byte_to_lower(u8 c); _option_u64 strconv__common_parse_uint(string s, int _base, int _bit_size, bool error_on_non_digit, bool error_on_high_digit); multi_return_u64_int strconv__common_parse_uint2(string s, int _base, int _bit_size); @@ -6984,11 +6965,6 @@ _option_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool e _option_i64 strconv__parse_int(string _s, int base, int _bit_size); _option_int strconv__atoi(string s); VV_LOCAL_SYMBOL bool strconv__underscore_ok(string s); -Array_u32 _const_strconv__ten_pow_table_32; // inited later -u32 _const_strconv__mantbits32 = 23; // precomputed -u32 _const_strconv__expbits32 = 8; // precomputed -#define _const_strconv__bias32 127 -#define _const_strconv__maxexp32 255 string strconv__Dec32_get_string_32(strconv__Dec32 d, bool neg, int i_n_digit, int i_pad_digit); VV_LOCAL_SYMBOL multi_return_strconv__Dec32_bool strconv__f32_to_decimal_exact_int(u32 i_mant, u32 exp); VV_LOCAL_SYMBOL strconv__Dec32 strconv__f32_to_decimal(u32 mant, u32 exp); @@ -6999,16 +6975,8 @@ VV_LOCAL_SYMBOL multi_return_strconv__Dec64_bool strconv__f64_to_decimal_exact_i VV_LOCAL_SYMBOL strconv__Dec64 strconv__f64_to_decimal(u64 mant, u64 exp); string strconv__f64_to_str(f64 f, int n_digit); string strconv__f64_to_str_pad(f64 f, int n_digit); -Array_u64 _const_strconv__ten_pow_table_64; // inited later -u32 _const_strconv__mantbits64 = 52; // precomputed -u32 _const_strconv__expbits64 = 11; // precomputed -#define _const_strconv__bias64 1023 -#define _const_strconv__maxexp64 2047 -Array_f64 _const_strconv__dec_round; // inited later string strconv__format_str(string s, strconv__BF_param p); 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); string strconv__f64_to_str_lnd1(f64 f, int dec_digit); string strconv__format_fl(f64 f, strconv__BF_param p); @@ -7018,18 +6986,8 @@ string strconv__ftoa_64(f64 f); string strconv__ftoa_long_64(f64 f); string strconv__ftoa_32(f32 f); string strconv__ftoa_long_32(f32 f); -string _const_strconv__base_digits; // a string literal, inited later string strconv__format_int(i64 n, int radix); string strconv__format_uint(u64 n, int radix); -#define _const_strconv__pow5_num_bits_32 61 -#define _const_strconv__pow5_inv_num_bits_32 59 -#define _const_strconv__pow5_num_bits_64 121 -#define _const_strconv__pow5_inv_num_bits_64 122 -Array_u64 _const_strconv__powers_of_10; // inited later -Array_u64 _const_strconv__pow5_split_32; // inited later -Array_u64 _const_strconv__pow5_inv_split_32; // inited later -Array_strconv__Uint128 _const_strconv__pow5_split_64; // inited later -Array_strconv__Uint128 _const_strconv__pow5_inv_split_64; // inited later string strconv__f32_to_str_l(f32 f); string strconv__f32_to_str_l_no_dot(f32 f); string strconv__f64_to_str_l(f64 f); @@ -7137,9 +7095,9 @@ void print(string s); void println(string s); VV_LOCAL_SYMBOL void _writeln_to_fd(int fd, string s); VV_LOCAL_SYMBOL void _write_buf_to_fd(int fd, u8* buf, int buf_len); -i64 total_m = ((i64)(0)); // global4 u8* _v_malloc(isize n); u8* malloc_noscan(isize n); +u8* malloc_uncollectable(isize n); u8* v_realloc(u8* b, isize n); u8* realloc_data(u8* old_data, int old_size, int new_size); u8* vcalloc(isize n); @@ -7147,12 +7105,10 @@ u8* vcalloc_noscan(isize n); void _v_free(voidptr ptr); voidptr memdup(voidptr src, int sz); voidptr memdup_noscan(voidptr src, int sz); +voidptr memdup_uncollectable(voidptr src, int sz); VV_LOCAL_SYMBOL int v_fixed_index(int i, int len); void print_backtrace(void); -int g_main_argc = ((int)(0)); // global4 -voidptr g_main_argv = ((voidptr)(0)); // global4 bool isnil(voidptr v); -Array_VCastTypeIndexName as_cast_type_indexes; // global4 VV_LOCAL_SYMBOL voidptr __as_cast(voidptr obj, int obj_type, int expected_type); void VAssertMetaInfo_free(VAssertMetaInfo* ami); VV_LOCAL_SYMBOL void __print_assert_failure(VAssertMetaInfo* i); @@ -7160,14 +7116,6 @@ VV_LOCAL_SYMBOL void v_segmentation_fault_handler(int signal); void gc_check_leaks(void); VV_LOCAL_SYMBOL void print_libbacktrace(int frames_to_skip); VV_LOCAL_SYMBOL void eprint_libbacktrace(int frames_to_skip); -#define _const_symopt_undname 2 -#define _const_symopt_deferred_loads 4 -#define _const_symopt_no_cpp 8 -#define _const_symopt_load_lines 16 -#define _const_symopt_include_32bit_modules 8192 -#define _const_symopt_allow_zero_address 16777216 -#define _const_symopt_debug 2147483648 -u32 g_original_codepage = ((u32)(0U)); // global4 VV_LOCAL_SYMBOL void restore_codepage(void); VV_LOCAL_SYMBOL int is_terminal(int fd); VV_LOCAL_SYMBOL void builtin_init(void); @@ -7214,7 +7162,6 @@ string ptr_str(voidptr ptr); string isize_str(isize x); string usize_str(usize x); string char_str(char* cptr); -string _const_digit_pairs; // a string literal, inited later VV_LOCAL_SYMBOL string int_str_l(int nn, int max); string i8_str(i8 n); string i16_str(i16 n); @@ -7266,15 +7213,6 @@ VV_LOCAL_SYMBOL u64 map_hash_int_2(voidptr pkey); VV_LOCAL_SYMBOL u64 map_hash_int_4(voidptr pkey); VV_LOCAL_SYMBOL u64 map_hash_int_8(voidptr pkey); VV_LOCAL_SYMBOL void DenseArray_zeros_to_end(DenseArray* d); -#define _const_hashbits 24 -#define _const_max_cached_hashbits 16 -#define _const_init_log_capicity 5 -#define _const_init_capicity 32 -f64 _const_max_load_factor = 0.8; // precomputed -#define _const_init_even_index 30 -#define _const_extra_metas_inc 4 -u32 _const_hash_mask = 16777215; // precomputed -u32 _const_probe_inc = 16777216; // precomputed VV_LOCAL_SYMBOL DenseArray new_dense_array(int key_bytes, int value_bytes); VV_LOCAL_SYMBOL voidptr DenseArray_key(DenseArray* d, int i); VV_LOCAL_SYMBOL voidptr DenseArray_value(DenseArray* d, int i); @@ -7322,7 +7260,6 @@ int Error_code(Error err); string MessageError_msg(MessageError err); int MessageError_code(MessageError err); void MessageError_free(MessageError* err); -IError _const_none__; // inited later VV_LOCAL_SYMBOL string None___str(None__ _d1); IError _v_error(string message); IError error_with_code(string message, int code); @@ -7330,8 +7267,6 @@ VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void opt_ok2(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void _result_ok(voidptr data, _result* res, int size); string none_str(none _d2); -#define _const_prealloc_block_size 16777216 -VMemoryBlock* g_memory_block; // global4 VV_LOCAL_SYMBOL VMemoryBlock* vmemory_block_new(VMemoryBlock* prev, isize at_least); VV_LOCAL_SYMBOL byte* vmemory_block_malloc(isize n); VV_LOCAL_SYMBOL void prealloc_vinit(void); @@ -7344,10 +7279,6 @@ string Array_rune_string(Array_rune ra); string rune_repeat(rune c, int count); Array_u8 rune_bytes(rune c); int rune_length_in_bytes(rune c); -#define _const_degree 6 -#define _const_mid_index 5 -#define _const_max_len 11 -u32 _const_children_bytes; // inited later VV_LOCAL_SYMBOL SortedMap new_sorted_map(int n, int value_bytes); VV_LOCAL_SYMBOL SortedMap new_sorted_map_init(int n, int value_bytes, string* keys, voidptr values); VV_LOCAL_SYMBOL mapnode* new_node(void); @@ -7391,7 +7322,7 @@ string string_clone(string a); string string_replace_once(string s, string rep, string with); string string_replace(string s, string rep, string with); string string_replace_each(string s, Array_string vals); -VV_LOCAL_SYMBOL int compare_3079424758118292824_RepIndex_by_idx(RepIndex* a, RepIndex* b) { +VV_LOCAL_SYMBOL int compare_5406533740619829871_RepIndex_by_idx(RepIndex* a, RepIndex* b) { if (a->idx < b->idx) return -1; else return 1; } @@ -7506,15 +7437,11 @@ u64 get_str_intp_u64_format(StrIntpType fmt_type, int in_width, int in_precision u32 get_str_intp_u32_format(StrIntpType fmt_type, int in_width, int in_precision, bool in_tail_zeros, bool in_sign, byte in_pad_ch, int in_base, bool in_upper_case); VV_LOCAL_SYMBOL void StrIntpData_process_str_intp_data(StrIntpData* data, strings__Builder* sb); string str_intp(int data_len, voidptr in_data); -string _const_si_s_code; // a string literal, inited later -string _const_si_g32_code; // a string literal, inited later -string _const_si_g64_code; // a string literal, inited later string str_intp_sq(string in_str); string str_intp_rune(string in_str); string str_intp_g32(string in_str); string str_intp_g64(string in_str); string str_intp_sub(string base_str, string in_str); -#define _const_cp_utf8 65001 u16* string_to_wide(string _str); string string_from_wide(u16* _wstr); string string_from_wide2(u16* _wstr, int len); @@ -7549,14 +7476,10 @@ int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScan int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss); void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss); void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss); -#define _const_dl__version 1 -string _const_dl__dl_ext; // inited later string dl__get_shared_library_extension(void); string dl__get_libname(string libname); _option_voidptr dl__open_opt(string filename, int flags); _option_voidptr dl__sym_opt(voidptr shared_object_handle, string symbol); -#define _const_dl__rtld_now 0 -#define _const_dl__rtld_lazy 0 voidptr dl__open(string filename, int flags); bool dl__close(voidptr handle); voidptr dl__sym(voidptr handle, string symbol); @@ -7567,9 +7490,8 @@ Array_string os__cmdline__options_before(Array_string args, Array_string what); Array_string os__cmdline__options_after(Array_string args, Array_string what); Array_string os__cmdline__only_non_options(Array_string args); Array_string os__cmdline__only_options(Array_string args); -#define _const_v__token__max_keyword_len 20 v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); -VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { +VV_LOCAL_SYMBOL int compare_11195941112940057302_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { if (string__lt(a->word, b->word)) return -1; else return 1; } @@ -7583,11 +7505,6 @@ v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end); v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line); void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line); v__token__Pos v__token__Token_pos(v__token__Token* tok); -Array_v__token__Kind _const_v__token__assign_tokens; // inited later -Array_string _const_v__token__valid_at_tokens; // inited later -Array_string _const_v__token__token_str; // inited later -Map_string_v__token__Kind _const_v__token__keywords; // inited later -v__token__KeywordsMatcher _const_v__token__matcher; // inited later VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void); VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void); bool v__token__is_key(string key); @@ -7597,7 +7514,6 @@ string v__token__Kind_str(v__token__Kind t); string v__token__Token_str(v__token__Token t); string v__token__Token_debug(v__token__Token t); Array_v__token__Precedence v__token__build_precedences(void); -Array_v__token__Precedence _const_v__token__precedences; // inited later int v__token__Token_precedence(v__token__Token tok); bool v__token__Token_is_scalar(v__token__Token tok); bool v__token__Token_is_unary(v__token__Token tok); @@ -7623,9 +7539,6 @@ string time__Time_ymmdd(time__Time t); string time__Time_ddmmy(time__Time t); string time__Time_md(time__Time t); VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); -Array_string _const_time__tokens_2; // inited later -Array_string _const_time__tokens_3; // inited later -Array_string _const_time__tokens_4; // inited later string time__Time_custom_format(time__Time t, string s); string time__Time_clean(time__Time t); string time__Time_clean12(time__Time t); @@ -7658,21 +7571,6 @@ i64 time__ticks(void); string time__Time_str(time__Time t); VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_string _const_time__long_days; // inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -Array_string _const_time__long_months; // inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -#define _const_time__days_in_year 365 -Array_int _const_time__days_before; // inited later string time__Time_smonth(time__Time* t); i64 time__Time_unix_time(time__Time* t); i64 time__Time_unix_time_milli(time__Time* t); @@ -7689,13 +7587,6 @@ string time__Time_long_weekday_str(time__Time* t); bool time__is_leap_year(int year); _option_int time__days_in_month(int month, int year); string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later i64 time__Duration_nanoseconds(time__Duration d); i64 time__Duration_microseconds(time__Duration d); i64 time__Duration_milliseconds(time__Duration d); @@ -7704,9 +7595,6 @@ f64 time__Duration_minutes(time__Duration d); f64 time__Duration_hours(time__Duration d); string time__Duration_str(time__Duration d); int time__offset(void); -u64 _const_time__start_time; // inited later -u64 _const_time__freq_time; // inited later -i64 _const_time__start_local_time; // inited later VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void); VV_LOCAL_SYMBOL u64 time__init_win_time_start(void); @@ -7730,7 +7618,7 @@ time__Time time__unix2(i64 abs, int microsecond); VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); void v__dotgraph__start_digraph(void); -VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void); +VV_LOCAL_SYMBOL void anon_fn_6b7dbc3eb6b094a7__82(void); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); @@ -7741,27 +7629,11 @@ u64 hash__wyhash_c(u8* key, u64 len, u64 seed); u64 hash__wyhash64_c(u64 a, u64 b); u64 hash__sum64_string(string key, u64 seed); u64 hash__sum64(Array_u8 key, u64 seed); -u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed -u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed -u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed -u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed -u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k); u64 hash__wymum(u64 a, u64 b); VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k); VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p); VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p); -u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed -#define _const_rand__constants__max_u32 4294967295 -u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed -f32 _const_rand__constants__max_u32_as_f32; // inited later -f64 _const_rand__constants__max_u64_as_f64; // inited later -u32 _const_rand__constants__u31_mask = 2147483647; // precomputed -u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed -u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed -u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed -u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed -u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed u32 hash__fnv1a__sum32_string(string data); u32 hash__fnv1a__sum32(Array_u8 data); u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); @@ -7774,9 +7646,6 @@ VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); string flag__Flag_str(flag__Flag f); string Array_flag__Flag_str(Array_flag__Flag af); VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f); -string _const_flag__space; // a string literal, inited later -string _const_flag__underline; // a string literal, inited later -#define _const_flag__max_args_number 4048 flag__FlagParser* flag__new_flag_parser(Array_string args); void flag__FlagParser_usage_example(flag__FlagParser* fs, string example); void flag__FlagParser_footer(flag__FlagParser* fs, string footer); @@ -7814,10 +7683,6 @@ VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2); VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2); -#define _const_semver__ver_major 0 -#define _const_semver__ver_minor 1 -#define _const_semver__ver_patch 2 -Array_int _const_semver__versions; // inited later VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input); VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver); VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ); @@ -7825,10 +7690,6 @@ VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVer VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver); VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver); VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver); -string _const_semver__comparator_sep; // a string literal, inited later -string _const_semver__comparator_set_sep; // a string literal, inited later -string _const_semver__hyphen_range_sep; // a string literal, inited later -string _const_semver__x_range_symbols; // a string literal, inited later VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver); VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver); VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver); @@ -7863,7 +7724,6 @@ VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input); VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ); VV_LOCAL_SYMBOL bool semver__is_valid_string(string input); VV_LOCAL_SYMBOL bool semver__is_valid_number(string input); -#define _const_sync__stdatomic__used 1 bool sync__stdatomic__add_u64(u64* ptr, int delta); bool sync__stdatomic__sub_u64(u64* ptr, int delta); bool sync__stdatomic__add_i64(i64* ptr, int delta); @@ -7874,115 +7734,6 @@ void sync__stdatomic__store_i64(i64* ptr, i64 val); i64 sync__stdatomic__load_i64(i64* ptr); Array_string os__args_after(string cut_word); Array_string os__args_before(string cut_word); -#define _const_os__success 0 -#define _const_os__error_insufficient_buffer 130 -#define _const_os__handle_generic_read 2147483648 -#define _const_os__handle_open_existing 3 -#define _const_os__file_share_read 1 -#define _const_os__file_share_write 2 -#define _const_os__file_share_delete 4 -#define _const_os__file_notify_change_file_name 1 -#define _const_os__file_notify_change_dir_name 2 -#define _const_os__file_notify_change_attributes 4 -#define _const_os__file_notify_change_size 8 -#define _const_os__file_notify_change_last_write 16 -#define _const_os__file_notify_change_last_access 32 -#define _const_os__file_notify_change_creation 64 -#define _const_os__file_notify_change_security 128 -#define _const_os__file_action_added 1 -#define _const_os__file_action_removed 2 -#define _const_os__file_action_modified 3 -#define _const_os__file_action_renamed_old_name 4 -#define _const_os__file_action_renamed_new_name 5 -#define _const_os__file_attr_readonly 1 -#define _const_os__file_attr_hidden 2 -#define _const_os__file_attr_system 4 -#define _const_os__file_attr_directory 16 -#define _const_os__file_attr_archive 32 -#define _const_os__file_attr_device 64 -#define _const_os__file_attr_normal 128 -#define _const_os__file_attr_temporary 256 -#define _const_os__file_attr_sparse_file 512 -#define _const_os__file_attr_reparse_point 1024 -#define _const_os__file_attr_compressed 2048 -#define _const_os__file_attr_offline 4096 -#define _const_os__file_attr_not_content_indexed 8192 -#define _const_os__file_attr_encrypted 16384 -#define _const_os__file_attr_integrity_stream 32768 -#define _const_os__file_attr_virtual 65536 -#define _const_os__file_attr_no_scrub_data 131072 -#define _const_os__file_type_unknown 0 -#define _const_os__file_type_disk 1 -#define _const_os__file_type_char 2 -#define _const_os__file_type_pipe 3 -#define _const_os__file_invalid_file_id -1 -voidptr _const_os__invalid_handle_value; // inited later -#define _const_os__enable_echo_input 4 -#define _const_os__enable_extended_flags 128 -#define _const_os__enable_insert_mode 32 -#define _const_os__enable_line_input 2 -#define _const_os__enable_mouse_input 16 -#define _const_os__enable_processed_input 1 -#define _const_os__enable_quick_edit_mode 64 -#define _const_os__enable_window_input 8 -#define _const_os__enable_virtual_terminal_input 512 -#define _const_os__enable_processed_output 1 -#define _const_os__enable_wrap_at_eol_output 2 -#define _const_os__enable_virtual_terminal_processing 4 -#define _const_os__disable_newline_auto_return 8 -#define _const_os__enable_lvb_grid_worldwide 16 -#define _const_os__o_rdonly 0 -#define _const_os__o_wronly 1 -#define _const_os__o_rdwr 2 -#define _const_os__o_append 8 -#define _const_os__o_create 256 -#define _const_os__o_binary 32768 -#define _const_os__o_trunc 512 -#define _const_os__o_excl 1024 -#define _const_os__o_sync 0 -#define _const_os__o_noctty 0 -#define _const_os__o_nonblock 0 -#define _const_os__status_access_violation 3221225477 -#define _const_os__status_in_page_error 3221225478 -#define _const_os__status_invalid_handle 3221225480 -#define _const_os__status_invalid_parameter 3221225485 -#define _const_os__status_no_memory 3221225495 -#define _const_os__status_illegal_instruction 3221225501 -#define _const_os__status_noncontinuable_exception 3221225509 -#define _const_os__status_invalid_disposition 3221225510 -#define _const_os__status_array_bounds_exceeded 3221225612 -#define _const_os__status_float_denormal_operand 3221225613 -#define _const_os__status_float_divide_by_zero 3221225614 -#define _const_os__status_float_inexact_result 3221225615 -#define _const_os__status_float_invalid_operation 3221225616 -#define _const_os__status_float_overflow 3221225617 -#define _const_os__status_float_stack_check 3221225618 -#define _const_os__status_float_underflow 3221225619 -#define _const_os__status_integer_divide_by_zero 3221225620 -#define _const_os__status_integer_overflow 3221225621 -#define _const_os__status_privileged_instruction 3221225622 -#define _const_os__status_stack_overflow 3221225725 -#define _const_os__status_dll_not_found 3221225781 -#define _const_os__status_ordinal_not_found 3221225784 -#define _const_os__status_entrypoint_not_found 3221225785 -#define _const_os__status_control_c_exit 3221225786 -#define _const_os__status_dll_init_failed 3221225794 -#define _const_os__status_float_multiple_faults 3221226164 -#define _const_os__status_float_multiple_traps 3221226165 -#define _const_os__status_reg_nat_consumption 3221226185 -#define _const_os__status_heap_corruption 3221226356 -#define _const_os__status_stack_buffer_overrun 3221226505 -#define _const_os__status_invalid_cruntime_parameter 3221226519 -#define _const_os__status_assertion_failure 3221226528 -voidptr _const_os__hkey_local_machine; // inited later -voidptr _const_os__hkey_current_user; // inited later -#define _const_os__key_query_value 1 -#define _const_os__key_set_value 2 -#define _const_os__key_enumerate_sub_keys 8 -#define _const_os__key_wow64_32key 512 -voidptr _const_os__hwnd_broadcast; // inited later -#define _const_os__wm_settingchange 26 -#define _const_os__smto_abortifhung 2 string os__getenv(string key); _option_string os__getenv_opt(string key); int os__setenv(string name, string value, bool overwrite); @@ -8021,14 +7772,6 @@ VV_LOCAL_SYMBOL IError os__error_file_not_opened(void); VV_LOCAL_SYMBOL IError os__error_size_of_type_0(void); _option_void os__File_seek(os__File* f, i64 pos, os__SeekMode mode); _option_i64 os__File_tell(os__File* f); -rune _const_os__fslash = '/'; // precomputed -#define _const_os__bslash '\\' -rune _const_os__dot = '.'; // precomputed -rune _const_os__qmark = '?'; // precomputed -string _const_os__fslash_str; // a string literal, inited later -string _const_os__dot_dot; // a string literal, inited later -string _const_os__empty_str; // a string literal, inited later -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); @@ -8047,7 +7790,6 @@ u32 os__FilePermission_bitmask(os__FilePermission p); u32 os__FileMode_bitmask(os__FileMode m); os__FileMode os__inode(string path); _option_void os__open_uri(string uri); -Array_string _const_os__args; // inited later _option_Array_u8 os__read_bytes(string path); _option_string os__read_file(string path); _option_void os__truncate(string path, u64 len); @@ -8091,18 +7833,12 @@ _option_void os__execve(string cmdpath, Array_string cmdargs, Array_string envs) int os__is_atty(int fd); _option_void os__write_file_array(string path, array buffer); _option_Array_string os__glob(Array_string patterns); -VV_LOCAL_SYMBOL int compare_3677745349018262865_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_5811885252942183168_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } IError os__last_error(void); -#define _const_os__max_path_len 4096 -string _const_os__wd_at_startup; // inited later -#define _const_os__f_ok 0 -#define _const_os__x_ok 1 -#define _const_os__w_ok 2 -#define _const_os__r_ok 4 void os__Result_free(os__Result* result); _option_void os__cp_all(string src, string dst, bool overwrite); _option_void os__mv_by_cp(string source, string target); @@ -8149,8 +7885,6 @@ os__Result os__execute_or_panic(string cmd); os__Result os__execute_or_exit(string cmd); string os__quoted_path(string path); _option_string os__config_dir(void); -string _const_os__path_separator; // a string literal, inited later -string _const_os__path_delimiter; // a string literal, inited later VV_LOCAL_SYMBOL Array_string os__init_os_args_wide(int argc, u8** argv); VV_LOCAL_SYMBOL _option_void os__native_glob_pattern(string pattern, Array_string* matches); _option_void os__utime(string path, int actime, int modtime); @@ -8158,16 +7892,6 @@ _option_Array_string os__ls(string path); _option_bool os__mkdir(string path); os__HANDLE os__get_file_handle(string path); _option_string os__get_module_filename(os__HANDLE handle); -#define _const_os__format_message_allocate_buffer 256 -#define _const_os__format_message_argument_array 8192 -#define _const_os__format_message_from_hmodule 2048 -#define _const_os__format_message_from_string 1024 -#define _const_os__format_message_from_system 4096 -#define _const_os__format_message_ignore_inserts 512 -#define _const_os__sublang_neutral 0 -#define _const_os__sublang_default 1 -#define _const_os__lang_neutral 0 -#define _const_os__max_error_code 15841 VV_LOCAL_SYMBOL voidptr os__ptr_win_get_error_msg(u32 code); string os__get_error_msg(int code); os__Result os__execute(string cmd); @@ -8247,6 +7971,7 @@ void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o); v__depgraph__DepGraph* v__depgraph__new_dep_graph(void); void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps); +void v__depgraph__DepGraph_add_with_value(v__depgraph__DepGraph* graph, string mod, Array_string deps, i64 value); v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph); v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph); string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); @@ -8323,8 +8048,6 @@ void term__erase_line_clear(void); void term__show_cursor(void); void term__hide_cursor(void); void term__clear_previous_line(void); -#define _const_term__default_columns_size 80 -#define _const_term__default_rows_size 25 bool term__can_show_color_on_stdout(void); bool term__can_show_color_on_stderr(void); string term__failed(string s); @@ -8343,7 +8066,6 @@ multi_return_int_int term__get_terminal_size(void); _option_term__Coord term__get_cursor_position(void); bool term__set_terminal_title(string title); void term__clear(void); -string _const_v__util__version__v_version; // a string literal, inited later string v__util__version__vhash(void); string v__util__version__full_hash(void); string v__util__version__full_v_version(bool is_verbose); @@ -8361,7 +8083,6 @@ _option_string v__util__diff__find_working_diff_command(void); VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -string _const_v__vmod__err_label; // a string literal, inited later _option_v__vmod__Manifest v__vmod__from_file(string vmod_path); _option_v__vmod__Manifest v__vmod__decode(string contents); VV_LOCAL_SYMBOL void v__vmod__Scanner_tokenize(v__vmod__Scanner* s, v__vmod__TokenKind t_type, string val); @@ -8381,15 +8102,12 @@ VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_add(v__vmod__ModFileCacher* cacher, VV_LOCAL_SYMBOL multi_return_Array_string_v__vmod__ModFileAndFolder v__vmod__ModFileCacher_traverse(v__vmod__ModFileCacher* mcache, string mfolder); VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_mark_folders_with_vmod(v__vmod__ModFileCacher* mcache, Array_string folders_so_far, v__vmod__ModFileAndFolder vmod); VV_LOCAL_SYMBOL void v__vmod__ModFileCacher_mark_folders_as_vmod_free(v__vmod__ModFileCacher* mcache, Array_string folders_so_far); -Array_string _const_v__vmod__mod_file_stop_paths; // inited later VV_LOCAL_SYMBOL bool v__vmod__ModFileCacher_check_for_stop(v__vmod__ModFileCacher* mcache, string cfolder, Array_string files); VV_LOCAL_SYMBOL Array_string v__vmod__ModFileCacher_get_files(v__vmod__ModFileCacher* mcache, string cfolder); -v__vmod__ModFileCacher* _const_v__vmod__private_file_cacher; // inited later v__vmod__ModFileCacher* v__vmod__get_cache(void); string v__util__recompilation__disabling_file(string vroot); void v__util__recompilation__must_be_enabled(string vroot, string error_message); string v__cflag__CFlag_str(v__cflag__CFlag* c); -string _const_v__cflag__fexisting_literal; // a string literal, inited later string v__cflag__CFlag_eval(v__cflag__CFlag* cf); string v__cflag__CFlag_format(v__cflag__CFlag* cf); Array_string Array_v__cflag__CFlag_c_options_before_target_msvc(Array_v__cflag__CFlag cflags); @@ -8399,9 +8117,6 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); -u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed -u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed -#define _const_rand__wyrand__seed_len 2 void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); @@ -8411,7 +8126,7 @@ int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod); _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); -VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_10487185186218018245_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8419,8 +8134,6 @@ VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { _option_string v__pkgconfig__Main_run(v__pkgconfig__Main* m); VV_LOCAL_SYMBOL string v__pkgconfig__filter(Array_string libs, string prefix, string prefix2); VV_LOCAL_SYMBOL v__pkgconfig__MainOptions* v__pkgconfig__parse_options(flag__FlagParser* fp); -Array_string _const_v__pkgconfig__default_paths; // inited later -string _const_v__pkgconfig__version; // a string literal, inited later VV_LOCAL_SYMBOL Array_string v__pkgconfig__PkgConfig_parse_list_no_comma(v__pkgconfig__PkgConfig* pc, string s); VV_LOCAL_SYMBOL Array_string v__pkgconfig__PkgConfig_parse_list(v__pkgconfig__PkgConfig* pc, string s); VV_LOCAL_SYMBOL string v__pkgconfig__PkgConfig_parse_line(v__pkgconfig__PkgConfig* pc, string s); @@ -8442,17 +8155,14 @@ bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); -f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a); VV_LOCAL_SYMBOL f64 rand__mlog(f64 a); VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x); VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_); VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b); VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f); -Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later string rand__uuid_v4(void); VV_LOCAL_SYMBOL string rand__internal_uuid_v4(rand__PRNG* rng); -string _const_rand__ulid_encoding; // a string literal, inited later VV_LOCAL_SYMBOL string rand__internal_ulid_at_millisecond(rand__PRNG* rng, u64 unix_time_milli); VV_LOCAL_SYMBOL string rand__internal_string_from_set(rand__PRNG* rng, string charset, int len); VV_LOCAL_SYMBOL void rand__deinit(void); @@ -8493,7 +8203,6 @@ _option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct _option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf); _option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p); f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda); -rand__PRNG* default_rng; // global4 rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config); rand__PRNG* rand__get_current_rng(void); void rand__set_rng(rand__PRNG* rng); @@ -8522,9 +8231,6 @@ _option_f32 rand__f32_in_range(f32 min, f32 max); _option_f64 rand__f64_in_range(f64 min, f64 max); _option_Array_u8 rand__bytes(int bytes_needed); void rand__read(Array_u8* buf); -string _const_rand__english_letters; // a string literal, inited later -string _const_rand__hex_chars; // a string literal, inited later -string _const_rand__ascii_chars; // a string literal, inited later string rand__ulid(void); string rand__ulid_at_millisecond(u64 unix_time_milli); string rand__string_from_set(string charset, int len); @@ -8536,7 +8242,6 @@ _option_f64 rand__normal(rand__config__NormalConfigStruct conf); _option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf); _option_int rand__binomial(int n, f64 p); f64 rand__exponential(f64 lambda); -string _const_v__pref__default_module_path; // inited later v__pref__Preferences* v__pref__new_preferences(void); VV_LOCAL_SYMBOL void v__pref__Preferences_expand_lookup_paths(v__pref__Preferences* p); void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p); @@ -8550,7 +8255,6 @@ _option_v__pref__OS v__pref__os_from_string(string os_str); string v__pref__OS_str(v__pref__OS o); v__pref__OS v__pref__get_host_os(void); bool v__pref__Backend_is_js(v__pref__Backend b); -Array_string _const_v__pref__list_of_flags_with_param; // inited later multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string known_external_commands, Array_string args); 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); void v__pref__eprintln_cond(bool condition, string s); @@ -8565,7 +8269,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); 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) { +VV_LOCAL_SYMBOL int compare_15729605724654494396_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8575,9 +8279,6 @@ bool v__pref__Preferences_should_compile_native(v__pref__Preferences* prefs, str bool v__pref__Preferences_should_compile_c(v__pref__Preferences* prefs, string file); bool v__pref__Preferences_should_compile_asm(v__pref__Preferences* prefs, string path); bool v__pref__Preferences_should_compile_js(v__pref__Preferences* prefs, string file); -#define _const_sync__aops_used 1 -#define _const_sync__spinloops 750 -#define _const_sync__spinloops_sem 4000 VV_LOCAL_SYMBOL sync__Channel* sync__new_channel_st(u32 n, u32 st); VV_LOCAL_SYMBOL sync__Channel* sync__new_channel_st_noscan(u32 n, u32 st); string sync__Channel_auto_str(sync__Channel* ch, string _v_typename); @@ -8624,10 +8325,9 @@ void sync__WaitGroup_init(sync__WaitGroup* wg); void sync__WaitGroup_add(sync__WaitGroup* wg, int delta); void sync__WaitGroup_done(sync__WaitGroup* wg); void sync__WaitGroup_wait(sync__WaitGroup* wg); -string _const_help__unknown_topic; // a string literal, inited later void help__print_and_exit(string topic); VV_LOCAL_SYMBOL string help__known_topics(string topicdir); -VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_13139793989557853369_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8635,16 +8335,11 @@ VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) { _option_string v__util__find_working_diff_command(void); string v__util__color_compare_files(string diff_cmd, string file1, string file2); string v__util__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -#define _const_v__util__error_context_before 2 -#define _const_v__util__error_context_after 2 -v__util__EManager* _const_v__util__emanager; // inited later v__util__EManager* v__util__new_error_manager(void); void v__util__EManager_set_support_color(v__util__EManager* e, bool b); string v__util__bold(string msg); VV_LOCAL_SYMBOL string v__util__color(string kind, string msg); -string _const_v__util__normalised_workdir; // inited later string v__util__formatted_error(string kind, string omsg, string filepath, v__token__Pos pos); -v__util__LinesCache* lines_cache; // global4 Array_string v__util__cached_file2sourcelines(string path); Array_string v__util__set_source_for_path(string path, string source); Array_string v__util__source_file_context(string kind, string filepath, v__token__Pos pos); @@ -8653,12 +8348,6 @@ string v__util__vlines_escape_path(string path, string ccompiler); string v__util__qualify_import(v__pref__Preferences* pref, string mod, string file_path); string v__util__qualify_module(v__pref__Preferences* pref, string mod, string file_path); VV_LOCAL_SYMBOL _option_string v__util__mod_path_to_full_name(v__pref__Preferences* pref, string mod, string path); -Array_u8 _const_v__util__invalid_escapes; // inited later -#define _const_v__util__backslash 92 -#define _const_v__util__backslash_r 13 -#define _const_v__util__backslash_n 10 -#define _const_v__util__double_quote 34 -string _const_v__util__double_escape; // a string literal, inited later string v__util__smart_quote(string str, bool raw); bool v__util__is_name_char(u8 c); bool v__util__is_func_char(u8 c); @@ -8670,13 +8359,13 @@ v__util__Suggestion v__util__new_suggestion(string wanted, Array_string possibil void v__util__Suggestion_add(v__util__Suggestion* s, string val); void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many); void v__util__Suggestion_sort(v__util__Suggestion* s); -VV_LOCAL_SYMBOL int compare_15123029833316296960_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { +VV_LOCAL_SYMBOL int compare_14781029812553904099_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { if (a->similarity < b->similarity) return -1; else return 1; } string v__util__Suggestion_say(v__util__Suggestion s, string msg); -VV_LOCAL_SYMBOL int compare_15123029833316296960_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_14781029812553904099_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -8690,7 +8379,6 @@ string v__util__Surrounder_after(v__util__Surrounder* s); void v__util__Surrounder_builder_write_befores(v__util__Surrounder* s, strings__Builder* sb); void v__util__Surrounder_builder_write_afters(v__util__Surrounder* s, strings__Builder* sb); void v__util__Surrounder_free(v__util__Surrounder* s); -v__util__Timers* g_timers; // global4 v__util__Timers* v__util__new_timers(v__util__TimerParams params); v__util__Timers* v__util__get_timers(void); void v__util__timing_start(string label); @@ -8708,10 +8396,6 @@ void v__util__Timers_show_if_exists(v__util__Timers* t, string label); void v__util__Timers_show_remaining(v__util__Timers* t); void v__util__Timers_dump_all(v__util__Timers* t); string v__util__skip_bom(string file_content); -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 bool v__util__module_is_builtin(string mod); string v__util__tabs(int n); void v__util__set_vroot_folder(string vroot_path); @@ -8732,7 +8416,6 @@ void v__util__ensure_modules_for_all_tools_are_installed(bool is_verbose); string v__util__strip_mod_name(string name); string v__util__strip_main_name(string name); string v__util__no_dots(string s); -string _const_v__util__map_prefix; // a string literal, inited later string v__util__no_cur_mod(string _v_typename, string cur_mod); void v__util__prepare_tool_when_needed(string source_name); void v__util__recompile_file(string vexe, string file); @@ -8741,7 +8424,6 @@ bool v__util__should_bundle_module(string mod); _option_Array_string v__util__find_all_v_files(Array_string roots); void v__util__free_caches(void); _option_string v__util__read_file(string file_path); -voidptr _const_sync__pool__no_result; // inited later sync__pool__PoolProcessor* sync__pool__new_pool_processor(sync__pool__PoolProcessorConfig context); void sync__pool__PoolProcessor_set_max_jobs(sync__pool__PoolProcessor* pool, int njobs); void sync__pool__PoolProcessor_work_on_items_T___ptr__v__ast__File(sync__pool__PoolProcessor* pool, Array_v__ast__File_ptr items); @@ -8762,12 +8444,6 @@ bool v__ast__StructField_equals(v__ast__StructField* f, v__ast__StructField* o); void v__ast__File_free(v__ast__File* f); bool v__ast__Ident_is_mut(v__ast__Ident* i); v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i); -Map_int_Array_string _const_v__ast__x86_no_number_register_list; // inited later -Map_int_Map_string_int _const_v__ast__x86_with_number_register_list; // inited later -Array_string _const_v__ast__arm_no_number_register_list; // inited later -Map_string_int _const_v__ast__arm_with_number_register_list; // inited later -Array_string _const_v__ast__riscv_no_number_register_list; // inited later -Map_string_int _const_v__ast__riscv_with_number_register_list; // inited later 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); @@ -8810,7 +8486,6 @@ bool v__ast__ConstField_is_simple_define_const(v__ast__ConstField* obj); bool v__ast__ScopeObject_is_simple_define_const(v__ast__ScopeObject obj); u64 v__ast__EmbeddedFile_hash(v__ast__EmbeddedFile e); v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ast__Table* t); -Array_string _const_v__ast__native_builtins; // inited later void v__ast__Scope_free(v__ast__Scope* s); VV_LOCAL_SYMBOL bool v__ast__Scope_dont_lookup_parent(v__ast__Scope* s); _option_v__ast__ScopeObject v__ast__Scope_find(v__ast__Scope* s, string name); @@ -8844,7 +8519,6 @@ string v__ast__Stmt_str(v__ast__Stmt node); VV_LOCAL_SYMBOL string v__ast__field_to_string(v__ast__ConstField f); string v__ast__ComptimeForKind_str(v__ast__ComptimeForKind e); void v__ast__Table_free(v__ast__Table* t); -#define _const_v__ast__invalid_type_idx -1 VV_LOCAL_SYMBOL void v__ast__default_table_panic_handler(v__ast__Table* t, string message); void v__ast__Table_panic(v__ast__Table* t, string message); VV_LOCAL_SYMBOL bool v__ast__Fn_method_equals(v__ast__Fn* f, v__ast__Fn* o); @@ -8853,7 +8527,6 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o); VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ast__Param o); v__ast__Table* v__ast__new_table(void); -v__ast__Table* global_table = ((v__ast__Table*)(0)); // global4 void v__ast__set_global_table(v__ast__Table* t); string v__ast__Table_fn_type_signature(v__ast__Table* t, v__ast__Fn* f); string v__ast__Table_fn_type_source_signature(v__ast__Table* t, v__ast__Fn* f); @@ -8882,7 +8555,6 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS int v__ast__Table_find_type_idx(v__ast__Table* t, string name); _option_v__ast__TypeSymbol_ptr v__ast__Table_find_sym(v__ast__Table* t, string name); multi_return_ref_v__ast__TypeSymbol_int v__ast__Table_find_sym_and_type_idx(v__ast__Table* t, string name); -v__ast__TypeSymbol* _const_v__ast__invalid_type_symbol; // inited later v__ast__TypeSymbol* v__ast__Table_sym_by_idx(v__ast__Table* t, int idx); v__ast__TypeSymbol* v__ast__Table_sym(v__ast__Table* t, v__ast__Type typ); v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Type typ); @@ -8936,6 +8608,8 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Array_v__ast__Type generic_types); void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t); bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__ComptimeType y); +Array_string v__ast__Table_dependent_names_in_expr(v__ast__Table* t, v__ast__Expr expr); +Array_string v__ast__Table_dependent_names_in_stmt(v__ast__Table* t, v__ast__Stmt stmt); v__ast__Language v__ast__pref_arch_to_table_language(v__pref__Arch pref_arch); string v__ast__ShareType_str(v__ast__ShareType t); string v__ast__Type_atomic_typename(v__ast__Type t); @@ -8979,80 +8653,9 @@ bool v__ast__Type_is_int_literal(v__ast__Type typ); bool v__ast__Type_is_number(v__ast__Type typ); bool v__ast__Type_is_string(v__ast__Type typ); bool v__ast__Type_is_bool(v__ast__Type typ); -#define _const_v__ast__void_type_idx 1 -#define _const_v__ast__voidptr_type_idx 2 -#define _const_v__ast__byteptr_type_idx 3 -#define _const_v__ast__charptr_type_idx 4 -#define _const_v__ast__i8_type_idx 5 -#define _const_v__ast__i16_type_idx 6 -#define _const_v__ast__int_type_idx 7 -#define _const_v__ast__i64_type_idx 8 -#define _const_v__ast__isize_type_idx 9 -#define _const_v__ast__byte_type_idx 10 -#define _const_v__ast__u16_type_idx 11 -#define _const_v__ast__u32_type_idx 12 -#define _const_v__ast__u64_type_idx 13 -#define _const_v__ast__usize_type_idx 14 -#define _const_v__ast__f32_type_idx 15 -#define _const_v__ast__f64_type_idx 16 -#define _const_v__ast__char_type_idx 17 -#define _const_v__ast__bool_type_idx 18 -#define _const_v__ast__none_type_idx 19 -#define _const_v__ast__string_type_idx 20 -#define _const_v__ast__rune_type_idx 21 -#define _const_v__ast__array_type_idx 22 -#define _const_v__ast__map_type_idx 23 -#define _const_v__ast__chan_type_idx 24 -#define _const_v__ast__any_type_idx 25 -#define _const_v__ast__float_literal_type_idx 26 -#define _const_v__ast__int_literal_type_idx 27 -#define _const_v__ast__thread_type_idx 28 -#define _const_v__ast__error_type_idx 29 -Array_string _const_v__ast__builtin_type_names; // inited later -v__token__KeywordsMatcher _const_v__ast__builtin_type_names_matcher; // inited later -Array_int _const_v__ast__integer_type_idxs; // inited later -Array_int _const_v__ast__signed_integer_type_idxs; // inited later -Array_int _const_v__ast__unsigned_integer_type_idxs; // inited later -Array_int _const_v__ast__int_promoted_type_idxs; // inited later -Array_int _const_v__ast__float_type_idxs; // inited later -Array_int _const_v__ast__number_type_idxs; // inited later -Array_int _const_v__ast__pointer_type_idxs; // inited later -Array_int _const_v__ast__string_type_idxs; // inited later -v__ast__Type _const_v__ast__void_type; // inited later -v__ast__Type _const_v__ast__ovoid_type; // inited later -v__ast__Type _const_v__ast__rvoid_type; // inited later -v__ast__Type _const_v__ast__voidptr_type; // inited later -v__ast__Type _const_v__ast__byteptr_type; // inited later -v__ast__Type _const_v__ast__charptr_type; // inited later -v__ast__Type _const_v__ast__i8_type; // inited later -v__ast__Type _const_v__ast__int_type; // inited later -v__ast__Type _const_v__ast__i16_type; // inited later -v__ast__Type _const_v__ast__i64_type; // inited later -v__ast__Type _const_v__ast__isize_type; // inited later -v__ast__Type _const_v__ast__byte_type; // inited later -v__ast__Type _const_v__ast__u16_type; // inited later -v__ast__Type _const_v__ast__u32_type; // inited later -v__ast__Type _const_v__ast__u64_type; // inited later -v__ast__Type _const_v__ast__usize_type; // inited later -v__ast__Type _const_v__ast__f32_type; // inited later -v__ast__Type _const_v__ast__f64_type; // inited later -v__ast__Type _const_v__ast__char_type; // inited later -v__ast__Type _const_v__ast__bool_type; // inited later -v__ast__Type _const_v__ast__none_type; // inited later -v__ast__Type _const_v__ast__string_type; // inited later -v__ast__Type _const_v__ast__rune_type; // inited later -v__ast__Type _const_v__ast__array_type; // inited later -v__ast__Type _const_v__ast__map_type; // inited later -v__ast__Type _const_v__ast__chan_type; // inited later -v__ast__Type _const_v__ast__any_type; // inited later -v__ast__Type _const_v__ast__float_literal_type; // inited later -v__ast__Type _const_v__ast__int_literal_type; // inited later -v__ast__Type _const_v__ast__thread_type; // inited later -v__ast__Type _const_v__ast__error_type; // inited later -Array_v__ast__Type _const_v__ast__charptr_types; // inited later -Array_v__ast__Type _const_v__ast__byteptr_types; // inited later -Array_v__ast__Type _const_v__ast__voidptr_types; // inited later -Array_v__ast__Type _const_v__ast__cptr_types; // inited later +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_charptr_types(void); +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_byteptr_types(void); +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_voidptr_types(void); Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params); v__ast__Type v__ast__mktyp(v__ast__Type typ); v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ); @@ -9119,21 +8722,6 @@ _option_void v__checker__Checker_check_expected(v__checker__Checker* c, v__ast__ VV_LOCAL_SYMBOL string v__checker__Checker_expected_msg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_symmetric_check(v__checker__Checker* c, v__ast__Type left, v__ast__Type right); void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__Fn func, v__ast__CallExpr* node); -int _const_v__checker__int_min; // inited later -int _const_v__checker__int_max = 2147483647; // precomputed -#define _const_v__checker__expr_level_cutoff_limit 40 -#define _const_v__checker__stmt_level_cutoff_limit 40 -#define _const_v__checker__iface_level_cutoff_limit 100 -Array_string _const_v__checker__valid_comptime_if_os; // inited later -Array_string _const_v__checker__valid_comptime_compression_types; // inited later -Array_string _const_v__checker__valid_comptime_if_compilers; // inited later -Array_string _const_v__checker__valid_comptime_if_platforms; // inited later -Array_string _const_v__checker__valid_comptime_if_cpu_features; // inited later -Array_string _const_v__checker__valid_comptime_if_other; // inited later -Array_string _const_v__checker__valid_comptime_not_user_defined; // inited later -Array_string _const_v__checker__array_builtin_methods; // inited later -Array_string _const_v__checker__reserved_type_names; // inited later -string _const_v__checker__vroot_is_deprecated_message; // a string literal, inited later 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); VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_file(v__checker__Checker* c); @@ -9261,13 +8849,12 @@ 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 v__ast__Type v__checker__Checker_string_lit(v__checker__Checker* c, v__ast__StringLiteral* node); v__ast__Type v__checker__Checker_int_lit(v__checker__Checker* c, v__ast__IntegerLiteral* node); void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node); VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b); v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node); -VV_LOCAL_SYMBOL int compare_5995660241070764127_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { +VV_LOCAL_SYMBOL int compare_6602916910409314308_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { if (a->i < b->i) return -1; else return 1; } @@ -9337,13 +8924,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index(v__gen__c__Gen* g, v__ast__C VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_wait(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__CallExpr node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement); -IError _const_v__gen__c__unsupported_ctemp_assert_transform; // inited later +VV_LOCAL_SYMBOL void v__gen__c__Gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement); VV_LOCAL_SYMBOL _option_v__ast__Expr v__gen__c__Gen_assert_subexpression_to_ctemp(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type expr_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_postfailure_mode(v__gen__c__Gen* g, v__ast__AssertStmt node); VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ast__AssertStmt node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type typ); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_); +VV_LOCAL_SYMBOL void v__gen__c__Gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node, v__ast__Type return_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_vars_autofree(v__gen__c__Gen* g, v__ast__AssignStmt* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node); @@ -9364,7 +8950,6 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_struct(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string fn_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string fn_name); VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp); -string _const_v__gen__c__si_s_code; // a string literal, inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name); VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__StrType typ); @@ -9389,12 +8974,6 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_struct(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x); VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); -Array_string _const_v__gen__c__c_reserved; // inited later -Map_string_bool _const_v__gen__c__c_reserved_map; // inited later -Array_string _const_v__gen__c__cmp_str; // inited later -Array_string _const_v__gen__c__cmp_rev; // inited later -string _const_v__gen__c__result_name; // a string literal, inited later -string _const_v__gen__c__option_name; // a string literal, inited later VV_LOCAL_SYMBOL Map_string_bool v__gen__c__string_array_to_map(Array_string a); string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pref__Preferences* pref); VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__PoolProcessor* p, int idx, int wid); @@ -9457,7 +9036,7 @@ VV_LOCAL_SYMBOL string v__gen__c__cescape_nonascii(string original); VV_LOCAL_SYMBOL string v__gen__c__cestring(string s); VV_LOCAL_SYMBOL string v__gen__c__ctoslit(string s); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_attrs(v__gen__c__Gen* g, Array_v__ast__Attr attrs); -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt); +VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt); VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg arg, v__ast__AsmStmt stmt); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_ios(v__gen__c__Gen* g, Array_v__ast__AsmIO ios); VV_LOCAL_SYMBOL string v__gen__c__cnewlines(string s); @@ -9490,9 +9069,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_result_error(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_optional_error(v__gen__c__Gen* g, v__ast__Type target_type, v__ast__Expr expr); VV_LOCAL_SYMBOL void v__gen__c__Gen_return_stmt(v__gen__c__Gen* g, v__ast__Return node); VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl(v__gen__c__Gen* g, v__ast__ConstDecl node); -VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ); -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string styp, string cname, string ct_value); -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val); +VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, string field_name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string mod, string styp, string cname, string field_name, string ct_value); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string mod, string name, string val); VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, string mod, string name, v__ast__Expr expr, v__ast__Type typ, bool unwrap_option); VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__GlobalDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_assoc(v__gen__c__Gen* g, v__ast__Assoc node); @@ -9500,10 +9079,10 @@ VV_LOCAL_SYMBOL void v__gen__c__verror(string s); VV_LOCAL_SYMBOL void v__gen__c__Gen_error(v__gen__c__Gen* g, string s, v__token__Pos pos); VV_LOCAL_SYMBOL void v__gen__c__Gen_checker_bug(v__gen__c__Gen* g, string s, v__token__Pos pos); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_init_function(v__gen__c__Gen* g); -Array_string _const_v__gen__c__builtins; // inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_write_builtin_types(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sorted_types(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr symbols); +VV_LOCAL_SYMBOL void v__gen__c__Gen_sort_globals_consts(v__gen__c__Gen* g); VV_LOCAL_SYMBOL Array_v__ast__TypeSymbol_ptr v__gen__c__Gen_sort_structs(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr typesa); VV_LOCAL_SYMBOL int v__gen__c__Gen_nth_stmt_pos(v__gen__c__Gen* g, int n); VV_LOCAL_SYMBOL void v__gen__c__Gen_set_current_pos_as_last_stmt_pos(v__gen__c__Gen* g); @@ -9527,17 +9106,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_trace(v__gen__c__Gen* g, string fbase, strin int v__gen__c__Gen_get_array_depth(v__gen__c__Gen* g, v__ast__Type el_typ); bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ); VV_LOCAL_SYMBOL string v__gen__c__Gen_check_noscan(v__gen__c__Gen* g, v__ast__Type elem_typ); -string _const_v__gen__c__c_commit_hash_default; // a string literal, inited later -string _const_v__gen__c__c_current_commit_hash_default; // a string literal, inited later -string _const_v__gen__c__c_concurrency_helpers; // a string literal, inited later VV_LOCAL_SYMBOL string v__gen__c__c_closure_helpers(v__pref__Preferences* pref); -string _const_v__gen__c__c_common_macros; // a string literal, inited later -string _const_v__gen__c__c_unsigned_comparison_functions; // a string literal, inited later -string _const_v__gen__c__c_helper_macros; // a string literal, inited later -string _const_v__gen__c__c_headers; // str inited later -string _const_v__gen__c__c_builtin_types; // a string literal, inited later -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); @@ -9574,7 +9143,6 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_used_by_main(v__gen__c__Gen* g, v__ast__F VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl* node, bool skip); VV_LOCAL_SYMBOL _option_string v__gen__c__Gen_c_fn_name(v__gen__c__Gen* g, v__ast__FnDecl* node); -string _const_v__gen__c__closure_ctx; // a string literal, inited later VV_LOCAL_SYMBOL string v__gen__c__closure_ctx(v__ast__FnDecl node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonFn* node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn_decl(v__gen__c__Gen* g, v__ast__AnonFn* node); @@ -9638,8 +9206,6 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type VV_LOCAL_SYMBOL string v__gen__c__Gen_encode_map(v__gen__c__Gen* g, v__ast__Type key_type, v__ast__Type value_type); VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloading_declarations(v__gen__c__Gen* g); VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloader_code(v__gen__c__Gen* g); -string _const_v__gen__c__posix_hotcode_definitions_1; // a string literal, inited later -string _const_v__gen__c__windows_hotcode_definitions_1; // a string literal, inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_generate_hotcode_reloading_main_caller(v__gen__c__Gen* g); VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_match(v__gen__c__Gen* g, v__ast__MatchExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr(v__gen__c__Gen* g, v__ast__MatchExpr node); @@ -9671,18 +9237,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen* g, v__ast__StringInterLiteral node, int i); VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInterLiteral node, int i); VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal(v__gen__c__Gen* g, v__ast__StringInterLiteral node); -Array_string _const_v__gen__c__skip_struct_init; // inited later VV_LOCAL_SYMBOL void v__gen__c__Gen_struct_init(v__gen__c__Gen* g, v__ast__StructInit node); VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast__StructField field); VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_empty_struct(v__gen__c__Gen* g, v__gen__c__Type t); VV_LOCAL_SYMBOL v__ast__Type v__gen__c__Gen_unwrap_generic(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL v__gen__c__Type v__gen__c__Gen_unwrap(v__gen__c__Gen* g, v__ast__Type typ); -#define _const_v__scanner__single_quote '\'' -#define _const_v__scanner__double_quote '"' -rune _const_v__scanner__num_sep = '_'; // precomputed -#define _const_v__scanner__b_lf 10 -#define _const_v__scanner__b_cr 13 -#define _const_v__scanner__backslash '\\' _option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); void v__scanner__Scanner_free(v__scanner__Scanner* s); @@ -9732,12 +9291,9 @@ _option_void v__ast__walker__Inspector_visit(v__ast__walker__Inspector* i, v__as void v__ast__walker__inspect(v__ast__Node* node, voidptr data, bool (*inspector_callback)(v__ast__Node* node, voidptr data)); void v__ast__walker__walk(v__ast__walker__Visitor* visitor, v__ast__Node* node); VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_assign_stmt(v__parser__Parser* p); -#define _const_v__parser__max_expr_level 100 VV_LOCAL_SYMBOL _option_void v__parser__Parser_check_undefined_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val); VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val); 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); -Array_string _const_v__parser__supported_comptime_calls; // inited later -Array_string _const_v__parser__comptime_types; // inited later v__ast__ComptimeType v__parser__Parser_parse_comptime_type(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__HashStmt v__parser__Parser_hash(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__Parser* p); @@ -9780,7 +9336,6 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_is_used_import(v__parser__Parser* p, stri VV_LOCAL_SYMBOL void v__parser__Parser_register_used_import(v__parser__Parser* p, string alias); VV_LOCAL_SYMBOL void v__parser__Parser_register_auto_import(v__parser__Parser* p, string alias); VV_LOCAL_SYMBOL void v__parser__Parser_check_unused_imports(v__parser__Parser* p); -#define _const_v__parser__maximum_inline_sum_type_variants 3 v__ast__Type v__parser__Parser_parse_array_type(v__parser__Parser* p, v__token__Kind expecting); v__ast__Type v__parser__Parser_parse_map_type(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_chan_type(v__parser__Parser* p); @@ -9790,7 +9345,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name); v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut); v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p); -VV_LOCAL_SYMBOL int compare_14364895672131222426_string(string* a, string* b) { +VV_LOCAL_SYMBOL int compare_16311103228414776939_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -9801,7 +9356,6 @@ v__ast__Type v__parser__Parser_parse_any_type(v__parser__Parser* p, v__ast__Lang v__ast__Type v__parser__Parser_find_type_or_add_placeholder(v__parser__Parser* p, string name, v__ast__Language language); v__ast__Type v__parser__Parser_parse_generic_type(v__parser__Parser* p, string name); v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, string name); -Array_v__ast__File_ptr codegen_files; // global4 v__ast__Stmt v__parser__parse_stmt(string text, v__ast__Table* table, v__ast__Scope* scope); v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__Table* table, v__pref__Preferences* pref, v__ast__Scope* scope); v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* table, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref); @@ -9857,7 +9411,6 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Language language); VV_LOCAL_SYMBOL bool v__parser__Parser_is_typename(v__parser__Parser* p, v__token__Token t); VV_LOCAL_SYMBOL bool v__parser__Parser_is_generic_call(v__parser__Parser* p); -Array_v__token__Kind _const_v__parser__valid_tokens_inside_types; // inited later VV_LOCAL_SYMBOL bool v__parser__Parser_is_generic_cast(v__parser__Parser* p); v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p); VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser* p, v__ast__Expr left, bool is_gated); @@ -9897,7 +9450,6 @@ VV_LOCAL_SYMBOL v__ast__StructDecl v__parser__Parser_struct_decl(v__parser__Pars VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Parser* p, string typ_str, bool short_syntax); VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser__Parser* p); VV_LOCAL_SYMBOL void v__parser__State_update(v__parser__State* state, string line); -string _const_v__parser__tmpl_str_end; // a string literal, inited later VV_LOCAL_SYMBOL bool v__parser__is_html_open_tag(string name, string s); VV_LOCAL_SYMBOL string v__parser__insert_template_code(string fn_name, string tmpl_str_start, string line); string v__parser__Parser_compile_template_file(v__parser__Parser* p, string template_file, string fn_name); @@ -9922,9 +9474,6 @@ void v__builder__Builder_show_total_warns_and_errors_stats(v__builder__Builder* void v__builder__Builder_print_warnings_and_errors(v__builder__Builder* b); v__errors__Error v__builder__Builder_error_with_pos(v__builder__Builder* b, string s, string fpath, v__token__Pos pos); void v__builder__verror(string s); -string _const_v__builder__c_verror_message_marker; // a string literal, inited later -string _const_v__builder__c_error_info; // a string literal, inited later -string _const_v__builder__no_compiler_error; // a string literal, inited later _option_void v__builder__Builder_find_win_cc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_show_c_compiler_output(v__builder__Builder* v, os__Result res); VV_LOCAL_SYMBOL void v__builder__Builder_post_process_c_compiler_output(v__builder__Builder* v, os__Result res); @@ -9958,10 +9507,6 @@ void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods); void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files); VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list); -v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later -#define _const_v__builder__key_query_value 1 -#define _const_v__builder__key_wow64_32key 512 -#define _const_v__builder__key_enumerate_sub_keys 8 VV_LOCAL_SYMBOL _option_string v__builder__find_windows_kit_internal(v__builder__RegKey key, Array_string versions); VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__find_windows_kit_root(string target_arch); VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__find_windows_kit_root_by_reg(string target_arch); @@ -9982,7 +9527,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, 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) { +VV_LOCAL_SYMBOL int compare_7770354126342877024_string(string* a, string* b) { if (string__lt(*a, *b)) return -1; else return 1; } @@ -9994,8 +9539,6 @@ 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); void v__builder__cbuilder__build_c(v__builder__Builder* b, Array_string v_files, string out_file); -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); @@ -10254,6 +9797,508 @@ void v__ast__Param_free(v__ast__Param* it); // auto void Array_v__ast__Attr_free(Array_v__ast__Attr* it); // auto void v__ast__Attr_free(v__ast__Attr* it); // auto +// V global/const definitions: +string _const_math__bits__overflow_error; // a string literal, inited later +string _const_math__bits__divide_error; // a string literal, inited later +#define _const_strconv__digits 18 +#define _const_strconv__int_size 32 +#define _const_strconv__bias32 127 +#define _const_strconv__maxexp32 255 +#define _const_strconv__bias64 1023 +#define _const_strconv__maxexp64 2047 +#define _const_strconv__max_size_f64_char 32 +string _const_strconv__digit_pairs; // a string literal, inited later +string _const_strconv__base_digits; // a string literal, inited later +#define _const_strconv__pow5_num_bits_32 61 +#define _const_strconv__pow5_inv_num_bits_32 59 +#define _const_strconv__pow5_num_bits_64 121 +#define _const_strconv__pow5_inv_num_bits_64 122 +#define _const_symopt_undname 2 +#define _const_symopt_deferred_loads 4 +#define _const_symopt_no_cpp 8 +#define _const_symopt_load_lines 16 +#define _const_symopt_include_32bit_modules 8192 +#define _const_symopt_allow_zero_address 16777216 +#define _const_symopt_debug 2147483648 +string _const_digit_pairs; // a string literal, inited later +#define _const_hashbits 24 +#define _const_max_cached_hashbits 16 +#define _const_init_log_capicity 5 +#define _const_init_capicity 32 +#define _const_init_even_index 30 +#define _const_extra_metas_inc 4 +#define _const_prealloc_block_size 16777216 +#define _const_degree 6 +#define _const_mid_index 5 +#define _const_max_len 11 +string _const_si_s_code; // a string literal, inited later +string _const_si_g32_code; // a string literal, inited later +string _const_si_g64_code; // a string literal, inited later +#define _const_cp_utf8 65001 +#define _const_dl__version 1 +#define _const_dl__rtld_now 0 +#define _const_dl__rtld_lazy 0 +#define _const_v__token__max_keyword_len 20 +string _const_time__days_string; // a string literal, inited later +string _const_time__months_string; // a string literal, inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +#define _const_time__days_in_year 365 +#define _const_rand__constants__max_u32 4294967295 +string _const_flag__space; // a string literal, inited later +string _const_flag__underline; // a string literal, inited later +#define _const_flag__max_args_number 4048 +#define _const_semver__ver_major 0 +#define _const_semver__ver_minor 1 +#define _const_semver__ver_patch 2 +string _const_semver__comparator_sep; // a string literal, inited later +string _const_semver__comparator_set_sep; // a string literal, inited later +string _const_semver__hyphen_range_sep; // a string literal, inited later +string _const_semver__x_range_symbols; // a string literal, inited later +#define _const_sync__stdatomic__used 1 +#define _const_os__success 0 +#define _const_os__error_insufficient_buffer 130 +#define _const_os__handle_generic_read 2147483648 +#define _const_os__handle_open_existing 3 +#define _const_os__file_share_read 1 +#define _const_os__file_share_write 2 +#define _const_os__file_share_delete 4 +#define _const_os__file_notify_change_file_name 1 +#define _const_os__file_notify_change_dir_name 2 +#define _const_os__file_notify_change_attributes 4 +#define _const_os__file_notify_change_size 8 +#define _const_os__file_notify_change_last_write 16 +#define _const_os__file_notify_change_last_access 32 +#define _const_os__file_notify_change_creation 64 +#define _const_os__file_notify_change_security 128 +#define _const_os__file_action_added 1 +#define _const_os__file_action_removed 2 +#define _const_os__file_action_modified 3 +#define _const_os__file_action_renamed_old_name 4 +#define _const_os__file_action_renamed_new_name 5 +#define _const_os__file_attr_readonly 1 +#define _const_os__file_attr_hidden 2 +#define _const_os__file_attr_system 4 +#define _const_os__file_attr_directory 16 +#define _const_os__file_attr_archive 32 +#define _const_os__file_attr_device 64 +#define _const_os__file_attr_normal 128 +#define _const_os__file_attr_temporary 256 +#define _const_os__file_attr_sparse_file 512 +#define _const_os__file_attr_reparse_point 1024 +#define _const_os__file_attr_compressed 2048 +#define _const_os__file_attr_offline 4096 +#define _const_os__file_attr_not_content_indexed 8192 +#define _const_os__file_attr_encrypted 16384 +#define _const_os__file_attr_integrity_stream 32768 +#define _const_os__file_attr_virtual 65536 +#define _const_os__file_attr_no_scrub_data 131072 +#define _const_os__file_type_unknown 0 +#define _const_os__file_type_disk 1 +#define _const_os__file_type_char 2 +#define _const_os__file_type_pipe 3 +#define _const_os__file_invalid_file_id -1 +#define _const_os__enable_echo_input 4 +#define _const_os__enable_extended_flags 128 +#define _const_os__enable_insert_mode 32 +#define _const_os__enable_line_input 2 +#define _const_os__enable_mouse_input 16 +#define _const_os__enable_processed_input 1 +#define _const_os__enable_quick_edit_mode 64 +#define _const_os__enable_window_input 8 +#define _const_os__enable_virtual_terminal_input 512 +#define _const_os__enable_processed_output 1 +#define _const_os__enable_wrap_at_eol_output 2 +#define _const_os__enable_virtual_terminal_processing 4 +#define _const_os__disable_newline_auto_return 8 +#define _const_os__enable_lvb_grid_worldwide 16 +#define _const_os__o_rdonly 0 +#define _const_os__o_wronly 1 +#define _const_os__o_rdwr 2 +#define _const_os__o_append 8 +#define _const_os__o_create 256 +#define _const_os__o_binary 32768 +#define _const_os__o_trunc 512 +#define _const_os__o_excl 1024 +#define _const_os__o_sync 0 +#define _const_os__o_noctty 0 +#define _const_os__o_nonblock 0 +#define _const_os__status_access_violation 3221225477 +#define _const_os__status_in_page_error 3221225478 +#define _const_os__status_invalid_handle 3221225480 +#define _const_os__status_invalid_parameter 3221225485 +#define _const_os__status_no_memory 3221225495 +#define _const_os__status_illegal_instruction 3221225501 +#define _const_os__status_noncontinuable_exception 3221225509 +#define _const_os__status_invalid_disposition 3221225510 +#define _const_os__status_array_bounds_exceeded 3221225612 +#define _const_os__status_float_denormal_operand 3221225613 +#define _const_os__status_float_divide_by_zero 3221225614 +#define _const_os__status_float_inexact_result 3221225615 +#define _const_os__status_float_invalid_operation 3221225616 +#define _const_os__status_float_overflow 3221225617 +#define _const_os__status_float_stack_check 3221225618 +#define _const_os__status_float_underflow 3221225619 +#define _const_os__status_integer_divide_by_zero 3221225620 +#define _const_os__status_integer_overflow 3221225621 +#define _const_os__status_privileged_instruction 3221225622 +#define _const_os__status_stack_overflow 3221225725 +#define _const_os__status_dll_not_found 3221225781 +#define _const_os__status_ordinal_not_found 3221225784 +#define _const_os__status_entrypoint_not_found 3221225785 +#define _const_os__status_control_c_exit 3221225786 +#define _const_os__status_dll_init_failed 3221225794 +#define _const_os__status_float_multiple_faults 3221226164 +#define _const_os__status_float_multiple_traps 3221226165 +#define _const_os__status_reg_nat_consumption 3221226185 +#define _const_os__status_heap_corruption 3221226356 +#define _const_os__status_stack_buffer_overrun 3221226505 +#define _const_os__status_invalid_cruntime_parameter 3221226519 +#define _const_os__status_assertion_failure 3221226528 +#define _const_os__key_query_value 1 +#define _const_os__key_set_value 2 +#define _const_os__key_enumerate_sub_keys 8 +#define _const_os__key_wow64_32key 512 +#define _const_os__wm_settingchange 26 +#define _const_os__smto_abortifhung 2 +#define _const_os__bslash '\\' +string _const_os__fslash_str; // a string literal, inited later +string _const_os__dot_dot; // a string literal, inited later +string _const_os__empty_str; // a string literal, inited later +string _const_os__dot_str; // a string literal, inited later +#define _const_os__max_path_len 4096 +#define _const_os__f_ok 0 +#define _const_os__x_ok 1 +#define _const_os__w_ok 2 +#define _const_os__r_ok 4 +string _const_os__path_separator; // a string literal, inited later +string _const_os__path_delimiter; // a string literal, inited later +#define _const_os__format_message_allocate_buffer 256 +#define _const_os__format_message_argument_array 8192 +#define _const_os__format_message_from_hmodule 2048 +#define _const_os__format_message_from_string 1024 +#define _const_os__format_message_from_system 4096 +#define _const_os__format_message_ignore_inserts 512 +#define _const_os__sublang_neutral 0 +#define _const_os__sublang_default 1 +#define _const_os__lang_neutral 0 +#define _const_os__max_error_code 15841 +#define _const_term__default_columns_size 80 +#define _const_term__default_rows_size 25 +string _const_v__util__version__v_version; // a string literal, inited later +string _const_v__vmod__err_label; // a string literal, inited later +string _const_v__cflag__fexisting_literal; // a string literal, inited later +#define _const_rand__wyrand__seed_len 2 +string _const_v__pkgconfig__version; // a string literal, inited later +string _const_rand__ulid_encoding; // a string literal, inited later +string _const_rand__english_letters; // a string literal, inited later +string _const_rand__hex_chars; // a string literal, inited later +string _const_rand__ascii_chars; // a string literal, inited later +#define _const_sync__aops_used 1 +#define _const_sync__spinloops 750 +#define _const_sync__spinloops_sem 4000 +string _const_help__unknown_topic; // a string literal, inited later +#define _const_v__util__error_context_before 2 +#define _const_v__util__error_context_after 2 +#define _const_v__util__backslash 92 +#define _const_v__util__backslash_r 13 +#define _const_v__util__backslash_n 10 +#define _const_v__util__double_quote 34 +string _const_v__util__double_escape; // a string literal, inited later +string _const_v__util__map_prefix; // a string literal, inited later +#define _const_v__ast__invalid_type_idx -1 +#define _const_v__ast__void_type_idx 1 +#define _const_v__ast__voidptr_type_idx 2 +#define _const_v__ast__byteptr_type_idx 3 +#define _const_v__ast__charptr_type_idx 4 +#define _const_v__ast__i8_type_idx 5 +#define _const_v__ast__i16_type_idx 6 +#define _const_v__ast__int_type_idx 7 +#define _const_v__ast__i64_type_idx 8 +#define _const_v__ast__isize_type_idx 9 +#define _const_v__ast__byte_type_idx 10 +#define _const_v__ast__u16_type_idx 11 +#define _const_v__ast__u32_type_idx 12 +#define _const_v__ast__u64_type_idx 13 +#define _const_v__ast__usize_type_idx 14 +#define _const_v__ast__f32_type_idx 15 +#define _const_v__ast__f64_type_idx 16 +#define _const_v__ast__char_type_idx 17 +#define _const_v__ast__bool_type_idx 18 +#define _const_v__ast__none_type_idx 19 +#define _const_v__ast__string_type_idx 20 +#define _const_v__ast__rune_type_idx 21 +#define _const_v__ast__array_type_idx 22 +#define _const_v__ast__map_type_idx 23 +#define _const_v__ast__chan_type_idx 24 +#define _const_v__ast__any_type_idx 25 +#define _const_v__ast__float_literal_type_idx 26 +#define _const_v__ast__int_literal_type_idx 27 +#define _const_v__ast__thread_type_idx 28 +#define _const_v__ast__error_type_idx 29 +#define _const_v__checker__expr_level_cutoff_limit 40 +#define _const_v__checker__stmt_level_cutoff_limit 40 +#define _const_v__checker__iface_level_cutoff_limit 100 +string _const_v__checker__vroot_is_deprecated_message; // a string literal, inited later +string _const_v__checker__unicode_lit_overflow_message; // a string literal, inited later +string _const_v__gen__c__si_s_code; // a string literal, inited later +string _const_v__gen__c__result_name; // a string literal, inited later +string _const_v__gen__c__option_name; // a string literal, inited later +string _const_v__gen__c__c_commit_hash_default; // a string literal, inited later +string _const_v__gen__c__c_current_commit_hash_default; // a string literal, inited later +string _const_v__gen__c__c_concurrency_helpers; // a string literal, inited later +string _const_v__gen__c__c_common_macros; // a string literal, inited later +string _const_v__gen__c__c_unsigned_comparison_functions; // a string literal, inited later +string _const_v__gen__c__c_helper_macros; // a string literal, inited later +string _const_v__gen__c__c_headers; // str inited later +string _const_v__gen__c__c_builtin_types; // a string literal, inited later +string _const_v__gen__c__c_bare_headers; // str inited later +string _const_v__gen__c__c_wyhash_headers; // a string literal, inited later +string _const_v__gen__c__closure_ctx; // a string literal, inited later +string _const_v__gen__c__posix_hotcode_definitions_1; // a string literal, inited later +string _const_v__gen__c__windows_hotcode_definitions_1; // a string literal, inited later +#define _const_v__scanner__single_quote '\'' +#define _const_v__scanner__double_quote '"' +#define _const_v__scanner__b_lf 10 +#define _const_v__scanner__b_cr 13 +#define _const_v__scanner__backslash '\\' +#define _const_v__parser__max_expr_level 100 +#define _const_v__parser__maximum_inline_sum_type_variants 3 +string _const_v__parser__tmpl_str_end; // a string literal, inited later +string _const_v__builder__c_verror_message_marker; // a string literal, inited later +string _const_v__builder__c_error_info; // a string literal, inited later +string _const_v__builder__no_compiler_error; // a string literal, inited later +#define _const_v__builder__key_query_value 1 +#define _const_v__builder__key_wow64_32key 512 +#define _const_v__builder__key_enumerate_sub_keys 8 +u32 _const_math__bits__de_bruijn32 = 125613361; // precomputed +Array_u8 _const_math__bits__de_bruijn32tab; // inited later +u64 _const_math__bits__de_bruijn64 = 285870213051353865U; // precomputed +Array_u8 _const_math__bits__de_bruijn64tab; // inited later +u64 _const_math__bits__m0 = 6148914691236517205U; // precomputed +u64 _const_math__bits__m1 = 3689348814741910323U; // precomputed +u64 _const_math__bits__m2 = 1085102592571150095U; // precomputed +u64 _const_math__bits__m3 = 71777214294589695U; // precomputed +u64 _const_math__bits__m4 = 281470681808895U; // precomputed +u32 _const_math__bits__max_u32 = 4294967295; // precomputed +u64 _const_math__bits__max_u64 = 18446744073709551615U; // precomputed +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 +u64 _const_math__bits__two32 = 4294967296U; // precomputed +u64 _const_math__bits__mask32 = 4294967295U; // precomputed +Array_u8 _const_math__bits__ntz_8_tab; // inited later +Array_u8 _const_math__bits__pop_8_tab; // inited later +Array_u8 _const_math__bits__rev_8_tab; // inited later +Array_u8 _const_math__bits__len_8_tab; // inited later +u32 _const_strconv__single_plus_zero = 0; // precomputed +u32 _const_strconv__single_minus_zero = 2147483648; // precomputed +u32 _const_strconv__single_plus_infinity = 2139095040; // precomputed +u32 _const_strconv__single_minus_infinity = 4286578688; // precomputed +u64 _const_strconv__double_plus_zero = 0U; // precomputed +u64 _const_strconv__double_minus_zero = 9223372036854775808U; // precomputed +u64 _const_strconv__double_plus_infinity = 9218868437227405312U; // precomputed +u64 _const_strconv__double_minus_infinity = 18442240474082181120U; // precomputed +rune _const_strconv__c_dpoint = '.'; // precomputed +rune _const_strconv__c_plus = '+'; // precomputed +rune _const_strconv__c_minus = '-'; // precomputed +rune _const_strconv__c_zero = '0'; // precomputed +rune _const_strconv__c_nine = '9'; // precomputed +u32 _const_strconv__c_ten = 10; // precomputed +Array_u64 _const_strconv__pos_exp; // inited later +Array_u64 _const_strconv__neg_exp; // inited later +u64 _const_strconv__max_u64 = 18446744073709551615U; // precomputed +Array_u32 _const_strconv__ten_pow_table_32; // inited later +u32 _const_strconv__mantbits32 = 23; // precomputed +u32 _const_strconv__expbits32 = 8; // precomputed +Array_u64 _const_strconv__ten_pow_table_64; // inited later +u32 _const_strconv__mantbits64 = 52; // precomputed +u32 _const_strconv__expbits64 = 11; // precomputed +Array_f64 _const_strconv__dec_round; // inited later +Array_u64 _const_strconv__powers_of_10; // inited later +Array_u64 _const_strconv__pow5_split_32; // inited later +Array_u64 _const_strconv__pow5_inv_split_32; // inited later +Array_strconv__Uint128 _const_strconv__pow5_split_64; // inited later +Array_strconv__Uint128 _const_strconv__pow5_inv_split_64; // inited later +i64 total_m = ((i64)(0)); // global4 + +int g_main_argc = ((int)(0)); // global4 + +voidptr g_main_argv = ((voidptr)(0)); // global4 + +Array_VCastTypeIndexName as_cast_type_indexes; // global4 + +u32 g_original_codepage = ((u32)(0U)); // global4 + +f64 _const_max_load_factor = 0.8; // precomputed +u32 _const_hash_mask = 16777215; // precomputed +u32 _const_probe_inc = 16777216; // precomputed +IError _const_none__; // inited later +VMemoryBlock* g_memory_block; // global4 + +string _const_dl__dl_ext; // inited later +Array_v__token__Kind _const_v__token__assign_tokens; // inited later +Array_string _const_v__token__valid_at_tokens; // inited later +Array_string _const_v__token__token_str; // inited later +Map_string_v__token__Kind _const_v__token__keywords; // inited later +Array_v__token__Precedence _const_v__token__precedences; // inited later +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +Array_int _const_time__days_before; // inited later +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__infinite; // inited later +u64 _const_time__start_time; // inited later +u64 _const_time__freq_time; // inited later +i64 _const_time__start_local_time; // inited later +u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed +u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed +u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed +u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed +u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed +u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed +u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed +u32 _const_rand__constants__u31_mask = 2147483647; // precomputed +u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed +u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed +u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed +u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed +u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed +voidptr _const_os__invalid_handle_value; // inited later +voidptr _const_os__hkey_local_machine; // inited later +voidptr _const_os__hkey_current_user; // inited later +voidptr _const_os__hwnd_broadcast; // inited later +rune _const_os__fslash = '/'; // precomputed +rune _const_os__dot = '.'; // precomputed +rune _const_os__qmark = '?'; // precomputed +Array_string _const_os__args; // inited later +string _const_os__wd_at_startup; // inited later +Array_string _const_v__vmod__mod_file_stop_paths; // inited later +v__vmod__ModFileCacher* _const_v__vmod__private_file_cacher; // inited later +u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed +u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed +Array_string _const_v__pkgconfig__default_paths; // inited later +f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed +Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later +rand__PRNG* default_rng; // global4 + +Array_string _const_v__pref__list_of_flags_with_param; // inited later +v__util__EManager* _const_v__util__emanager; // inited later +string _const_v__util__normalised_workdir; // inited later +v__util__LinesCache* lines_cache; // global4 + +Array_u8 _const_v__util__invalid_escapes; // inited later +v__util__Timers* g_timers; // global4 + +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 +voidptr _const_sync__pool__no_result; // inited later +Map_int_Array_string _const_v__ast__x86_no_number_register_list; // inited later +Map_int_Map_string_int _const_v__ast__x86_with_number_register_list; // inited later +Array_string _const_v__ast__arm_no_number_register_list; // inited later +Map_string_int _const_v__ast__arm_with_number_register_list; // inited later +Array_string _const_v__ast__riscv_no_number_register_list; // inited later +Map_string_int _const_v__ast__riscv_with_number_register_list; // inited later +Array_string _const_v__ast__native_builtins; // inited later +v__ast__Table* global_table = ((v__ast__Table*)(0)); // global4 + +Array_string _const_v__ast__builtin_type_names; // inited later +v__ast__Type _const_v__ast__ovoid_type; // inited later +v__ast__Type _const_v__ast__rvoid_type; // inited later +int _const_v__checker__int_min; // inited later +int _const_v__checker__int_max = 2147483647; // precomputed +Array_string _const_v__checker__valid_comptime_if_os; // inited later +Array_string _const_v__checker__valid_comptime_compression_types; // inited later +Array_string _const_v__checker__valid_comptime_if_compilers; // inited later +Array_string _const_v__checker__valid_comptime_if_platforms; // inited later +Array_string _const_v__checker__valid_comptime_if_cpu_features; // inited later +Array_string _const_v__checker__valid_comptime_if_other; // inited later +Array_string _const_v__checker__array_builtin_methods; // inited later +Array_string _const_v__checker__reserved_type_names; // inited later +IError _const_v__gen__c__unsupported_ctemp_assert_transform; // inited later +Array_string _const_v__gen__c__c_reserved; // inited later +Array_string _const_v__gen__c__cmp_str; // inited later +Array_string _const_v__gen__c__cmp_rev; // inited later +Array_string _const_v__gen__c__skip_struct_init; // inited later +rune _const_v__scanner__num_sep = '_'; // precomputed +Array_string _const_v__parser__supported_comptime_calls; // inited later +Array_string _const_v__parser__comptime_types; // inited later +Array_v__ast__File_ptr codegen_files; // global4 + +Array_v__token__Kind _const_v__parser__valid_tokens_inside_types; // inited later +v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later +Array_string _const_main__external_tools; // inited later +Array_string _const_main__list_of_flags_that_allow_duplicates; // inited later +u32 _const_children_bytes; // inited later +v__token__KeywordsMatcher _const_v__token__matcher; // inited later +time__Duration _const_time__microsecond; // inited later +f32 _const_rand__constants__max_u32_as_f32; // inited later +f64 _const_rand__constants__max_u64_as_f64; // inited later +Array_int _const_semver__versions; // inited later +string _const_v__pref__default_module_path; // inited later +v__ast__TypeSymbol* _const_v__ast__invalid_type_symbol; // inited later +v__token__KeywordsMatcher _const_v__ast__builtin_type_names_matcher; // inited later +Array_int _const_v__ast__integer_type_idxs; // inited later +Array_int _const_v__ast__signed_integer_type_idxs; // inited later +Array_int _const_v__ast__unsigned_integer_type_idxs; // inited later +Array_int _const_v__ast__int_promoted_type_idxs; // inited later +Array_int _const_v__ast__float_type_idxs; // inited later +Array_int _const_v__ast__number_type_idxs; // inited later +Array_int _const_v__ast__pointer_type_idxs; // inited later +Array_int _const_v__ast__string_type_idxs; // inited later +v__ast__Type _const_v__ast__void_type; // inited later +v__ast__Type _const_v__ast__voidptr_type; // inited later +v__ast__Type _const_v__ast__byteptr_type; // inited later +v__ast__Type _const_v__ast__charptr_type; // inited later +v__ast__Type _const_v__ast__i8_type; // inited later +v__ast__Type _const_v__ast__int_type; // inited later +v__ast__Type _const_v__ast__i16_type; // inited later +v__ast__Type _const_v__ast__i64_type; // inited later +v__ast__Type _const_v__ast__isize_type; // inited later +v__ast__Type _const_v__ast__byte_type; // inited later +v__ast__Type _const_v__ast__u16_type; // inited later +v__ast__Type _const_v__ast__u32_type; // inited later +v__ast__Type _const_v__ast__u64_type; // inited later +v__ast__Type _const_v__ast__usize_type; // inited later +v__ast__Type _const_v__ast__f32_type; // inited later +v__ast__Type _const_v__ast__f64_type; // inited later +v__ast__Type _const_v__ast__char_type; // inited later +v__ast__Type _const_v__ast__bool_type; // inited later +v__ast__Type _const_v__ast__none_type; // inited later +v__ast__Type _const_v__ast__string_type; // inited later +v__ast__Type _const_v__ast__rune_type; // inited later +v__ast__Type _const_v__ast__array_type; // inited later +v__ast__Type _const_v__ast__map_type; // inited later +v__ast__Type _const_v__ast__chan_type; // inited later +v__ast__Type _const_v__ast__any_type; // inited later +v__ast__Type _const_v__ast__float_literal_type; // inited later +v__ast__Type _const_v__ast__int_literal_type; // inited later +v__ast__Type _const_v__ast__thread_type; // inited later +v__ast__Type _const_v__ast__error_type; // inited later +Array_string _const_v__checker__valid_comptime_not_user_defined; // inited later +Map_string_bool _const_v__gen__c__c_reserved_map; // inited later +Array_string _const_v__gen__c__builtins; // inited later +time__Duration _const_time__millisecond; // inited later +Array_v__ast__Type _const_v__ast__charptr_types; // inited later +Array_v__ast__Type _const_v__ast__byteptr_types; // inited later +Array_v__ast__Type _const_v__ast__voidptr_types; // inited later +time__Duration _const_time__second; // inited later +Array_v__ast__Type _const_v__ast__cptr_types; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later + // V interface table: static IError I_None___to_Interface_IError(None__* x); const int _IError_None___index = 0; @@ -10723,67 +10768,6 @@ static inline void __sort_ptr(uintptr_t a[], bool b[], int l) { } } -// V stringliterals: - -// >> string literal consts -void vinit_string_literals(void){ - _const_math__bits__overflow_error = _SLIT("Overflow Error"); - _const_math__bits__divide_error = _SLIT("Divide Error"); - _const_strconv__digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); - _const_strconv__base_digits = _SLIT("0123456789abcdefghijklmnopqrstuvwxyz"); - _const_digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); - _const_si_s_code = _SLIT("0xfe10"); - _const_si_g32_code = _SLIT("0xfe0e"); - _const_si_g64_code = _SLIT("0xfe0f"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); - _const_flag__space = _SLIT(" "); - _const_flag__underline = _SLIT("-----------------------------------------------"); - _const_semver__comparator_sep = _SLIT(" "); - _const_semver__comparator_set_sep = _SLIT(" || "); - _const_semver__hyphen_range_sep = _SLIT(" - "); - _const_semver__x_range_symbols = _SLIT("Xx*"); - _const_os__fslash_str = _SLIT("/"); - _const_os__dot_dot = _SLIT(".."); - _const_os__empty_str = _SLIT(""); - _const_os__dot_str = _SLIT("."); - _const_os__path_separator = _SLIT("\\"); - _const_os__path_delimiter = _SLIT(";"); - _const_v__util__version__v_version = _SLIT("0.2.4"); - _const_v__vmod__err_label = _SLIT("vmod:"); - _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); - _const_v__pkgconfig__version = _SLIT("0.3.2"); - _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); - _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); - _const_rand__hex_chars = _SLIT("abcdef0123456789"); - _const_rand__ascii_chars = _SLIT("!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~"); - _const_help__unknown_topic = _SLIT("`v help`: unknown help topic provided. Use `v help` for usage information."); - _const_v__util__double_escape = _SLIT("\\\\"); - _const_v__util__map_prefix = _SLIT("map[string]"); - _const_v__checker__vroot_is_deprecated_message = _SLIT("@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead"); - _const_v__checker__unicode_lit_overflow_message = _SLIT("unicode character exceeds max allowed value of 0x10ffff, consider using a unicode literal (\\u####)"); - _const_v__gen__c__si_s_code = _SLIT("0xfe10"); - _const_v__gen__c__result_name = _SLIT("_result"); - _const_v__gen__c__option_name = _SLIT("_option"); - _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); - _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); - _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); - _const_v__gen__c__c_common_macros = _SLIT("\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\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n\011#define __V_arm32 1\n\011#undef __V_architecture\n\011#define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n\011#define __V_x86 1\n\011#undef __V_architecture\n\011#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\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#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\011#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\011#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\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#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\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n\011#if defined(__MINGW32__) || defined(__MINGW64__)\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); - _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\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"); - _const_v__gen__c__c_helper_macros = _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"); - _const_v__gen__c__c_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\n"); - _const_v__gen__c__c_wyhash_headers = _SLIT("\n// ============== wyhash ==============\n#ifndef wyhash_final_version_3\n#define wyhash_final_version_3\n\n#ifndef WYHASH_CONDOM\n// protections that produce different results:\n// 1: normal valid behavior\n// 2: extra protection against entropy loss (probability=2^-63), aka. \"blind multiplication\"\n#define WYHASH_CONDOM 1\n#endif\n\n#ifndef WYHASH_32BIT_MUM\n// 0: normal version, slow on 32 bit systems\n// 1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function\n#define WYHASH_32BIT_MUM 0\n#endif\n\n// includes\n#include \n#if defined(_MSC_VER) && defined(_M_X64)\n\011#include \n\011#pragma intrinsic(_umul128)\n#endif\n\n// 128bit multiply function\nstatic inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); }\nstatic inline void _wymum(uint64_t *A, uint64_t *B){\n#if(WYHASH_32BIT_MUM)\n\011uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll;\n\011#else\n\011*A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll;\n\011#endif\n#elif defined(__SIZEOF_INT128__) && !defined(VWASM)\n\011__uint128_t r=*A; r*=*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=(uint64_t)r; *B^=(uint64_t)(r>>64);\n\011#else\n\011*A=(uint64_t)r; *B=(uint64_t)(r>>64);\n\011#endif\n#elif defined(_MSC_VER) && defined(_M_X64)\n\011#if(WYHASH_CONDOM>1)\n\011uint64_t a, b;\n\011a=_umul128(*A,*B,&b);\n\011*A^=a; *B^=b;\n\011#else\n\011*A=_umul128(*A,*B,B);\n\011#endif\n#else\n\011uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo;\n\011uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t>32)+(rm1>>32)+c;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=lo; *B^=hi;\n\011#else\n\011*A=lo; *B=hi;\n\011#endif\n#endif\n}\n\n// multiply and xor mix function, aka MUM\nstatic inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; }\n\n// endian macros\n#ifndef WYHASH_LITTLE_ENDIAN\n\011#ifdef TARGET_ORDER_IS_LITTLE\n\011\011#define WYHASH_LITTLE_ENDIAN 1\n\011#else\n\011\011#define WYHASH_LITTLE_ENDIAN 0\n\011#endif\n#endif\n\n// read functions\n#if (WYHASH_LITTLE_ENDIAN)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;}\n#elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);}\n#elif defined(_MSC_VER)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);}\n#else\n\011static inline uint64_t _wyr8(const uint8_t *p) {\n\011\011uint64_t v; memcpy(&v, p, 8);\n\011\011return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000));\n\011}\n\011static inline uint64_t _wyr4(const uint8_t *p) {\n\011\011uint32_t v; memcpy(&v, p, 4);\n\011\011return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000));\n\011}\n#endif\nstatic inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];}\n// wyhash main function\nstatic inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){\n\011const uint8_t *p=(const uint8_t *)key; seed^=*secret;\011uint64_t a, b;\n\011if (_likely_(len<=16)) {\n\011\011if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); }\n\011\011else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; }\n\011\011else a=b=0;\n\011} else {\n\011\011size_t i=len;\n\011\011if (_unlikely_(i>48)) {\n\011\011\011uint64_t see1=seed, see2=seed;\n\011\011\011do {\n\011\011\011\011seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed);\n\011\011\011\011see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1);\n\011\011\011\011see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2);\n\011\011\011\011p+=48; i-=48;\n\011\011\011} while(_likely_(i>48));\n\011\011\011seed^=see1^see2;\n\011\011}\n\011\011while(_unlikely_(i>16)) { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; }\n\011\011a=_wyr8(p+i-16); b=_wyr8(p+i-8);\n\011}\n\011return _wymix(secret[1]^len,_wymix(a^secret[1],b^seed));\n}\n// the default secret parameters\nstatic const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};\n\n// a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand\nstatic inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642full; B^=0xe7037ed1a0b428dbull; _wymum(&A,&B); return _wymix(A^0xa0761d6478bd642full,B^0xe7037ed1a0b428dbull);}\n\n// the wyrand PRNG that pass BigCrush and PractRand\nstatic inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}\n\n#ifndef __vinix__\n// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;}\n\n// convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;}\n#endif\n\n#if(!WYHASH_32BIT_MUM)\n// fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; }\n#endif\n#endif\n\n#define _IN_MAP(val, m) map_exists(m, val)\n\n"); - _const_v__gen__c__closure_ctx = _SLIT("_V_closure_ctx"); - _const_v__gen__c__posix_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); - _const_v__gen__c__windows_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); - _const_v__parser__tmpl_str_end = _SLIT("')\n"); - _const_v__builder__c_verror_message_marker = _SLIT("VERROR_MESSAGE "); - _const_v__builder__c_error_info = _SLIT("\n==================\nC error. This should never happen.\n\nThis is a compiler bug, please report it using `v bug file.v`.\n\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use #help on Discord: https://discord.gg/vlang\n"); - _const_v__builder__no_compiler_error = _SLIT("\n==================\nError: no C compiler detected.\n\nYou can find instructions on how to install one in the V wiki:\nhttps://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows\n\nIf you think you have one installed, make sure it is in your PATH.\nIf you do have one in your PATH, please raise an issue on GitHub:\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use `v doctor`, to see what V knows about your current environment.\n\nYou can also seek #help on Discord: https://discord.gg/vlang\n"); -} -// << string literal consts - - // V auto str functions: static string time__FormatTime_str(time__FormatTime it) { /* gen_str_for_enum */ switch(it) { @@ -10841,7 +10825,7 @@ static string indent_Array_v__ast__Expr_str(Array_v__ast__Expr a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Expr it = *(v__ast__Expr*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Expr_str( it); + string x = v__ast__Expr_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -10888,7 +10872,7 @@ static string indent_Array_v__ast__Attr_str(Array_v__ast__Attr a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Attr it = *(v__ast__Attr*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Attr_str( & it); + string x = v__ast__Attr_str(&it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -10945,7 +10929,7 @@ static string indent_Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a, int inde for (int i = 0; i < a.len; ++i) { v__cflag__CFlag it = *(v__cflag__CFlag*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__cflag__CFlag_str( & it); + string x = v__cflag__CFlag_str(&it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -10964,7 +10948,7 @@ static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int inde for (int i = 0; i < a.len; ++i) { v__ast__CallArg it = *(v__ast__CallArg*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__CallArg_str( it); + string x = v__ast__CallArg_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -10982,7 +10966,7 @@ static string indent_Array_v__ast__Type_str(Array_v__ast__Type a, int indent_cou for (int i = 0; i < a.len; ++i) { int it = *(int*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = int_str( it); + string x = int_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11048,7 +11032,7 @@ static string indent_Array_v__ast__Stmt_str(Array_v__ast__Stmt a, int indent_cou for (int i = 0; i < a.len; ++i) { v__ast__Stmt it = *(v__ast__Stmt*)array_get(a, i); strings__Builder_write_string(&sb, _SLIT("")); - string x = v__ast__Stmt_str( it); + string x = v__ast__Stmt_str(it); strings__Builder_write_string(&sb, x); if (i < a.len-1) { strings__Builder_write_string(&sb, _SLIT(", ")); @@ -11264,30 +11248,32 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); string _t18 = indent_Array_v__ast__Param_str(it.params, indent_count + 1); string _t19 = Array_string_str(it.generic_names); - string _t20 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t21 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t22 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); - string _t23 = v__ast__Type_str(it.return_type); - string _t24 = v__ast__Type_str(it.receiver_type); - string _t25 = v__ast__Language_str(it.language); - string _t26 = v__ast__Language_str(it.file_mode); - string res = str_intp( 115, _MOV((StrIntpData[]){ + string _t20 = Array_string_str(it.dep_names); + string _t21 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t22 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t23 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); + string _t24 = v__ast__Type_str(it.return_type); + string _t25 = v__ast__Type_str(it.receiver_type); + string _t26 = v__ast__Language_str(it.language); + string _t27 = v__ast__Language_str(it.file_mode); + string res = str_intp( 119, _MOV((StrIntpData[]){ {_SLIT("v.ast.Fn{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" params: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t18}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t19}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" dep_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t21}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" mod: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.mod}}, {_SLIT("'"), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.file}}, {_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=_t21}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" usages: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.usages}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" ctdefine_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.ctdefine_idx}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" source_fn: "), 0, {.d_c=0}}, {_SLIT(""), 17, {.d_p=(voidptr) it.source_fn}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t27}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_variadic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_variadic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_pub: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_pub ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_ctor_new: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_ctor_new ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11303,6 +11289,7 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_conditional: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_conditional ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t27); string_free(&_t26); string_free(&_t25); string_free(&_t24); @@ -11333,128 +11320,113 @@ static string indent_v__token__Pos_str(v__token__Pos it, int indent_count) { static string indent_v__ast__OrExpr_str(v__ast__OrExpr it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t27 = indent_Array_v__ast__Stmt_str(it.stmts, indent_count + 1); - string _t28 = v__ast__OrKind_str(it.kind); - string _t29 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t28 = indent_Array_v__ast__Stmt_str(it.stmts, indent_count + 1); + string _t29 = v__ast__OrKind_str(it.kind); + string _t30 = indent_v__token__Pos_str(it.pos, indent_count + 1); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.OrExpr{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" stmts: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t27}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" kind: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t28}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t29}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" stmts: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t28}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" kind: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t29}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t30}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t30); string_free(&_t29); string_free(&_t28); - string_free(&_t27); string_free(&indents); return res; } static string indent_v__ast__Aggregate_str(v__ast__Aggregate it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t30 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t31 = v__ast__Type_str(it.sum_type); - string _t32 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t31 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t32 = v__ast__Type_str(it.sum_type); + string _t33 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.Aggregate{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t30}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" sum_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t31}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t32}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t31}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" sum_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t32}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t33}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t33); string_free(&_t32); string_free(&_t31); - string_free(&_t30); string_free(&indents); return res; } static string indent_v__ast__Alias_str(v__ast__Alias it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t33 = v__ast__Type_str(it.parent_type); - string _t34 = v__ast__Language_str(it.language); + string _t34 = v__ast__Type_str(it.parent_type); + string _t35 = v__ast__Language_str(it.language); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.Alias{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t33}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t34}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t34}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t35}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_import: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_import ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t35); string_free(&_t34); - string_free(&_t33); string_free(&indents); return res; } static string indent_v__ast__Array_str(v__ast__Array it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t35 = v__ast__Type_str(it.elem_type); + string _t36 = v__ast__Type_str(it.elem_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Array{\n"), 0, {.d_c=0}}, {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" nr_dims: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.nr_dims}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t35}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t36}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t35); + string_free(&_t36); string_free(&indents); return res; } static string indent_v__ast__ArrayFixed_str(v__ast__ArrayFixed it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t36 = v__ast__Expr_str(it.size_expr); - string _t37 = v__ast__Type_str(it.elem_type); + string _t37 = v__ast__Expr_str(it.size_expr); + string _t38 = v__ast__Type_str(it.elem_type); string res = str_intp( 15, _MOV((StrIntpData[]){ {_SLIT("v.ast.ArrayFixed{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t36}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t37}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" size: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.size}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t37}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t38); string_free(&_t37); - string_free(&_t36); string_free(&indents); return res; } static string indent_v__ast__Chan_str(v__ast__Chan it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t38 = v__ast__Type_str(it.elem_type); + string _t39 = v__ast__Type_str(it.elem_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Chan{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" elem_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t39}}, {_SLIT(""), 0, {.d_c=0}}, {_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("}"), 0, {.d_c=0}}, })); - string_free(&_t38); - string_free(&indents); - return res; -} - -static string indent_v__ast__Enum_str(v__ast__Enum it, int indent_count) { - string indents = string_repeat(_SLIT(" "), indent_count); - string _t39 = Array_string_str(it.vals); - string res = str_intp( 19, _MOV((StrIntpData[]){ - {_SLIT("v.ast.Enum{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" vals: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t39}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_flag: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_flag ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi_allowed: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi_allowed ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" uses_exprs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.uses_exprs ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, - })); string_free(&_t39); string_free(&indents); return res; } -static string indent_v__ast__FnType_str(v__ast__FnType it, int indent_count) { +static string indent_v__ast__Enum_str(v__ast__Enum it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t40 = indent_v__ast__Fn_str(it.func, indent_count + 1); - string res = str_intp( 15, _MOV((StrIntpData[]){ - {_SLIT("v.ast.FnType{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_decl: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_decl ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" func: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t40}}, {_SLIT(""), 0, {.d_c=0}}, + string _t40 = Array_string_str(it.vals); + string res = str_intp( 19, _MOV((StrIntpData[]){ + {_SLIT("v.ast.Enum{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" vals: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t40}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_flag: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_flag ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi_allowed: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi_allowed ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" uses_exprs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.uses_exprs ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t40); @@ -11462,13 +11434,14 @@ static string indent_v__ast__FnType_str(v__ast__FnType it, int indent_count) { return res; } -static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_count) { +static string indent_v__ast__FnType_str(v__ast__FnType it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t41 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string res = str_intp( 11, _MOV((StrIntpData[]){ - {_SLIT("v.ast.GenericInst{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.parent_idx}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t41}}, {_SLIT(""), 0, {.d_c=0}}, + string _t41 = indent_v__ast__Fn_str(it.func, indent_count + 1); + string res = str_intp( 15, _MOV((StrIntpData[]){ + {_SLIT("v.ast.FnType{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_decl: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_decl ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" func: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t41}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t41); @@ -11476,29 +11449,44 @@ static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_ return res; } +static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_count) { + string indents = string_repeat(_SLIT(" "), indent_count); + string _t42 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string res = str_intp( 11, _MOV((StrIntpData[]){ + {_SLIT("v.ast.GenericInst{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" parent_idx: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.parent_idx}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t42}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, + })); + string_free(&_t42); + string_free(&indents); + return res; +} + static string indent_v__ast__Interface_str(v__ast__Interface it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t42 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); - string _t43 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); - string _t44 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t45 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); - string _t46 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); - string _t47 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t48 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t49 = v__ast__Type_str(it.parent_type); + string _t43 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t44 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t45 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t46 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); + string _t47 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); + string _t48 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t49 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t50 = v__ast__Type_str(it.parent_type); string res = str_intp( 39, _MOV((StrIntpData[]){ {_SLIT("v.ast.Interface{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t42}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t43}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t44}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t45}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t46}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t49}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t43}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t44}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t45}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t46}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t49}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t50}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t50); string_free(&_t49); string_free(&_t48); string_free(&_t47); @@ -11506,56 +11494,55 @@ static string indent_v__ast__Interface_str(v__ast__Interface it, int indent_coun string_free(&_t45); string_free(&_t44); string_free(&_t43); - string_free(&_t42); string_free(&indents); return res; } static string indent_v__ast__Map_str(v__ast__Map it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t50 = v__ast__Type_str(it.key_type); - string _t51 = v__ast__Type_str(it.value_type); + string _t51 = v__ast__Type_str(it.key_type); + string _t52 = v__ast__Type_str(it.value_type); string res = str_intp( 11, _MOV((StrIntpData[]){ {_SLIT("v.ast.Map{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" key_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t50}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" value_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t51}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" key_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t51}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" value_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t52}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t52); string_free(&_t51); - string_free(&_t50); string_free(&indents); return res; } static string indent_v__ast__MultiReturn_str(v__ast__MultiReturn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t52 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t53 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); string res = str_intp( 7, _MOV((StrIntpData[]){ {_SLIT("v.ast.MultiReturn{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t52}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t53}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); - string_free(&_t52); + string_free(&_t53); string_free(&indents); return res; } static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t53 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t54 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); - string _t55 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t56 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t57 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t58 = v__ast__Type_str(it.parent_type); + string _t54 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t55 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); + string _t56 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t57 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t58 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t59 = v__ast__Type_str(it.parent_type); string res = str_intp( 47, _MOV((StrIntpData[]){ {_SLIT("v.ast.Struct{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t53}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t54}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t55}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t57}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t58}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t54}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t55}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t57}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t58}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t59}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_typedef: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_typedef ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_union: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_union ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_heap: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_heap ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, @@ -11563,66 +11550,50 @@ static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t59); string_free(&_t58); string_free(&_t57); string_free(&_t56); string_free(&_t55); string_free(&_t54); - string_free(&_t53); string_free(&indents); return res; } static string indent_v__ast__SumType_str(v__ast__SumType it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t59 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); - string _t60 = indent_Array_v__ast__Type_str(it.variants, indent_count + 1); - string _t61 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); - string _t62 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t63 = v__ast__Type_str(it.parent_type); + string _t60 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t61 = indent_Array_v__ast__Type_str(it.variants, indent_count + 1); + string _t62 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); + string _t63 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t64 = v__ast__Type_str(it.parent_type); string res = str_intp( 35, _MOV((StrIntpData[]){ {_SLIT("v.ast.SumType{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t59}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t60}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t61}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t62}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t63}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t60}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t61}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t62}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t63}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" found_fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.found_fields ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_anon: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_anon ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_generic: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_generic ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t64); string_free(&_t63); string_free(&_t62); string_free(&_t61); string_free(&_t60); - string_free(&_t59); string_free(&indents); return res; } static string indent_v__ast__Thread_str(v__ast__Thread it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t64 = v__ast__Type_str(it.return_type); + string _t65 = v__ast__Type_str(it.return_type); string res = str_intp( 7, _MOV((StrIntpData[]){ {_SLIT("v.ast.Thread{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, - })); - string_free(&_t64); - string_free(&indents); - return res; -} - -static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count) { - string indents = string_repeat(_SLIT(" "), indent_count); - string _t65 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string res = str_intp( 19, _MOV((StrIntpData[]){ - {_SLIT("v.ast.Comment{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" text: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.text}}, {_SLIT("'"), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_inline: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_inline ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t65); @@ -11630,52 +11601,68 @@ static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count) { return res; } -static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { +static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); string _t66 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t67 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t68 = v__ast__Type_str(it.typ); + string res = str_intp( 19, _MOV((StrIntpData[]){ + {_SLIT("v.ast.Comment{\n"), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" text: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.text}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_multi: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_multi ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_inline: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_inline ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t66}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, + })); + string_free(&_t66); + string_free(&indents); + return res; +} + +static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { + string indents = string_repeat(_SLIT(" "), indent_count); + string _t67 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t68 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); + string _t69 = v__ast__Type_str(it.typ); string res = str_intp( 31, _MOV((StrIntpData[]){ {_SLIT("v.ast.Param{\n"), 0, {.d_c=0}}, {_SLIT0, 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=_t66}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t67}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t67}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t69}}, {_SLIT(""), 0, {.d_c=0}}, {_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_auto_rec: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_auto_rec ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_hidden: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_hidden ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); + string_free(&_t69); string_free(&_t68); string_free(&_t67); - string_free(&_t66); string_free(&indents); return res; } static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t69 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); - string _t70 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t71 = v__ast__Expr_str(it.default_expr); - string _t72 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t73 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t74 = v__ast__Type_str(it.default_expr_typ); - string _t75 = v__ast__Type_str(it.typ); + string _t70 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t71 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t72 = v__ast__Expr_str(it.default_expr); + string _t73 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t74 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); + string _t75 = v__ast__Type_str(it.default_expr_typ); + string _t76 = v__ast__Type_str(it.typ); 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=_t69}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_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=_t71}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_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=_t72}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t74}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" i: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.i}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr_typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t74}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t75}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr_typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t75}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t76}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" has_default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.has_default_expr ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_pub: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_pub ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_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}}, @@ -11684,13 +11671,13 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ {_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(&_t76); string_free(&_t75); string_free(&_t74); string_free(&_t73); string_free(&_t72); string_free(&_t71); string_free(&_t70); - string_free(&_t69); string_free(&indents); return res; } @@ -13598,6 +13585,7 @@ static bool v__ast__ParExpr_struct_eq(v__ast__ParExpr a, v__ast__ParExpr b) { 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) + && a.is_c2v_prefix == b.is_c2v_prefix && v__ast__Expr_sumtype_eq(a.expr, b.expr) && string__eq(a.auto_locked, b.auto_locked); } @@ -14552,6 +14540,7 @@ void Array_v__ast__Attr_free(Array_v__ast__Attr* it) { void v__ast__Fn_free(v__ast__Fn* it) { Array_v__ast__Param_free(&(it->params)); Array_string_free(&(it->generic_names)); + Array_string_free(&(it->dep_names)); Array_v__ast__Attr_free(&(it->attrs)); string_free(&(it->mod)); string_free(&(it->file)); @@ -14574,7 +14563,7 @@ void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) { string_free(&(it->mod)); } -VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void) { +VV_LOCAL_SYMBOL void anon_fn_6b7dbc3eb6b094a7__82(void) { println(_SLIT("}")); } @@ -14605,15 +14594,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 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_flag__UnkownFlagError_index) return 66137; + if (sidx == _IError_flag__ArgsCountError_index) return 66138; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66149; + if (sidx == _IError_semver__EmptyInputError_index) return 66151; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66152; 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; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 544; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -15025,21 +15014,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 538; + return 539; } 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 539; + return 540; } 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 540; + return 541; } 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"; @@ -15048,9 +15037,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 573; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66067; - return 571; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 576; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66068; + return 574; } // << typeof() support for sum types @@ -19104,6 +19093,9 @@ VV_LOCAL_SYMBOL void array_push(array* a, voidptr val) { // Attr: [unsafe] void array_push_many(array* a3, voidptr val, int size) { + if (size <= 0 || isnil(val)) { + return; + } array_ensure_cap(a3, a3->len + size); if (a3->data == val && a3->data != 0) { array copy = array_clone(a3); @@ -19619,6 +19611,34 @@ u8* malloc_noscan(isize n) { return res; } +// Attr: [unsafe] +u8* malloc_uncollectable(isize n) { + if (n <= 0) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("malloc_uncollectable("), /*100 &isize*/0xfe09, {.d_i64 = n}}, {_SLIT(" <= 0)"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + u8* res = ((u8*)(0)); + #if defined(_VPREALLOC) + { + } + #elif defined(_VGCBOEHM) + { + } + #elif defined(_VFREESTANDING) + { + } + #else + { + res = malloc(n); + } + #endif + if (res == 0) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("malloc_uncollectable("), /*100 &isize*/0xfe09, {.d_i64 = n}}, {_SLIT(") failed"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + return res; +} + // Attr: [unsafe] u8* v_realloc(u8* b, isize n) { u8* new_ptr = ((u8*)(0)); @@ -19733,6 +19753,18 @@ voidptr memdup_noscan(voidptr src, int sz) { return 0; } +// Attr: [unsafe] +voidptr memdup_uncollectable(voidptr src, int sz) { + if (sz == 0) { + return vcalloc(1); + } + { // Unsafe block + u8* mem = malloc_uncollectable(sz); + return memcpy(mem, src, sz); + } + return 0; +} + // Attr: [inline] inline VV_LOCAL_SYMBOL int v_fixed_index(int i, int len) { #if !defined(CUSTOM_DEFINE_no_bounds_checking) @@ -22288,7 +22320,7 @@ string string_replace_each(string s, Array_string vals) { if (idxs.len == 0) { return string_clone(s); } - qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_3079424758118292824_RepIndex_by_idx); + qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_5406533740619829871_RepIndex_by_idx); u8* b = malloc_noscan(new_len + 1); int idx_pos = 0; RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos]; @@ -25016,7 +25048,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_st } for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_11195941112940057302_v__token__WIndex_by_word); } } v__token__KeywordsMatcher _t4 = km; @@ -25043,7 +25075,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw } for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_11195941112940057302_v__token__WIndex_by_word); } } v__token__KeywordsMatcher _t4 = km; @@ -27883,7 +27915,7 @@ VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 se void v__dotgraph__start_digraph(void) { println(_SLIT("digraph G {")); - atexit((voidptr) anon_fn_6b9593b3d6ef610a__82); + atexit((voidptr) anon_fn_6b7dbc3eb6b094a7__82); } v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { @@ -31476,7 +31508,7 @@ _option_Array_string os__glob(Array_string patterns) { ; } - qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3677745349018262865_string); + qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_5811885252942183168_string); _option_Array_string _t4; opt_ok2(&(Array_string[]) { matches }, (_option*)(&_t4), sizeof(Array_string)); return _t4; @@ -33401,7 +33433,6 @@ void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, string dep = ((string*)deps.data)[_t1]; if (!Array_string_contains(d, dep)) { array_push((array*)&d, _MOV((string[]){ string_clone(dep) })); - } else { } } v__depgraph__OrderedDepMap_set(o, name, d); @@ -33458,13 +33489,20 @@ int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o) { } v__depgraph__DepGraph* v__depgraph__new_dep_graph(void) { - v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),}, sizeof(v__depgraph__DepGraph))); + v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),.values = new_map(sizeof(string), sizeof(i64), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__depgraph__DepGraph))); return _t1; } void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps) { - v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.deps = array_clone_to_depth(&deps, 0),}); + v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.value = 0,.deps = array_clone_to_depth(&deps, 0),}); array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); + map_set(&graph->values, &(string[]){mod}, &(i64[]) { 0 }); +} + +void v__depgraph__DepGraph_add_with_value(v__depgraph__DepGraph* graph, string mod, Array_string deps, i64 value) { + v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.value = value,.deps = array_clone_to_depth(&deps, 0),}); + array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); + map_set(&graph->values, &(string[]){mod}, &(i64[]) { value }); } v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph) { @@ -33493,7 +33531,7 @@ v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* grap g->acyclic = false; for (int _t4 = 0; _t4 < node_deps.keys.len; ++_t4) { string name = ((string*)node_deps.keys.data)[_t4]; - v__depgraph__DepGraph_add(g, name, v__depgraph__OrderedDepMap_get(&node_names, name)); + v__depgraph__DepGraph_add_with_value(g, name, v__depgraph__OrderedDepMap_get(&node_names, name), (*(i64*)map_get(ADDR(map, graph->values), &(string[]){name}, &(i64[]){ 0 }))); } v__depgraph__DepGraph* _t5 = g; return _t5; @@ -33502,7 +33540,7 @@ v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* grap string name = ((string*)ready_set.data)[_t6]; v__depgraph__OrderedDepMap_delete(&node_deps, name); Array_string resolved_deps = v__depgraph__OrderedDepMap_get(&node_names, name); - v__depgraph__DepGraph_add(resolved, name, resolved_deps); + v__depgraph__DepGraph_add_with_value(resolved, name, resolved_deps, (*(i64*)map_get(ADDR(map, graph->values), &(string[]){name}, &(i64[]){ 0 }))); } for (int _t7 = 0; _t7 < node_deps.keys.len; ++_t7) { string name = ((string*)node_deps.keys.data)[_t7]; @@ -33555,9 +33593,9 @@ string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph) { if (_IN_MAP(ADDR(string, k), ADDR(map, nn.is_cycle))) { continue; } - multi_return_bool_Array_string mr_3360 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); - seen = mr_3360.arg0; - cycle_names = mr_3360.arg1; + multi_return_bool_Array_string mr_3691 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); + seen = mr_3691.arg0; + cycle_names = mr_3691.arg1; if (seen) { array_push((array*)&out, _MOV((string[]){ string_clone(string__plus(_SLIT(" * "), Array_string_join(cycle_names, _SLIT(" -> ")))) })); nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) @@ -33588,9 +33626,9 @@ VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of for (int _t6 = 0; _t6 < deps.len; ++_t6) { string d = ((string*)deps.data)[_t6]; Array_string d_already_seen = array_clone_to_depth(&new_already_seen, 0); - multi_return_bool_Array_string mr_4093 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); - seen = mr_4093.arg0; - d_already_seen = mr_4093.arg1; + multi_return_bool_Array_string mr_4424 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); + seen = mr_4424.arg0; + d_already_seen = mr_4424.arg1; if (seen) { new_already_seen = array_clone_to_depth(&d_already_seen, 0); map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); @@ -35331,7 +35369,7 @@ _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args) { m->res = _const_v__pkgconfig__version; } else if (opt->listall) { Array_string modules = v__pkgconfig__list(); - qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10129308118656229290_string); + qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10487185186218018245_string); if (opt->description) { for (int _t1 = 0; _t1 < modules.len; ++_t1) { string mod = ((string*)modules.data)[_t1]; @@ -35487,9 +35525,9 @@ VV_LOCAL_SYMBOL v__pkgconfig__MainOptions* v__pkgconfig__parse_options(flag__Fla .description = flag__FlagParser_bool(fp, _SLIT("description"), 'd', false, _SLIT("show pkg module description")), .help = flag__FlagParser_bool(fp, _SLIT("help"), 'h', false, _SLIT("show this help message")), .debug = flag__FlagParser_bool(fp, _SLIT("debug"), 'D', false, _SLIT("show debug information")), - .listall = flag__FlagParser_bool(fp, _SLIT("list-all"), 'l', false, _SLIT("list all pkgmodules")), + .listall = flag__FlagParser_bool(fp, _SLIT("list-all"), 'p', false, _SLIT("list all pkgmodules")), .exists = flag__FlagParser_bool(fp, _SLIT("exists"), 'e', false, _SLIT("return 0 if pkg exists")), - .variables = flag__FlagParser_bool(fp, _SLIT("print-variables"), 'V', false, _SLIT("display variable names")), + .variables = flag__FlagParser_bool(fp, _SLIT("print-variables"), 'P', false, _SLIT("display variable names")), .requires = flag__FlagParser_bool(fp, _SLIT("print-requires"), 'r', false, _SLIT("display requires of the module")), .atleast = flag__FlagParser_string(fp, _SLIT("atleast-version"), 'a', _SLIT(""), _SLIT("return 0 if pkg version is at least the given one")), .atleastpc = flag__FlagParser_string(fp, _SLIT("atleast-pkgconfig-version"), 'A', _SLIT(""), _SLIT("return 0 if pkgconfig version is at least the given one")), @@ -36870,6 +36908,9 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { v__pref__Preferences_parse_define(p, _SLIT("gcboehm_opt")); } } + if (p->is_debug) { + v__pref__Preferences_parse_define(p, _SLIT("debug")); + } if (p->os == v__pref__OS___auto) { p->os = v__pref__get_host_os(); } @@ -36885,7 +36926,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("88d69dca7"); + string vhash = _SLIT("398db2138"); 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; @@ -37580,6 +37621,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } else if (string__eq(arg, _SLIT("-translated"))) { res->translated = true; + res->gc_mode = v__pref__GarbageCollectionMode__no_gc; } else if (string__eq(arg, _SLIT("-m32")) || string__eq(arg, _SLIT("-m64"))) { res->m64 = string_at(arg, 2) == '6'; @@ -37742,6 +37784,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } i++; } + else if (string__eq(arg, _SLIT("-is_o"))) { + res->is_o = true; + } else if (string__eq(arg, _SLIT("-b")) || string__eq(arg, _SLIT("-backend"))) { string sbackend = os__cmdline__option(current_args, arg, _SLIT("c")); array_push((array*)&res->build_options, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = arg}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = sbackend}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); @@ -37832,9 +37877,6 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); }; } - if (res->is_debug) { - v__pref__Preferences_parse_define(res, _SLIT("debug")); - } if (string__eq(command, _SLIT("crun"))) { res->is_crun = true; } @@ -38173,7 +38215,7 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_diagnose_deprecated_defines(v__pref__P 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); - qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_11540237029762306605_string); + qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_15729605724654494396_string); Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0); for (int _t1 = 0; _t1 < files.len; ++_t1) { string file = ((string*)files.data)[_t1]; @@ -38534,9 +38576,9 @@ VV_LOCAL_SYMBOL ChanState sync__Channel_try_push_priv(sync__Channel* ch, voidptr ChanState _t1 = ChanState__closed; return _t1; } - multi_return_int_int mr_4420 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); - int spinloops_sem_ = mr_4420.arg0; - int spinloops_ = mr_4420.arg1; + multi_return_int_int mr_4424 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); + int spinloops_sem_ = mr_4424.arg0; + int spinloops_ = mr_4424.arg1; bool have_swapped = false; for (;;) { bool got_sem = false; @@ -38723,9 +38765,9 @@ inline ChanState sync__Channel_try_pop(sync__Channel* ch, voidptr dest) { } VV_LOCAL_SYMBOL ChanState sync__Channel_try_pop_priv(sync__Channel* ch, voidptr dest, bool no_block) { - multi_return_int_int mr_9405 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); - int spinloops_sem_ = mr_9405.arg0; - int spinloops_ = mr_9405.arg1; + multi_return_int_int mr_9409 = (no_block ? ((multi_return_int_int){.arg0=1,.arg1=1}) : ((multi_return_int_int){.arg0=_const_sync__spinloops,.arg1=_const_sync__spinloops_sem})); + int spinloops_sem_ = mr_9409.arg0; + int spinloops_ = mr_9409.arg1; bool have_swapped = false; bool write_in_progress = false; for (;;) { @@ -39372,7 +39414,7 @@ VV_LOCAL_SYMBOL string help__known_topics(string topicdir) { array_push((array*)&_t3, &ti); } Array_string topics =_t3; - qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_1468091262560489642_string); + qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_13139793989557853369_string); array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) })); array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) })); string _t7 = Array_string_join(res, _SLIT("")); @@ -39869,7 +39911,7 @@ void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many) { } void v__util__Suggestion_sort(v__util__Suggestion* s) { - qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_v__util__Possibility_by_similarity); + qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_14781029812553904099_v__util__Possibility_by_similarity); } string v__util__Suggestion_say(v__util__Suggestion s, string msg) { @@ -39898,7 +39940,7 @@ string v__util__Suggestion_say(v__util__Suggestion s, string msg) { array_push((array*)&_t1, &ti); } Array_string values =_t1; - qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_string); + qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_14781029812553904099_string); if (values.len == 1) { res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); } else if (values.len < 25) { @@ -40349,11 +40391,19 @@ VNORETURN void v__util__launch_tool(bool is_verbose, string tool_name, Array_str if (is_verbose) { println( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Compiling "), /*115 &string*/0xfe10, {.d_s = tool_name}}, {_SLIT(" with: \""), /*115 &string*/0xfe10, {.d_s = compilation_command}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); } - os__Result tool_compilation = os__execute_or_exit(compilation_command); - if (tool_compilation.exit_code != 0) { - eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot compile `"), /*115 &string*/0xfe10, {.d_s = tool_source}}, {_SLIT("`: \n"), /*115 &string*/0xfe10, {.d_s = tool_compilation.output}}, {_SLIT0, 0, { .d_c = 0 }}}))); - _v_exit(1); - VUNREACHABLE(); + int retry_max_count = 3; + for (int i = 0; i < retry_max_count; ++i) { + os__Result tool_compilation = os__execute(compilation_command); + if (tool_compilation.exit_code == 0) { + break; + } else { + if (i == retry_max_count - 1) { + eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot compile `"), /*115 &string*/0xfe10, {.d_s = tool_source}}, {_SLIT("`: \n"), /*115 &string*/0xfe10, {.d_s = tool_compilation.output}}, {_SLIT0, 0, { .d_c = 0 }}}))); + _v_exit(1); + VUNREACHABLE(); + } + time__sleep(20 * _const_time__millisecond); + } } } #if defined(_WIN32) @@ -40647,9 +40697,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_14763 = v__util__tool_source2name_and_exe(stool); - string tool_name = mr_14763.arg0; - string tool_exe = mr_14763.arg1; + multi_return_string_string mr_14924 = v__util__tool_source2name_and_exe(stool); + string tool_name = mr_14924.arg0; + string tool_exe = mr_14924.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); @@ -44097,7 +44147,7 @@ v__ast__Fn v__ast__Fn_new_method_with_receiver_type(v__ast__Fn* f, v__ast__Type v__ast__Fn _t1 = *new_method; return _t1; } - return (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,.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,}; + return (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,}; } v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v__ast__Type new_type) { @@ -44297,7 +44347,7 @@ void v__ast__Table_mark_module_as_deprecated_after(v__ast__Table* t, string mnam } void v__ast__Table_register_fn(v__ast__Table* t, v__ast__Fn new_fn) { - (*(v__ast__Fn*)map_get_and_set((map*)&t->fns, &(string[]){new_fn.name}, &(v__ast__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,.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,} })) = new_fn; + (*(v__ast__Fn*)map_get_and_set((map*)&t->fns, &(string[]){new_fn.name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })) = new_fn; if (new_fn.is_pub && string__eq(new_fn.mod, _SLIT("builtin"))) { map_set(&t->builtin_pub_fns, &(string[]){new_fn.name}, &(bool[]) { true }); } @@ -44319,7 +44369,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ } 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,}); + 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)),.dep_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) { v__ast__Type typ = ((v__ast__Type*)agg_info.types.data)[_t1]; v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); @@ -44417,9 +44467,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12604 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12604.arg0; + Array_v__ast__Type types = mr_12604.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); @@ -44451,9 +44501,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13262 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13262.arg0; + Array_v__ast__Type types = mr_13262.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); @@ -44476,9 +44526,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_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; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13725 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13725.arg0; + Array_v__ast__Type embed_types = mr_13725.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)); @@ -44505,8 +44555,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_14118 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14118.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14186 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14186.arg0; _option_v__ast__Fn _t5; opt_ok2(&(v__ast__Fn[]) { func }, (_option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -44669,9 +44719,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_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; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17433 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17433.arg0; + Array_v__ast__Type types = mr_17433.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); @@ -44694,9 +44744,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_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; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17886 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17886.arg0; + Array_v__ast__Type embed_types = mr_17886.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)); @@ -44727,8 +44777,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_18416 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18416.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18484 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18484.arg0; _option_v__ast__StructField _t5; opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -45224,9 +45274,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_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; + multi_return_string_string mr_31543 = (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_31543.arg0; + string cref = mr_31543.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) { @@ -45400,7 +45450,7 @@ bool v__ast__Table_is_sumtype_or_in_variant(v__ast__Table* t, v__ast__Type paren bool _t1 = false; return _t1; } - if (v__ast__Table_type_kind(t, typ) == v__ast__Kind__sum_type && v__ast__Type_idx(parent) == v__ast__Type_idx(typ) && v__ast__Type_nr_muls(parent) == v__ast__Type_nr_muls(typ)) { + if (v__ast__Table_sym(t, typ)->kind == v__ast__Kind__sum_type && v__ast__Type_idx(parent) == v__ast__Type_idx(typ) && v__ast__Type_nr_muls(parent) == v__ast__Type_nr_muls(typ)) { bool _t2 = true; return _t2; } @@ -46507,7 +46557,7 @@ bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__Co } case v__ast__ComptimeTypeKind__int: { - bool _t2 = (x_kind == v__ast__Kind__i8 || x_kind == v__ast__Kind__i16 || x_kind == v__ast__Kind__int || x_kind == v__ast__Kind__i64 || x_kind == v__ast__Kind__u8 || x_kind == v__ast__Kind__u16 || x_kind == v__ast__Kind__u32 || x_kind == v__ast__Kind__u64 || x_kind == v__ast__Kind__usize || x_kind == v__ast__Kind__int_literal); + bool _t2 = (x_kind == v__ast__Kind__i8 || x_kind == v__ast__Kind__i16 || x_kind == v__ast__Kind__int || x_kind == v__ast__Kind__i64 || x_kind == v__ast__Kind__u8 || x_kind == v__ast__Kind__u16 || x_kind == v__ast__Kind__u32 || x_kind == v__ast__Kind__u64 || x_kind == v__ast__Kind__usize || x_kind == v__ast__Kind__isize || x_kind == v__ast__Kind__int_literal); return _t2; break; } @@ -46552,6 +46602,138 @@ bool v__ast__Table_is_comptime_type(v__ast__Table* t, v__ast__Type x, v__ast__Co return 0; } +Array_string v__ast__Table_dependent_names_in_expr(v__ast__Table* t, v__ast__Expr expr) { + Array_string names = __new_array_with_default(0, 0, sizeof(string), 0); + if (expr._typ == 289 /* v.ast.ArrayInit */) { + for (int _t1 = 0; _t1 < (*expr._v__ast__ArrayInit).exprs.len; ++_t1) { + v__ast__Expr elem_expr = ((v__ast__Expr*)(*expr._v__ast__ArrayInit).exprs.data)[_t1]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, elem_expr)), _t2, Array_string); + } + } + else if (expr._typ == 295 /* v.ast.CallExpr */) { + for (int _t3 = 0; _t3 < (*expr._v__ast__CallExpr).args.len; ++_t3) { + v__ast__CallArg arg = ((v__ast__CallArg*)(*expr._v__ast__CallExpr).args.data)[_t3]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, arg.expr)), _t4, Array_string); + } + _option_v__ast__Fn _t5; + if (_t5 = v__ast__Table_find_fn(t, (*expr._v__ast__CallExpr).name), _t5.state == 0) { + v__ast__Fn func = *(v__ast__Fn*)_t5.data; + _PUSH_MANY(&names, (func.dep_names), _t6, Array_string); + } + } + else if (expr._typ == 296 /* v.ast.CastExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__CastExpr).expr)), _t7, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__CastExpr).arg)), _t8, Array_string); + } + else if (expr._typ == 309 /* v.ast.Ident */) { + if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__global || (*expr._v__ast__Ident).kind == v__ast__IdentKind__constant) { + array_push((array*)&names, _MOV((string[]){ string_clone(v__util__no_dots((*expr._v__ast__Ident).name)) })); + } + } + else if (expr._typ == 310 /* v.ast.IfExpr */) { + for (int _t10 = 0; _t10 < (*expr._v__ast__IfExpr).branches.len; ++_t10) { + v__ast__IfBranch branch = ((v__ast__IfBranch*)(*expr._v__ast__IfExpr).branches.data)[_t10]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, branch.cond)), _t11, Array_string); + for (int _t12 = 0; _t12 < branch.stmts.len; ++_t12) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t12]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt)), _t13, Array_string); + } + } + } + else if (expr._typ == 313 /* v.ast.InfixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__InfixExpr).left)), _t14, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__InfixExpr).right)), _t15, Array_string); + } + else if (expr._typ == 318 /* v.ast.MapInit */) { + for (int _t16 = 0; _t16 < (*expr._v__ast__MapInit).vals.len; ++_t16) { + v__ast__Expr val = ((v__ast__Expr*)(*expr._v__ast__MapInit).vals.data)[_t16]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, val)), _t17, Array_string); + } + } + else if (expr._typ == 319 /* v.ast.MatchExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__MatchExpr).cond)), _t18, Array_string); + for (int _t19 = 0; _t19 < (*expr._v__ast__MatchExpr).branches.len; ++_t19) { + v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*expr._v__ast__MatchExpr).branches.data)[_t19]; + for (int _t20 = 0; _t20 < branch.stmts.len; ++_t20) { + v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t20]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt)), _t21, Array_string); + } + } + } + else if (expr._typ == 324 /* v.ast.ParExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__ParExpr).expr)), _t22, Array_string); + } + else if (expr._typ == 325 /* v.ast.PostfixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__PostfixExpr).expr)), _t23, Array_string); + } + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*expr._v__ast__PrefixExpr).right)), _t24, Array_string); + } + else if (expr._typ == 334 /* v.ast.StructInit */) { + for (int _t25 = 0; _t25 < (*expr._v__ast__StructInit).fields.len; ++_t25) { + v__ast__StructInitField field = ((v__ast__StructInitField*)(*expr._v__ast__StructInit).fields.data)[_t25]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, field.expr)), _t26, Array_string); + } + } + + else { + } + ; + Array_string _t27 = names; + return _t27; +} + +Array_string v__ast__Table_dependent_names_in_stmt(v__ast__Table* t, v__ast__Stmt stmt) { + Array_string names = __new_array_with_default(0, 0, sizeof(string), 0); + if (stmt._typ == 341 /* v.ast.AssignStmt */) { + for (int _t1 = 0; _t1 < (*stmt._v__ast__AssignStmt).left.len; ++_t1) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__AssignStmt).left.data)[_t1]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t2, Array_string); + } + for (int _t3 = 0; _t3 < (*stmt._v__ast__AssignStmt).right.len; ++_t3) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__AssignStmt).right.data)[_t3]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t4, Array_string); + } + } + else if (stmt._typ == 349 /* v.ast.ExprStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ExprStmt).expr)), _t5, Array_string); + } + else if (stmt._typ == 351 /* v.ast.ForInStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ForInStmt).cond)), _t6, Array_string); + for (int _t7 = 0; _t7 < (*stmt._v__ast__ForInStmt).stmts.len; ++_t7) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForInStmt).stmts.data)[_t7]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t8, Array_string); + } + } + else if (stmt._typ == 352 /* v.ast.ForStmt */) { + for (int _t9 = 0; _t9 < (*stmt._v__ast__ForStmt).stmts.len; ++_t9) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForStmt).stmts.data)[_t9]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t10, Array_string); + } + } + else if (stmt._typ == 350 /* v.ast.ForCStmt */) { + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, (*stmt._v__ast__ForCStmt).init)), _t11, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, (*stmt._v__ast__ForCStmt).cond)), _t12, Array_string); + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, (*stmt._v__ast__ForCStmt).inc)), _t13, Array_string); + for (int _t14 = 0; _t14 < (*stmt._v__ast__ForCStmt).stmts.len; ++_t14) { + v__ast__Stmt stmt_ = ((v__ast__Stmt*)(*stmt._v__ast__ForCStmt).stmts.data)[_t14]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_stmt(t, stmt_)), _t15, Array_string); + } + } + else if (stmt._typ == 360 /* v.ast.Return */) { + for (int _t16 = 0; _t16 < (*stmt._v__ast__Return).exprs.len; ++_t16) { + v__ast__Expr expr = ((v__ast__Expr*)(*stmt._v__ast__Return).exprs.data)[_t16]; + _PUSH_MANY(&names, (v__ast__Table_dependent_names_in_expr(t, expr)), _t17, Array_string); + } + } + + else { + } + ; + Array_string _t18 = names; + return _t18; +} + // TypeDecl // TypeDecl v__ast__Language v__ast__pref_arch_to_table_language(v__pref__Arch pref_arch) { @@ -46946,14 +47128,34 @@ inline bool v__ast__Type_is_bool(v__ast__Type typ) { return _t1; } +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_charptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__charptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__char_type_idx), 1)})); + return _t1; +} + +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_byteptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__byteptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__byte_type_idx), 1)})); + return _t1; +} + +VV_LOCAL_SYMBOL Array_v__ast__Type v__ast__new_voidptr_types(void) { + Array_v__ast__Type _t1 = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__voidptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__voidptr_type_idx), 1)})); + return _t1; +} + Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params) { Array_v__ast__Type res = __new_array_with_default(0, params.len, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < params.len; ++_t1) { Array_v__ast__Type types = ((Array_v__ast__Type*)params.data)[_t1]; - _PUSH_MANY(&res, (types), _t2, Array_v__ast__Type); + for (int _t2 = 0; _t2 < types.len; ++_t2) { + v__ast__Type t = ((v__ast__Type*)types.data)[_t2]; + if (!Array_v__ast__Type_contains(res, t)) { + array_push((array*)&res, _MOV((v__ast__Type[]){ t })); + } + } } - Array_v__ast__Type _t3 = res; - return _t3; + Array_v__ast__Type _t4 = res; + return _t4; } v__ast__Type v__ast__mktyp(v__ast__Type typ) { @@ -47322,9 +47524,9 @@ 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, 475) /*expected idx: 475, name: v.ast.Alias */ ).parent_type); - size = mr_21365.arg0; - align = mr_21365.arg1; + multi_return_int_int mr_21622 = 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_21622.arg0; + align = mr_21622.arg1; break; } case v__ast__Kind__struct_: @@ -47352,9 +47554,9 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) Array_v__ast__Type types = _t4; for (int _t7 = 0; _t7 < types.len; ++_t7) { v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t7]; - multi_return_int_int mr_21676 = v__ast__Table_type_size(t, ftyp); - int field_size = mr_21676.arg0; - int alignment = mr_21676.arg1; + multi_return_int_int mr_21933 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21933.arg0; + int alignment = mr_21933.arg1; if (alignment > max_alignment) { max_alignment = alignment; } @@ -47381,8 +47583,8 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; - multi_return_int_int mr_22237 = v__ast__Table_type_size(t, etyp); - int esize = mr_22237.arg0; + multi_return_int_int mr_22494 = v__ast__Table_type_size(t, etyp); + int esize = mr_22494.arg0; size += esize - 2 * t->pointer_size; } } @@ -47395,9 +47597,9 @@ 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, 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; + multi_return_int_int mr_22691 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22691.arg0; + int elem_align = mr_22691.arg1; size = info.size * elem_size; align = elem_align; break; @@ -48834,6 +49036,11 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } + if ((left)->_typ == 309 /* v.ast.Ident */ && (right)._typ == 309 /* v.ast.Ident */) { + if (!c->inside_unsafe && v__ast__Type_is_ptr(left_type) && v__ast__Ident_is_mut(&(*left->_v__ast__Ident)) && v__ast__Type_is_ptr(right_type) && !v__ast__Ident_is_mut(&(*right._v__ast__Ident))) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*right._v__ast__Ident).name}}, {_SLIT("` is immutable, cannot have a mutable reference to an immutable object"), 0, { .d_c = 0 }}})), (*right._v__ast__Ident).pos); + } + } } else { v__checker__Checker_fail_if_immutable(c, *left); } @@ -49580,22 +49787,26 @@ 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) { + if (c->pref->translated) { + bool _t1 = true; + return _t1; + } 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) { - bool _t1 = false; - return _t1; - } - if (v__ast__Type_has_flag(got_fn.return_type, v__ast__TypeFlag__optional) != v__ast__Type_has_flag(exp_fn.return_type, v__ast__TypeFlag__optional)) { bool _t2 = false; return _t2; } - if (!v__checker__Checker_check_basic(c, got_fn.return_type, exp_fn.return_type)) { + if (v__ast__Type_has_flag(got_fn.return_type, v__ast__TypeFlag__optional) != v__ast__Type_has_flag(exp_fn.return_type, v__ast__TypeFlag__optional)) { bool _t3 = false; return _t3; } + if (!v__checker__Checker_check_basic(c, got_fn.return_type, exp_fn.return_type)) { + bool _t4 = false; + return _t4; + } for (int i = 0; i < got_fn.params.len; ++i) { v__ast__Param got_arg = ((v__ast__Param*)got_fn.params.data)[i]; v__ast__Param exp_arg = (*(v__ast__Param*)/*ee elem_sym */array_get(exp_fn.params, i)); @@ -49605,18 +49816,18 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, string exp_arg_pointedness = (exp_arg_is_ptr ? (_SLIT("a pointer")) : (_SLIT("NOT a pointer"))); string got_arg_pointedness = (got_arg_is_ptr ? (_SLIT("a pointer")) : (_SLIT("NOT a pointer"))); v__checker__Checker_add_error_detail(c, str_intp(6, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = exp_fn.name}}, {_SLIT("`\'s expected fn argument: `"), /*115 &string*/0xfe10, {.d_s = exp_arg.name}}, {_SLIT("` is "), /*115 &string*/0xfe10, {.d_s = exp_arg_pointedness}}, {_SLIT(", but the passed fn argument: `"), /*115 &string*/0xfe10, {.d_s = got_arg.name}}, {_SLIT("` is "), /*115 &string*/0xfe10, {.d_s = got_arg_pointedness}}, {_SLIT0, 0, { .d_c = 0 }}}))); - bool _t4 = false; - return _t4; + bool _t5 = false; + return _t5; } else if (exp_arg_is_ptr && got_arg_is_ptr) { continue; } if (!v__ast__Type_alias_eq(got_arg.typ, exp_arg.typ)) { - bool _t5 = false; - return _t5; + bool _t6 = false; + return _t6; } } - bool _t6 = true; - return _t6; + bool _t7 = true; + return _t7; } 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) { @@ -49749,10 +49960,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_19097 = type_hi; - v__ast__Type _var_19106 = type_lo; - type_hi = _var_19106; - type_lo = _var_19097; + v__ast__Type _var_19157 = type_hi; + v__ast__Type _var_19166 = type_lo; + type_hi = _var_19166; + type_lo = _var_19157; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -50676,19 +50887,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_22286 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_22286.arg0; - pos = mr_22286.arg1; + multi_return_string_v__token__Pos mr_22297 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_22297.arg0; + pos = mr_22297.arg1; } else if (expr._typ == 324 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_22355 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_22355.arg0; - pos = mr_22355.arg1; + multi_return_string_v__token__Pos mr_22366 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_22366.arg0; + pos = mr_22366.arg1; } else if (expr._typ == 326 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_22427 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_22427.arg0; - pos = mr_22427.arg1; + multi_return_string_v__token__Pos mr_22438 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_22438.arg0; + pos = mr_22438.arg1; } else if (expr._typ == 329 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -50738,9 +50949,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_23891 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_23891.arg0; - pos = mr_23891.arg1; + multi_return_string_v__token__Pos mr_23902 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_23902.arg0; + pos = mr_23902.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -50846,9 +51057,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_25714 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_25714.arg0; - pos = mr_25714.arg1; + multi_return_string_v__token__Pos mr_25725 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_25725.arg0; + pos = mr_25725.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -51266,9 +51477,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(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_40154 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_40154.arg0; - embed_types = mr_40154.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40165 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_40165.arg0; + embed_types = mr_40165.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); @@ -51302,9 +51513,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(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_40985 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40985.arg0; - embed_types = mr_40985.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40996 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40996.arg0; + embed_types = mr_40996.arg1; node->from_embed_types = embed_types; } } @@ -53623,8 +53834,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_97972 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_97972.arg0; + multi_return_string_v__token__Pos mr_97983 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_97983.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -54184,6 +54395,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ return (_option_void){0}; } v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, typ); + if (!c->is_builtin_mod && sym->kind == v__ast__Kind__struct_ && !string__eq(sym->mod, c->mod) && !sym->is_pub) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), pos); + return (_option_void){0}; + } switch (sym->kind) { case v__ast__Kind__placeholder: { @@ -56528,11 +56743,9 @@ v__ast__Scope* prev_fn_scope; // Defer end return; } - if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - 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); - } + if ((sym->info)._typ == 478 /* v.ast.Interface */ && v__ast__TypeSymbol_has_method(sym, node->name)) { + 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); } } if ((sym->info)._typ == 459 /* v.ast.Struct */) { @@ -56593,9 +56806,8 @@ v__ast__Scope* prev_fn_scope; } if (!v__ast__Type_is_ptr(param->typ)) { v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, param->typ); - if (arg_typ_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; - if (info.is_heap) { + if ((arg_typ_sym->info)._typ == 459 /* v.ast.Struct */) { + if ((*arg_typ_sym->info._v__ast__Struct).is_heap) { _option_v__ast__Var_ptr _t9 = v__ast__Scope_find_var(node->scope, param->name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -56605,17 +56817,15 @@ v__ast__Scope* prev_fn_scope; v__ast__Var* v = (*(v__ast__Var**)_t9.data); v->is_auto_heap = true; } - if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { + if ((*arg_typ_sym->info._v__ast__Struct).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__Struct).concrete_types.len == 0) { 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, 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) { + } else if ((arg_typ_sym->info)._typ == 478 /* v.ast.Interface */) { + if ((*arg_typ_sym->info._v__ast__Interface).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__Interface).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, 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) { + } else if ((arg_typ_sym->info)._typ == 479 /* v.ast.SumType */) { + if ((*arg_typ_sym->info._v__ast__SumType).generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && (*arg_typ_sym->info._v__ast__SumType).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); } } @@ -56731,6 +56941,16 @@ v__ast__Scope* prev_fn_scope; } } node->source_file = c->file; + if (v__ast__Table_known_fn(c->table, node->name) && !string__eq(node->name, _SLIT("main.main"))) { + Array_string dep_names = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t14 = 0; _t14 < node->stmts.len; ++_t14) { + v__ast__Stmt stmt = ((v__ast__Stmt*)node->stmts.data)[_t14]; + _PUSH_MANY(&dep_names, (v__ast__Table_dependent_names_in_stmt(c->table, stmt)), _t15, Array_string); + } + if (dep_names.len > 0) { + (*(v__ast__Fn*)map_get_and_set((map*)&c->table->fns, &(string[]){node->name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).dep_names = dep_names; + } + } // Defer begin if (v__checker__Checker_fn_decl_defer_0) { c->stmt_level = prev_stmt_level; @@ -56944,7 +57164,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Type _t10 = ret_type; return _t10; } - v__ast__Fn func = ((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,}); + v__ast__Fn func = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); bool found = false; bool found_in_args = false; if ((node->left)._typ == 287 /* v.ast.AnonFn */) { @@ -56964,7 +57184,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->name = name_prefixed; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){name_prefixed}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){name_prefixed}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } if (!found && (node->left)._typ == 312 /* v.ast.IndexExpr */) { @@ -57011,15 +57231,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Fn f = *(v__ast__Fn*)_t12.data; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } bool is_native_builtin = false; if (!found && c->pref->backend == v__pref__Backend__native) { if (Array_string_contains(_const_v__ast__native_builtins, fn_name)) { - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; found = true; - func = (*(v__ast__Fn*)map_get(ADDR(map, c->table->fns), &(string[]){fn_name}, &(v__ast__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,.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,} })); + func = (*(v__ast__Fn*)map_get(ADDR(map, c->table->fns), &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })); is_native_builtin = true; } } @@ -57035,7 +57255,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->name = os_name; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){os_name}, &(v__ast__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,.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,} })).usages++; + (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){os_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })).usages++; } } if (is_native_builtin) { @@ -57252,9 +57472,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_29240 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_29240.arg0; - v__token__Pos pos = mr_29240.arg1; + multi_return_string_v__token__Pos mr_29410 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_29410.arg0; + v__token__Pos pos = mr_29410.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)); } @@ -57560,7 +57780,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t16 = _const_v__ast__void_type; return _t16; } - v__ast__Fn method = ((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,}); + v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); bool has_method = false; bool is_method_from_embed = false; _option_v__ast__Fn _t17; @@ -57600,12 +57820,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_method = false; - *(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*) _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)),.dep_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_43522 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_43522.arg0; - embed_types = mr_43522.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_43703 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_43703.arg0; + embed_types = mr_43703.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -57653,9 +57873,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_45850 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45850.arg0; - v__token__Pos pos = mr_45850.arg1; + multi_return_string_v__token__Pos mr_46031 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_46031.arg0; + v__token__Pos pos = mr_46031.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)); } @@ -57763,9 +57983,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_49752 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_49752.arg0; - v__token__Pos pos = mr_49752.arg1; + multi_return_string_v__token__Pos mr_49944 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_49944.arg0; + v__token__Pos pos = mr_49944.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)); @@ -57952,8 +58172,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_57228 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); - node->from_embed_types = mr_57228.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_57420 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_57420.arg1; v__ast__Type _t45 = info.func.return_type; return _t45; } @@ -60514,6 +60734,9 @@ v__ast__TypeSymbol old_ts; })))); (*(v__ast__SqlExpr*)map_get_and_set((map*)&sub_structs, &(int[]){((int)(typ))}, &(v__ast__SqlExpr[]){ (v__ast__SqlExpr){.typ = 0,.is_count = 0,.has_where = 0,.has_order = 0,.has_limit = 0,.has_offset = 0,.has_desc = 0,.is_array = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.table_expr = (v__ast__TypeNode){.typ = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlExpr), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),} })) = n; } + if (node->is_count) { + fields = new_array_from_c_array(1, 1, sizeof(v__ast__StructField), _MOV((v__ast__StructField[1]){((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 = _const_v__ast__int_type,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,.is_deprecated = 0,})})); + } node->fields = fields; node->sub_structs = map_move(&sub_structs); if (node->has_where) { @@ -61490,7 +61713,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str int pos = (*(int*)_t6.data); u8 first_letter = string_at(type_sym->name, pos + 1); - if (!u8_is_capital(first_letter)) { + if (!u8_is_capital(first_letter) && type_sym->kind != v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot initialize builtin type `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } @@ -61549,7 +61772,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->is_short) { int exp_len = info.fields.len; int got_len = node->fields.len; - if (exp_len != got_len) { + if (exp_len != got_len && !c->pref->translated) { string amount = (exp_len < got_len ? (_SLIT("many")) : (_SLIT("few"))); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("too "), /*115 &string*/0xfe10, {.d_s = amount}}, {_SLIT(" fields in `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` literal (expecting "), /*100 &int*/0xfe07, {.d_i32 = exp_len}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = got_len}}, {_SLIT(")"), 0, { .d_c = 0 }}})), node->pos); } @@ -61557,7 +61780,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); if (node->is_short) { info_fields_sorted = array_clone_to_depth(&info.fields, 0); - qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_5995660241070764127_v__ast__StructField_by_i); + qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_6602916910409314308_v__ast__StructField_by_i); } Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); for (int i = 0; i < node->fields.len; ++i) { @@ -62514,8 +62737,10 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ else if (node->_typ == 329 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); if (((*node->_v__ast__SelectorExpr).expr)._typ == 333 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { - v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); - return _t15; + if (!string_contains((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val, _SLIT("\\")) || (*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).is_raw) { + v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); + return _t15; + } } } else if (node->_typ == 330 /* v.ast.SizeOf */) { @@ -63159,20 +63384,20 @@ bool v__markused__mark_used_defer_0 = false; Map_string_v__ast__GlobalField all_globals = mr_434.arg2; v__util__timing_start(_SLIT("mark_used")); v__markused__mark_used_defer_0 = true; - Array_string all_fn_root_names = new_array_from_c_array(101, 101, sizeof(string), _MOV((string[101]){ + Array_string all_fn_root_names = new_array_from_c_array(102, 102, sizeof(string), _MOV((string[102]){ _SLIT("main.main"), _SLIT("__new_array"), _SLIT("str_intp"), _SLIT("format_sb"), _SLIT("__new_array_with_default"), _SLIT("__new_array_with_array_default"), _SLIT("v_realloc"), _SLIT("malloc"), _SLIT("malloc_noscan"), - _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("vstrlen"), _SLIT("__as_cast"), _SLIT("tos"), - _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), _SLIT("utf8_str_visible_length"), - _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), - _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), - _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), - _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), - _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), - _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), - _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), - _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), - _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), - _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); + _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("memdup_uncollectable"), _SLIT("vstrlen"), _SLIT("__as_cast"), + _SLIT("tos"), _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), + _SLIT("utf8_str_visible_length"), _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), + _SLIT("3.vstring"), _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), + _SLIT("20.trim_space"), _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), + _SLIT("20.at"), _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), + _SLIT("20.ge"), _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), + _SLIT("22.clone_to_depth"), _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), + _SLIT("22.slice2"), _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), + _SLIT("65558.reverse"), _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), + _SLIT("json.encode_string"), _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), + _SLIT("main.vtest_new_filemetainfo"), _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); if (pref->is_bare) { _PUSH_MANY(&all_fn_root_names, (new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("strlen"), _SLIT("memcmp"), _SLIT("memcpy"), _SLIT("realloc"), _SLIT("vsnprintf"), _SLIT("vsprintf")}))), _t1, Array_string); } @@ -64969,10 +65194,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index_methods(v__gen__c__Gen* g) { strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); } else if (elem_sym->kind == v__ast__Kind__interface_) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_is_ptr(info.elem_type)) { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(**pelem, *v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + } } else if (elem_sym->kind == v__ast__Kind__sum_type) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_is_ptr(info.elem_type)) { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(**pelem, *v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); + } } else if (elem_sym->kind == v__ast__Kind__alias) { string ptr_typ = v__gen__c__Gen_equality_fn(g, info.elem_type); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq(*pelem, v)) {"), 0, { .d_c = 0 }}}))); @@ -65182,7 +65415,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_write(g, tmp); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_assert_stmt(v__gen__c__Gen* g, v__ast__AssertStmt original_assert_statement) { if (!original_assert_statement.is_used) { return; } @@ -65368,9 +65601,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v_ v__gen__c__Gen_write(g, string__plus(string__plus(string__plus(string__plus(_SLIT(" /* typeof: "), charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( (expr)._typ ))), _SLIT(" type: ")), v__ast__Type_str(typ)), _SLIT(" */ "))); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_) { -bool v__gen__c__Gen_gen_assign_stmt_defer_0 = false; -bool v__gen__c__Gen_gen_assign_stmt_defer_1 = false; +VV_LOCAL_SYMBOL void v__gen__c__Gen_assign_stmt(v__gen__c__Gen* g, v__ast__AssignStmt node_) { +bool v__gen__c__Gen_assign_stmt_defer_0 = false; +bool v__gen__c__Gen_assign_stmt_defer_1 = false; bool af; string type_to_free; string sref_name; @@ -65384,7 +65617,7 @@ string sref_name; v__ast__Type return_type = _const_v__ast__void_type; bool is_decl = node.op == v__token__Kind__decl_assign; g->assign_op = node.op; - v__gen__c__Gen_gen_assign_stmt_defer_0 = true; + v__gen__c__Gen_assign_stmt_defer_0 = true; v__token__Kind op = (is_decl ? (v__token__Kind__assign) : (node.op)); v__ast__Expr right_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); if (right_expr._typ == 295 /* v.ast.CallExpr */) { @@ -65423,7 +65656,7 @@ string sref_name; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(" = ("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, left0); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("); // free "), /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT(" on re-assignment2"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_gen_assign_stmt_defer_1 = true; + v__gen__c__Gen_assign_stmt_defer_1 = true; } else { af = false; } @@ -65437,14 +65670,14 @@ string sref_name; if (sym->kind == v__ast__Kind__multi_return) { v__gen__c__Gen_gen_multi_return_assign(g, (voidptr)&/*qq*/node, return_type); // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_1) { + if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_0) { + if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -65697,14 +65930,14 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_writeln(g, _SLIT(");")); // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_1) { + if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin - if (v__gen__c__Gen_gen_assign_stmt_defer_0) { + if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -65716,7 +65949,7 @@ string sref_name; IError err = _t7.err; v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignment operator `"), /*115 &string*/0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), /*115 &string*/0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); - *(v__ast__Fn*) _t7.data = ((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,}); + *(v__ast__Fn*) _t7.data = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,}); } v__ast__Fn method = (*(v__ast__Fn*)_t7.data); @@ -65887,14 +66120,14 @@ string sref_name; } } // Defer begin -if (v__gen__c__Gen_gen_assign_stmt_defer_1) { +if (v__gen__c__Gen_assign_stmt_defer_1) { if (af) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_to_free}}, {_SLIT("_free(&"), /*115 &string*/0xfe10, {.d_s = sref_name}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } // Defer end // Defer begin -if (v__gen__c__Gen_gen_assign_stmt_defer_0) { +if (v__gen__c__Gen_assign_stmt_defer_0) { g->assign_op = v__token__Kind__unknown; } // Defer end @@ -67375,8 +67608,16 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ multi_return_string_string mr_23179 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); string deref = mr_23179.arg0; string deref_label = mr_23179.arg1; - strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" it);"), 0, { .d_c = 0 }}}))); + if (is_elem_ptr) { + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstring x = _SLIT(\"nil\");")); + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tif (it != 0) {")); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t\tx = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it);"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\t}")); + } else { + strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it);"), 0, { .d_c = 0 }}}))); + } } } strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); @@ -67402,9 +67643,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v sym = v__ast__Table_sym(g->table, typ); } bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_24561 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_24561.arg0; - bool str_method_expects_ptr = mr_24561.arg1; + multi_return_bool_bool_int mr_24922 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_24922.arg0; + bool str_method_expects_ptr = mr_24922.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(a, 0);}"), 0, { .d_c = 0 }}}))); @@ -67417,9 +67658,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); } else { - multi_return_string_string mr_25438 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_25438.arg0; - string deref_label = mr_25438.arg1; + multi_return_string_string mr_25799 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_25799.arg0; + string deref_label = mr_25799.arg1; if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { if (is_elem_ptr) { strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); @@ -67637,9 +67878,9 @@ strings__Builder fn_body; } else { strings__Builder_write_string(&fn_body, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\"\\n\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s=indents}}, {_SLIT(\" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = ptr_amp}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("\"), 0, {.d_c=0}}, "), 0, { .d_c = 0 }}}))); } - multi_return_bool_bool_int mr_35399 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_35399.arg0; - bool str_method_expects_ptr = mr_35399.arg1; + multi_return_bool_bool_int mr_35760 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_35760.arg0; + bool str_method_expects_ptr = mr_35760.arg1; string sftyp = v__gen__c__Gen_typ(g, ftyp_noshared); string field_styp = string_replace(sftyp, _SLIT("*"), _SLIT("")); string _t2; /* if prepend */ @@ -67660,9 +67901,9 @@ strings__Builder fn_body; strings__Builder_write_string(&fn_body, str_intp(4, _MOV((StrIntpData[]){{_SLIT("{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = quote_str}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = g_fmt}}, {_SLIT(", {."), /*115 &string*/0xfe10, {.d_s = v__gen__c__data_str(base_fmt)}}, {_SLIT("="), 0, { .d_c = 0 }}}))); } string funcprefix = _SLIT(""); - multi_return_string_bool mr_36191 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); - string func = mr_36191.arg0; - bool caller_should_free = mr_36191.arg1; + multi_return_string_bool mr_36552 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); + string func = mr_36552.arg0; + bool caller_should_free = mr_36552.arg1; if (Array_v__ast__Type_contains(_const_v__ast__cptr_types, field.typ)) { func = str_intp(2, _MOV((StrIntpData[]){{_SLIT("(voidptr) it."), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}})); caller_should_free = false; @@ -67716,8 +67957,8 @@ if (v__gen__c__Gen_gen_str_for_struct_defer_0) { VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr) { v__ast__Type field_type = (v__ast__Type_has_flag(_field_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(_field_type)) : (_field_type)); string sufix = (v__ast__Type_has_flag(field_type, v__ast__TypeFlag__shared_f) ? (_SLIT("->val")) : (_SLIT(""))); - multi_return_string_string mr_38270 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); - string deref = mr_38270.arg0; + multi_return_string_string mr_38631 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); + string deref = mr_38631.arg0; if (sym->kind == v__ast__Kind__enum_) { return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (v__gen__c__should_use_indent_func(sym->kind)) { @@ -67905,14 +68146,9 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .hotcode_definitions = strings__new_builder(100), .channel_definitions = strings__new_builder(100), .comptime_definitions = strings__new_builder(100), - .global_inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .global_init = __new_array(0, 0, sizeof(u8)), - .inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .init = strings__new_builder(100), .cleanup = __new_array(0, 0, sizeof(u8)), .cleanups = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .gowrappers = strings__new_builder(100), - .stringliterals = strings__new_builder(100), .auto_str_funcs = strings__new_builder(100), .dump_funcs = strings__new_builder(100), .pcs_declarations = strings__new_builder(100), @@ -67923,6 +68159,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .out_results = strings__new_builder(100), .json_forward_decls = strings__new_builder(100), .sql_buf = strings__new_builder(100), + .global_const_defs = new_map(sizeof(string), sizeof(v__gen__c__GlobalConstDef), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .sorted_global_const_names = __new_array(0, 0, sizeof(string)), .file = 0, .unique_file_path_hash = 0, .fn_decl = 0, @@ -68045,6 +68283,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .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), + .test_function_names = __new_array(0, 0, sizeof(string)), }); if (pref->is_test) { v__gen__c__Gen_write_tests_definitions(&global_g); @@ -68052,8 +68291,6 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__util__Timers_start(global_g.timers, _SLIT("cgen init")); for (int _t2 = 0; _t2 < global_g.table->modules.len; ++_t2) { string mod = ((string*)global_g.table->modules.data)[_t2]; - map_set(&global_g.inits, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(200) }); - map_set(&global_g.global_inits, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(100) }); map_set(&global_g.cleanups, &(string[]){mod}, &(strings__Builder[]) { strings__new_builder(100) }); } v__gen__c__Gen_init(&global_g); @@ -68141,7 +68378,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t13.data); - _option_int _t14 = strings__Builder_write(&global_g.stringliterals, g->stringliterals); + _option_int _t14 = strings__Builder_write(&global_g.auto_str_funcs, g->auto_str_funcs); if (_t14.state != 0) { /*or block*/ IError err = _t14.err; _v_panic(IError_str(err)); @@ -68150,7 +68387,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t14.data); - _option_int _t15 = strings__Builder_write(&global_g.auto_str_funcs, g->auto_str_funcs); + _option_int _t15 = strings__Builder_write(&global_g.dump_funcs, g->auto_str_funcs); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; _v_panic(IError_str(err)); @@ -68159,7 +68396,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t15.data); - _option_int _t16 = strings__Builder_write(&global_g.dump_funcs, g->auto_str_funcs); + _option_int _t16 = strings__Builder_write(&global_g.comptime_definitions, g->comptime_definitions); if (_t16.state != 0) { /*or block*/ IError err = _t16.err; _v_panic(IError_str(err)); @@ -68168,7 +68405,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t16.data); - _option_int _t17 = strings__Builder_write(&global_g.comptime_definitions, g->comptime_definitions); + _option_int _t17 = strings__Builder_write(&global_g.pcs_declarations, g->pcs_declarations); if (_t17.state != 0) { /*or block*/ IError err = _t17.err; _v_panic(IError_str(err)); @@ -68177,7 +68414,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t17.data); - _option_int _t18 = strings__Builder_write(&global_g.pcs_declarations, g->pcs_declarations); + _option_int _t18 = strings__Builder_write(&global_g.hotcode_definitions, g->hotcode_definitions); if (_t18.state != 0) { /*or block*/ IError err = _t18.err; _v_panic(IError_str(err)); @@ -68186,7 +68423,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t18.data); - _option_int _t19 = strings__Builder_write(&global_g.hotcode_definitions, g->hotcode_definitions); + _option_int _t19 = strings__Builder_write(&global_g.embedded_data, g->embedded_data); if (_t19.state != 0) { /*or block*/ IError err = _t19.err; _v_panic(IError_str(err)); @@ -68195,7 +68432,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t19.data); - _option_int _t20 = strings__Builder_write(&global_g.embedded_data, g->embedded_data); + _option_int _t20 = strings__Builder_write(&global_g.shared_types, g->shared_types); if (_t20.state != 0) { /*or block*/ IError err = _t20.err; _v_panic(IError_str(err)); @@ -68204,7 +68441,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t20.data); - _option_int _t21 = strings__Builder_write(&global_g.shared_types, g->shared_types); + _option_int _t21 = strings__Builder_write(&global_g.shared_functions, g->channel_definitions); if (_t21.state != 0) { /*or block*/ IError err = _t21.err; _v_panic(IError_str(err)); @@ -68213,147 +68450,126 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t21.data); - _option_int _t22 = strings__Builder_write(&global_g.shared_functions, g->channel_definitions); - if (_t22.state != 0) { /*or block*/ - IError err = _t22.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t22.data); global_g.force_main_console = global_g.force_main_console || g->force_main_console; - Map_int_string _t23 = g->shareds; - int _t25 = _t23.key_values.len; - for (int _t24 = 0; _t24 < _t25; ++_t24 ) { - int _t26 = _t23.key_values.len - _t25; - _t25 = _t23.key_values.len; - if (_t26 < 0) { - _t24 = -1; + Map_string_v__gen__c__GlobalConstDef _t22 = g->global_const_defs; + 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(&_t23.key_values, _t24)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t23.key_values, _t24); - string v = (*(string*)DenseArray_value(&_t23.key_values, _t24)); + if (!DenseArray_has_index(&_t22.key_values, _t23)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t22.key_values, _t23); + k = string_clone(k); + v__gen__c__GlobalConstDef v = (*(v__gen__c__GlobalConstDef*)DenseArray_value(&_t22.key_values, _t23)); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&global_g.global_const_defs, &(string[]){k}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = v; + } + Map_int_string _t26 = g->shareds; + int _t28 = _t26.key_values.len; + for (int _t27 = 0; _t27 < _t28; ++_t27 ) { + int _t29 = _t26.key_values.len - _t28; + _t28 = _t26.key_values.len; + if (_t29 < 0) { + _t27 = -1; + continue; + } + if (!DenseArray_has_index(&_t26.key_values, _t27)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t26.key_values, _t27); + string v = (*(string*)DenseArray_value(&_t26.key_values, _t27)); map_set(&global_g.shareds, &(int[]){k}, &(string[]) { v }); } - Map_string_string _t27 = g->chan_pop_optionals; - int _t29 = _t27.key_values.len; - for (int _t28 = 0; _t28 < _t29; ++_t28 ) { - int _t30 = _t27.key_values.len - _t29; - _t29 = _t27.key_values.len; - if (_t30 < 0) { - _t28 = -1; + Map_string_string _t30 = g->chan_pop_optionals; + int _t32 = _t30.key_values.len; + for (int _t31 = 0; _t31 < _t32; ++_t31 ) { + int _t33 = _t30.key_values.len - _t32; + _t32 = _t30.key_values.len; + if (_t33 < 0) { + _t31 = -1; continue; } - if (!DenseArray_has_index(&_t27.key_values, _t28)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t27.key_values, _t28); + if (!DenseArray_has_index(&_t30.key_values, _t31)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t30.key_values, _t31); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t27.key_values, _t28)); + string v = (*(string*)DenseArray_value(&_t30.key_values, _t31)); map_set(&global_g.chan_pop_optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t31 = g->chan_push_optionals; - int _t33 = _t31.key_values.len; - for (int _t32 = 0; _t32 < _t33; ++_t32 ) { - int _t34 = _t31.key_values.len - _t33; - _t33 = _t31.key_values.len; - if (_t34 < 0) { - _t32 = -1; + Map_string_string _t34 = g->chan_push_optionals; + int _t36 = _t34.key_values.len; + for (int _t35 = 0; _t35 < _t36; ++_t35 ) { + int _t37 = _t34.key_values.len - _t36; + _t36 = _t34.key_values.len; + if (_t37 < 0) { + _t35 = -1; continue; } - if (!DenseArray_has_index(&_t31.key_values, _t32)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t31.key_values, _t32); + if (!DenseArray_has_index(&_t34.key_values, _t35)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t34.key_values, _t35); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t31.key_values, _t32)); + string v = (*(string*)DenseArray_value(&_t34.key_values, _t35)); map_set(&global_g.chan_push_optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t35 = g->optionals; - int _t37 = _t35.key_values.len; - for (int _t36 = 0; _t36 < _t37; ++_t36 ) { - int _t38 = _t35.key_values.len - _t37; - _t37 = _t35.key_values.len; - if (_t38 < 0) { - _t36 = -1; + Map_string_string _t38 = g->optionals; + int _t40 = _t38.key_values.len; + for (int _t39 = 0; _t39 < _t40; ++_t39 ) { + int _t41 = _t38.key_values.len - _t40; + _t40 = _t38.key_values.len; + if (_t41 < 0) { + _t39 = -1; continue; } - if (!DenseArray_has_index(&_t35.key_values, _t36)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t35.key_values, _t36); + if (!DenseArray_has_index(&_t38.key_values, _t39)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t38.key_values, _t39); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t35.key_values, _t36)); + string v = (*(string*)DenseArray_value(&_t38.key_values, _t39)); map_set(&global_g.optionals, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t39 = g->results; - int _t41 = _t39.key_values.len; - for (int _t40 = 0; _t40 < _t41; ++_t40 ) { - int _t42 = _t39.key_values.len - _t41; - _t41 = _t39.key_values.len; - if (_t42 < 0) { - _t40 = -1; + Map_string_string _t42 = g->results; + int _t44 = _t42.key_values.len; + for (int _t43 = 0; _t43 < _t44; ++_t43 ) { + int _t45 = _t42.key_values.len - _t44; + _t44 = _t42.key_values.len; + if (_t45 < 0) { + _t43 = -1; continue; } - if (!DenseArray_has_index(&_t39.key_values, _t40)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t39.key_values, _t40); + if (!DenseArray_has_index(&_t42.key_values, _t43)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t42.key_values, _t43); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t39.key_values, _t40)); + string v = (*(string*)DenseArray_value(&_t42.key_values, _t43)); map_set(&global_g.results, &(string[]){k}, &(string[]) { v }); } - Map_string_string _t43 = g->as_cast_type_names; - int _t45 = _t43.key_values.len; - for (int _t44 = 0; _t44 < _t45; ++_t44 ) { - int _t46 = _t43.key_values.len - _t45; - _t45 = _t43.key_values.len; - if (_t46 < 0) { - _t44 = -1; + Map_string_string _t46 = g->as_cast_type_names; + int _t48 = _t46.key_values.len; + for (int _t47 = 0; _t47 < _t48; ++_t47 ) { + int _t49 = _t46.key_values.len - _t48; + _t48 = _t46.key_values.len; + if (_t49 < 0) { + _t47 = -1; continue; } - if (!DenseArray_has_index(&_t43.key_values, _t44)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t43.key_values, _t44); + if (!DenseArray_has_index(&_t46.key_values, _t47)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t46.key_values, _t47); k = string_clone(k); - string v = (*(string*)DenseArray_value(&_t43.key_values, _t44)); + string v = (*(string*)DenseArray_value(&_t46.key_values, _t47)); map_set(&global_g.as_cast_type_names, &(string[]){k}, &(string[]) { v }); } - Map_int_bool _t47 = g->sumtype_definitions; - int _t49 = _t47.key_values.len; - for (int _t48 = 0; _t48 < _t49; ++_t48 ) { - int _t50 = _t47.key_values.len - _t49; - _t49 = _t47.key_values.len; - if (_t50 < 0) { - _t48 = -1; + Map_int_bool _t50 = g->sumtype_definitions; + int _t52 = _t50.key_values.len; + for (int _t51 = 0; _t51 < _t52; ++_t51 ) { + int _t53 = _t50.key_values.len - _t52; + _t52 = _t50.key_values.len; + if (_t53 < 0) { + _t51 = -1; continue; } - if (!DenseArray_has_index(&_t47.key_values, _t48)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t47.key_values, _t48); - bool v = (*(bool*)DenseArray_value(&_t47.key_values, _t48)); + if (!DenseArray_has_index(&_t50.key_values, _t51)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t50.key_values, _t51); + bool v = (*(bool*)DenseArray_value(&_t50.key_values, _t51)); map_set(&global_g.sumtype_definitions, &(int[]){k}, &(bool[]) { v }); } - _option_int _t51 = strings__Builder_write(&global_g.json_forward_decls, g->json_forward_decls); - if (_t51.state != 0) { /*or block*/ - IError err = _t51.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t51.data); - _option_int _t52 = strings__Builder_write(&global_g.enum_typedefs, g->enum_typedefs); - if (_t52.state != 0) { /*or block*/ - IError err = _t52.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t52.data); - _option_int _t53 = strings__Builder_write(&global_g.channel_definitions, g->channel_definitions); - if (_t53.state != 0) { /*or block*/ - IError err = _t53.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - (*(int*)_t53.data); - _option_int _t54 = strings__Builder_write(&global_g.sql_buf, g->sql_buf); + _option_int _t54 = strings__Builder_write(&global_g.json_forward_decls, g->json_forward_decls); if (_t54.state != 0) { /*or block*/ IError err = _t54.err; _v_panic(IError_str(err)); @@ -68362,7 +68578,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t54.data); - _option_int _t55 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->cleanup); + _option_int _t55 = strings__Builder_write(&global_g.enum_typedefs, g->enum_typedefs); if (_t55.state != 0) { /*or block*/ IError err = _t55.err; _v_panic(IError_str(err)); @@ -68371,7 +68587,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t55.data); - _option_int _t56 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.inits), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->init); + _option_int _t56 = strings__Builder_write(&global_g.channel_definitions, g->channel_definitions); if (_t56.state != 0) { /*or block*/ IError err = _t56.err; _v_panic(IError_str(err)); @@ -68380,7 +68596,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t56.data); - _option_int _t57 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.global_inits), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->global_init); + _option_int _t57 = strings__Builder_write(&global_g.sql_buf, g->sql_buf); if (_t57.state != 0) { /*or block*/ IError err = _t57.err; _v_panic(IError_str(err)); @@ -68389,50 +68605,58 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre } (*(int*)_t57.data); - for (int _t58 = 0; _t58 < g->str_types.len; ++_t58) { - v__gen__c__StrType str_type = ((v__gen__c__StrType*)g->str_types.data)[_t58]; + _option_int _t58 = strings__Builder_write(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){g->file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), g->cleanup); + if (_t58.state != 0) { /*or block*/ + IError err = _t58.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + (*(int*)_t58.data); + for (int _t59 = 0; _t59 < g->str_types.len; ++_t59) { + v__gen__c__StrType str_type = ((v__gen__c__StrType*)g->str_types.data)[_t59]; array_push((array*)&global_g.str_types, _MOV((v__gen__c__StrType[]){ str_type })); } - for (int _t60 = 0; _t60 < g->sumtype_casting_fns.len; ++_t60) { - v__gen__c__SumtypeCastingFn scf = ((v__gen__c__SumtypeCastingFn*)g->sumtype_casting_fns.data)[_t60]; + for (int _t61 = 0; _t61 < g->sumtype_casting_fns.len; ++_t61) { + v__gen__c__SumtypeCastingFn scf = ((v__gen__c__SumtypeCastingFn*)g->sumtype_casting_fns.data)[_t61]; if (!Array_v__gen__c__SumtypeCastingFn_contains(global_g.sumtype_casting_fns, scf)) { array_push((array*)&global_g.sumtype_casting_fns, _MOV((v__gen__c__SumtypeCastingFn[]){ scf })); } } global_g.nr_closures += g->nr_closures; global_g.has_main = global_g.has_main || g->has_main; - _PUSH_MANY(&global_g.auto_fn_definitions, (g->auto_fn_definitions), _t62, Array_string); - _PUSH_MANY(&global_g.anon_fn_definitions, (g->anon_fn_definitions), _t63, Array_string); - _PUSH_MANY(&global_g.needed_equality_fns, (g->needed_equality_fns), _t64, Array_v__ast__Type); - _PUSH_MANY(&global_g.array_contains_types, (g->array_contains_types), _t65, Array_v__ast__Type); - _PUSH_MANY(&global_g.array_index_types, (g->array_index_types), _t66, Array_v__ast__Type); - _PUSH_MANY(&global_g.pcs, (g->pcs), _t67, Array_v__gen__c__ProfileCounterMeta); - _PUSH_MANY(&global_g.json_types, (g->json_types), _t68, Array_v__ast__Type); - _PUSH_MANY(&global_g.hotcode_fn_names, (g->hotcode_fn_names), _t69, Array_string); + _PUSH_MANY(&global_g.auto_fn_definitions, (g->auto_fn_definitions), _t63, Array_string); + _PUSH_MANY(&global_g.anon_fn_definitions, (g->anon_fn_definitions), _t64, Array_string); + _PUSH_MANY(&global_g.needed_equality_fns, (g->needed_equality_fns), _t65, Array_v__ast__Type); + _PUSH_MANY(&global_g.array_contains_types, (g->array_contains_types), _t66, Array_v__ast__Type); + _PUSH_MANY(&global_g.array_index_types, (g->array_index_types), _t67, Array_v__ast__Type); + _PUSH_MANY(&global_g.pcs, (g->pcs), _t68, Array_v__gen__c__ProfileCounterMeta); + _PUSH_MANY(&global_g.json_types, (g->json_types), _t69, Array_v__ast__Type); + _PUSH_MANY(&global_g.hotcode_fn_names, (g->hotcode_fn_names), _t70, Array_string); + _PUSH_MANY(&global_g.test_function_names, (g->test_function_names), _t71, Array_string); v__gen__c__Gen_free_builders(g); - Map_int_bool _t70 = g->autofree_methods; - int _t72 = _t70.key_values.len; - for (int _t71 = 0; _t71 < _t72; ++_t71 ) { - int _t73 = _t70.key_values.len - _t72; - _t72 = _t70.key_values.len; - if (_t73 < 0) { - _t71 = -1; + Map_int_bool _t72 = g->autofree_methods; + int _t74 = _t72.key_values.len; + for (int _t73 = 0; _t73 < _t74; ++_t73 ) { + int _t75 = _t72.key_values.len - _t74; + _t74 = _t72.key_values.len; + if (_t75 < 0) { + _t73 = -1; continue; } - if (!DenseArray_has_index(&_t70.key_values, _t71)) {continue;} - int k = /*key*/ *(int*)DenseArray_key(&_t70.key_values, _t71); - bool v = (*(bool*)DenseArray_value(&_t70.key_values, _t71)); + if (!DenseArray_has_index(&_t72.key_values, _t73)) {continue;} + int k = /*key*/ *(int*)DenseArray_key(&_t72.key_values, _t73); + bool v = (*(bool*)DenseArray_value(&_t72.key_values, _t73)); map_set(&global_g.autofree_methods, &(int[]){k}, &(bool[]) { v }); } } } else { - for (int _t74 = 0; _t74 < files.len; ++_t74) { - v__ast__File* file = ((v__ast__File**)files.data)[_t74]; + for (int _t76 = 0; _t76 < files.len; ++_t76) { + v__ast__File* file = ((v__ast__File**)files.data)[_t76]; global_g.file = file; v__gen__c__Gen_gen_file(&global_g); - strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.inits), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.init, 100); strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.cleanups), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.cleanup, 100); - strings__Builder_drain_builder(&(*(strings__Builder*)map_get(ADDR(map, global_g.global_inits), &(string[]){file->mod.name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), (voidptr)&/*qq*/global_g.global_init, 100); } v__util__Timers_start(global_g.timers, _SLIT("cgen unification")); } @@ -68443,8 +68667,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre for (int i = 0; i < global_g.str_types.len; i++) { v__gen__c__Gen_final_gen_str(&global_g, (*(v__gen__c__StrType*)/*ee elem_sym */array_get(global_g.str_types, i))); } - for (int _t75 = 0; _t75 < global_g.sumtype_casting_fns.len; ++_t75) { - v__gen__c__SumtypeCastingFn sumtype_casting_fn = ((v__gen__c__SumtypeCastingFn*)global_g.sumtype_casting_fns.data)[_t75]; + for (int _t77 = 0; _t77 < global_g.sumtype_casting_fns.len; ++_t77) { + v__gen__c__SumtypeCastingFn sumtype_casting_fn = ((v__gen__c__SumtypeCastingFn*)global_g.sumtype_casting_fns.data)[_t77]; v__gen__c__Gen_write_sumtype_casting_fn(&global_g, sumtype_casting_fn); } v__gen__c__Gen_write_shareds(&global_g); @@ -68454,6 +68678,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre v__gen__c__Gen_gen_array_index_methods(&global_g); v__gen__c__Gen_gen_equality_fns(&global_g); v__gen__c__Gen_gen_free_methods(&global_g); + v__gen__c__Gen_sort_globals_consts(&global_g); v__util__Timers_show(global_g.timers, _SLIT("cgen unification")); v__gen__c__Gen g = global_g; v__util__Timers_start(g.timers, _SLIT("cgen common")); @@ -68512,6 +68737,22 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_write_string(&b, strings__Builder_str(&g.json_forward_decls)); strings__Builder_writeln(&b, _SLIT("\n// V definitions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.definitions)); + strings__Builder_writeln(&b, _SLIT("\n// V global/const definitions:")); + for (int _t78 = 0; _t78 < g.sorted_global_const_names.len; ++_t78) { + string var_name = ((string*)g.sorted_global_const_names.data)[_t78]; + v__gen__c__GlobalConstDef* _t80 = (v__gen__c__GlobalConstDef*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g.global_const_defs), &(string[]){var_name})); + _option_v__gen__c__GlobalConstDef _t79 = {0}; + if (_t80) { + *((v__gen__c__GlobalConstDef*)&_t79.data) = *((v__gen__c__GlobalConstDef*)_t80); + } else { + _t79.state = 2; _t79.err = _v_error(_SLIT("array index out of range")); + } + + if (_t79.state == 0) { + v__gen__c__GlobalConstDef var = (*(v__gen__c__GlobalConstDef*)_t79.data); + strings__Builder_writeln(&b, var.def); + } + } string interface_table = v__gen__c__Gen_interface_table(&g); if (interface_table.len > 0) { strings__Builder_writeln(&b, _SLIT("\n// V interface table:")); @@ -68538,10 +68779,6 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_writeln(&b, _SLIT("\n// V channel code:")); strings__Builder_write_string(&b, strings__Builder_str(&g.channel_definitions)); } - if (g.stringliterals.len > 0) { - strings__Builder_writeln(&b, _SLIT("\n// V stringliterals:")); - strings__Builder_write_string(&b, strings__Builder_str(&g.stringliterals)); - } if (g.auto_str_funcs.len > 0) { strings__Builder_writeln(&b, _SLIT("\n// V auto str functions:")); strings__Builder_write_string(&b, strings__Builder_str(&g.auto_str_funcs)); @@ -68551,8 +68788,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_write_string(&b, strings__Builder_str(&g.dump_funcs)); } if (g.auto_fn_definitions.len > 0) { - for (int _t76 = 0; _t76 < g.auto_fn_definitions.len; ++_t76) { - string fn_def = ((string*)g.auto_fn_definitions.data)[_t76]; + for (int _t81 = 0; _t81 < g.auto_fn_definitions.len; ++_t81) { + string fn_def = ((string*)g.auto_fn_definitions.data)[_t81]; strings__Builder_writeln(&b, fn_def); } } @@ -68561,8 +68798,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre strings__Builder_writeln(&b, _SLIT("\n// V closure helpers")); strings__Builder_writeln(&b, v__gen__c__c_closure_helpers(g.pref)); } - for (int _t77 = 0; _t77 < g.anon_fn_definitions.len; ++_t77) { - string fn_def = ((string*)g.anon_fn_definitions.data)[_t77]; + for (int _t82 = 0; _t82 < g.anon_fn_definitions.len; ++_t82) { + string fn_def = ((string*)g.anon_fn_definitions.data)[_t82]; strings__Builder_writeln(&b, fn_def); } } @@ -68573,8 +68810,8 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre string res = strings__Builder_str(&b); strings__Builder_free(&b); v__gen__c__Gen_free_builders(&g); - string _t78 = res; - return _t78; + string _t83 = res; + return _t83; } VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__PoolProcessor* p, int idx, int wid) { @@ -68596,14 +68833,9 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .hotcode_definitions = strings__new_builder(100), .channel_definitions = strings__new_builder(100), .comptime_definitions = strings__new_builder(100), - .global_inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .global_init = strings__new_builder(0), - .inits = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .init = strings__new_builder(100), .cleanup = strings__new_builder(100), .cleanups = new_map(sizeof(string), sizeof(strings__Builder), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .gowrappers = strings__new_builder(100), - .stringliterals = strings__new_builder(100), .auto_str_funcs = strings__new_builder(100), .dump_funcs = __new_array(0, 0, sizeof(u8)), .pcs_declarations = strings__new_builder(100), @@ -68614,6 +68846,8 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .out_results = strings__new_builder(100), .json_forward_decls = strings__new_builder(100), .sql_buf = strings__new_builder(100), + .global_const_defs = new_map(sizeof(string), sizeof(v__gen__c__GlobalConstDef), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), + .sorted_global_const_names = __new_array(0, 0, sizeof(string)), .file = file, .unique_file_path_hash = 0, .fn_decl = 0, @@ -68736,6 +68970,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .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, + .test_function_names = __new_array(0, 0, sizeof(string)), }, sizeof(v__gen__c__Gen))); v__gen__c__Gen_gen_file(g); v__gen__c__Gen* _t1 = g; @@ -68752,11 +68987,8 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder_free(&g->type_definitions); strings__Builder_free(&g->alias_definitions); strings__Builder_free(&g->definitions); - strings__Builder_free(&g->global_init); - strings__Builder_free(&g->init); strings__Builder_free(&g->cleanup); strings__Builder_free(&g->gowrappers); - strings__Builder_free(&g->stringliterals); strings__Builder_free(&g->auto_str_funcs); strings__Builder_free(&g->dump_funcs); strings__Builder_free(&g->comptime_definitions); @@ -68771,7 +69003,7 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder_free(&g->json_forward_decls); strings__Builder_free(&g->enum_typedefs); strings__Builder_free(&g->sql_buf); - Map_string_strings__Builder _t1 = g->global_inits; + Map_string_strings__Builder _t1 = g->cleanups; int _t3 = _t1.key_values.len; for (int _t2 = 0; _t2 < _t3; ++_t2 ) { int _t4 = _t1.key_values.len - _t3; @@ -68784,32 +69016,6 @@ void v__gen__c__Gen_free_builders(v__gen__c__Gen* g) { strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t1.key_values, _t2)); strings__Builder_free(v); } - Map_string_strings__Builder _t5 = g->inits; - int _t7 = _t5.key_values.len; - for (int _t6 = 0; _t6 < _t7; ++_t6 ) { - int _t8 = _t5.key_values.len - _t7; - _t7 = _t5.key_values.len; - if (_t8 < 0) { - _t6 = -1; - continue; - } - if (!DenseArray_has_index(&_t5.key_values, _t6)) {continue;} - strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t5.key_values, _t6)); - strings__Builder_free(v); - } - Map_string_strings__Builder _t9 = g->cleanups; - int _t11 = _t9.key_values.len; - for (int _t10 = 0; _t10 < _t11; ++_t10 ) { - int _t12 = _t9.key_values.len - _t11; - _t11 = _t9.key_values.len; - if (_t12 < 0) { - _t10 = -1; - continue; - } - if (!DenseArray_has_index(&_t9.key_values, _t10)) {continue;} - strings__Builder* v = &(*(strings__Builder*)DenseArray_value(&_t9.key_values, _t10)); - strings__Builder_free(v); - } } } @@ -68885,13 +69091,6 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { v__gen__c__Gen_write_sorted_types(g); v__gen__c__Gen_write_multi_return_types(g); strings__Builder_writeln(&g->definitions, _SLIT("// end of definitions #endif")); - if (!g->pref->no_builtin) { - strings__Builder_writeln(&g->stringliterals, _SLIT("")); - strings__Builder_writeln(&g->stringliterals, _SLIT("// >> string literal consts")); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - strings__Builder_writeln(&g->stringliterals, _SLIT("void vinit_string_literals(void){")); - } - } if (g->pref->compile_defines_all.len > 0) { strings__Builder_writeln(&g->comptime_definitions, _SLIT("// V compile time defines by -d or -define flags:")); strings__Builder_writeln(&g->comptime_definitions, string__plus(_SLIT("// All custom defines : "), Array_string_join(g->pref->compile_defines_all, _SLIT(",")))); @@ -68980,13 +69179,6 @@ void v__gen__c__Gen_init(v__gen__c__Gen* g) { } void v__gen__c__Gen_finish(v__gen__c__Gen* g) { - if (!g->pref->no_builtin) { - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - strings__Builder_writeln(&g->stringliterals, _SLIT("}")); - } - strings__Builder_writeln(&g->stringliterals, _SLIT("// << string literal consts")); - strings__Builder_writeln(&g->stringliterals, _SLIT("")); - } if (g->pref->is_prof && g->pref->build_mode != v__pref__BuildMode__build_module) { v__gen__c__Gen_gen_vprint_profile_stats(g); } @@ -69205,18 +69397,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_38074 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_38074.arg0; - string base = mr_38074.arg1; + multi_return_string_string mr_37072 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_37072.arg0; + string base = mr_37072.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_38207 = v__gen__c__Gen_result_type_name(g, t); - string styp = mr_38207.arg0; - string base = mr_38207.arg1; + multi_return_string_string mr_37205 = v__gen__c__Gen_result_type_name(g, t); + string styp = mr_37205.arg0; + string base = mr_37205.arg1; map_set(&g->results, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -69883,19 +70075,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - if (node._typ == 347 /* v.ast.EmptyStmt */) { - } - else if (node._typ == 339 /* v.ast.AsmStmt */) { + if (node._typ == 339 /* v.ast.AsmStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AsmStmt).pos); - v__gen__c__Gen_gen_asm_stmt(g, (*node._v__ast__AsmStmt)); + v__gen__c__Gen_asm_stmt(g, (*node._v__ast__AsmStmt)); } else if (node._typ == 340 /* v.ast.AssertStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssertStmt).pos); - v__gen__c__Gen_gen_assert_stmt(g, (*node._v__ast__AssertStmt)); + v__gen__c__Gen_assert_stmt(g, (*node._v__ast__AssertStmt)); } else if (node._typ == 341 /* v.ast.AssignStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssignStmt).pos); - v__gen__c__Gen_gen_assign_stmt(g, (*node._v__ast__AssignStmt)); + v__gen__c__Gen_assign_stmt(g, (*node._v__ast__AssignStmt)); } else if (node._typ == 342 /* v.ast.Block */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__Block).pos); @@ -69991,6 +70181,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_defer_flag_var(g, (voidptr)&/*qq*/defer_stmt)}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); array_push((array*)&g->defer_stmts, _MOV((v__ast__DeferStmt[]){ defer_stmt })); } + else if (node._typ == 347 /* v.ast.EmptyStmt */) { + } else if (node._typ == 348 /* v.ast.EnumDecl */) { v__gen__c__Gen_enum_decl(g, (*node._v__ast__EnumDecl)); } @@ -70263,8 +70455,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, *(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_66950 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66950.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_65936 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_65936.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 }}})); @@ -70478,7 +70670,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_attrs(v__gen__c__Gen* g, Array_v__ast__A } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmStmt stmt) { v__gen__c__Gen_write(g, _SLIT("__asm__")); if (stmt.is_volatile) { v__gen__c__Gen_write(g, _SLIT(" volatile")); @@ -71260,6 +71452,9 @@ 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(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_lock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx);"), 0, { .d_c = 0 }}}))); } g->inside_map_postfix = true; + if ((*node._v__ast__PostfixExpr).is_c2v_prefix) { + v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + } if (v__ast__Expr_is_auto_deref_var((*node._v__ast__PostfixExpr).expr)) { v__gen__c__Gen_write(g, _SLIT("(*")); v__gen__c__Gen_expr(g, (*node._v__ast__PostfixExpr).expr); @@ -71268,7 +71463,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_expr(g, (*node._v__ast__PostfixExpr).expr); } g->inside_map_postfix = false; - v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + if (!(*node._v__ast__PostfixExpr).is_c2v_prefix) { + v__gen__c__Gen_write(g, v__token__Kind_str((*node._v__ast__PostfixExpr).op)); + } if (((*node._v__ast__PostfixExpr).auto_locked).len != 0) { v__gen__c__Gen_writeln(g, _SLIT(";")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_unlock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx)"), 0, { .d_c = 0 }}}))); @@ -71589,7 +71786,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel g->nr_closures++; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(receiver.typ)) { - v__gen__c__Gen_write(g, _SLIT("memdup(")); + v__gen__c__Gen_write(g, _SLIT("memdup_uncollectable(")); } if (!v__ast__Type_is_ptr(node.expr_type)) { v__gen__c__Gen_write(g, _SLIT("&")); @@ -71804,11 +72001,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_108677 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108677.arg0; - string key_eq_fn = mr_108677.arg1; - string clone_fn = mr_108677.arg2; - string free_fn = mr_108677.arg3; + multi_return_string_string_string_string mr_107766 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_107766.arg0; + string key_eq_fn = mr_107766.arg1; + string clone_fn = mr_107766.arg2; + string free_fn = mr_107766.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -72622,22 +72819,15 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; if (field.expr._typ == 289 /* v.ast.ArrayInit */) { if ((*field.expr._v__ast__ArrayInit).is_fixed) { string styp = v__gen__c__Gen_typ(g, (*field.expr._v__ast__ArrayInit).typ); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - string val = v__gen__c__Gen_expr_string(g, field.expr); - strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}}))); - } else { - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}}))); - } + string val = v__gen__c__Gen_expr_string(g, field.expr); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = field.mod,.def = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT("; // fixed array const"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = v__ast__Table_dependent_names_in_expr(g->table, field_expr),.order = 0,}); } else { v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } } else if (field.expr._typ == 333 /* v.ast.StringLiteral */) { - strings__Builder_writeln(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}}))); - if (g->pref->build_mode != v__pref__BuildMode__build_module) { - string val = v__gen__c__Gen_expr_string(g, field.expr); - strings__Builder_writeln(&g->stringliterals, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - } + string val = v__gen__c__Gen_expr_string(g, field.expr); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = field.mod,.def = str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}})),.init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}})),.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } else if (field.expr._typ == 295 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*field.expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional)) { @@ -72656,13 +72846,13 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; _option_v__ast__ComptTimeConstValue _t3; if (_t3 = v__ast__ConstField_comptime_expr_value(&field), _t3.state == 0) { v__ast__ComptTimeConstValue ct_value = *(v__ast__ComptTimeConstValue*)_t3.data; - if (v__gen__c__Gen_const_decl_precomputed(g, field.mod, name, ct_value, field.typ)) { + if (v__gen__c__Gen_const_decl_precomputed(g, field.mod, name, field.name, ct_value, field.typ)) { continue; } } } if (v__ast__ConstField_is_simple_define_const(&field)) { - v__gen__c__Gen_const_decl_simple_define(g, field.name, v__gen__c__Gen_expr_string(g, field_expr)); + v__gen__c__Gen_const_decl_simple_define(g, field.mod, field.name, v__gen__c__Gen_expr_string(g, field_expr)); } else { v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } @@ -72676,17 +72866,17 @@ if (v__gen__c__Gen_const_decl_defer_0) { // Defer end } -VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ) { +VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, string mod, string name, string field_name, v__ast__ComptTimeConstValue ct_value, v__ast__Type typ) { string styp = v__gen__c__Gen_typ(g, typ); string cname = (g->pref->translated && !g->is_builtin_mod ? (name) : ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})))); if (ct_value._typ == 5 /* i8 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i8_str((*ct_value._i8))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i8_str((*ct_value._i8))); } else if (ct_value._typ == 6 /* i16 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i16_str((*ct_value._i16))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i16_str((*ct_value._i16))); } else if (ct_value._typ == 7 /* int */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, int_str((*ct_value._int))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, int_str((*ct_value._int))); } else if (ct_value._typ == 8 /* i64 */) { if (v__ast__Type_alias_eq(typ, _const_v__ast__i64_type)) { @@ -72694,33 +72884,33 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t1; } if (v__ast__Type_alias_eq(typ, _const_v__ast__int_type)) { - v__gen__c__Gen_const_decl_simple_define(g, name, i64_str((*ct_value._i64))); + v__gen__c__Gen_const_decl_simple_define(g, mod, name, i64_str((*ct_value._i64))); bool _t2 = true; return _t2; } if (v__ast__Type_alias_eq(typ, _const_v__ast__u64_type)) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, string__plus(i64_str((*ct_value._i64)), _SLIT("U"))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, string__plus(i64_str((*ct_value._i64)), _SLIT("U"))); } else { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, i64_str((*ct_value._i64))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, i64_str((*ct_value._i64))); } } else if (ct_value._typ == 10 /* u8 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u8_str((*ct_value._u8))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u8_str((*ct_value._u8))); } else if (ct_value._typ == 11 /* u16 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u16_str((*ct_value._u16))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u16_str((*ct_value._u16))); } else if (ct_value._typ == 12 /* u32 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u32_str((*ct_value._u32))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u32_str((*ct_value._u32))); } else if (ct_value._typ == 13 /* u64 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, string__plus(u64_str((*ct_value._u64)), _SLIT("U"))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, string__plus(u64_str((*ct_value._u64)), _SLIT("U"))); } else if (ct_value._typ == 15 /* f32 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, f32_str((*ct_value._f32))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, f32_str((*ct_value._f32))); } else if (ct_value._typ == 16 /* f64 */) { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, f64_str((*ct_value._f64))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, f64_str((*ct_value._f64))); } else if (ct_value._typ == 21 /* rune */) { u32 rune_code = ((u32)((*ct_value._rune))); @@ -72730,15 +72920,14 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t3; } string escval = v__util__smart_quote(u8_ascii_str(((u8)(rune_code))), false); - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = escval}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = escval}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_const_decl_write_precomputed(g, styp, cname, u32_str(((u32)((*ct_value._rune))))); + v__gen__c__Gen_const_decl_write_precomputed(g, mod, styp, cname, field_name, u32_str(((u32)((*ct_value._rune))))); } } else if (ct_value._typ == 20 /* string */) { string escaped_val = v__util__smart_quote((*ct_value._string), false); - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // str inited later"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&g->init, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = escaped_val}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // str inited later"), 0, { .d_c = 0 }}})),.init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = escaped_val}}, {_SLIT("\");"), 0, { .d_c = 0 }}})),.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); if (g->is_autofree) { strings__Builder_writeln(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring_free(&"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } @@ -72752,11 +72941,11 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st return _t5; } -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string styp, string cname, string ct_value) { - strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = ct_value}}, {_SLIT("; // precomputed"), 0, { .d_c = 0 }}}))); +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* g, string mod, string styp, string cname, string field_name, string ct_value) { + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = ct_value}}, {_SLIT("; // precomputed"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,}); } -VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string mod, string name, string val) { string x = v__util__no_dots(name); if (g->pref->translated && !g->is_builtin_mod && !v__util__module_is_builtin(string_all_before_last(name, _SLIT(".")))) { if (string_starts_with(x, _SLIT("main__"))) { @@ -72766,35 +72955,32 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, x = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT0, 0, { .d_c = 0 }}})); } if (g->pref->translated) { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("const int "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT("const int "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } else { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("#define "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); - } - strings__Builder_writeln(&g->definitions, val); - if (g->pref->translated) { - strings__Builder_write_string(&g->definitions, _SLIT(";")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT("#define "), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT0, 0, { .d_c = 0 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); } } VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_init_later(v__gen__c__Gen* g, string mod, string name, v__ast__Expr expr, v__ast__Type typ, bool unwrap_option) { string styp = v__gen__c__Gen_typ(g, typ); string cname = (g->pref->translated && !g->is_builtin_mod ? (name) : ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})))); - strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // inited later"), 0, { .d_c = 0 }}}))); + strings__Builder init = strings__new_builder(100); if (string__eq(cname, _SLIT("_const_os__args"))) { if (g->pref->os == v__pref__OS__windows) { - strings__Builder_writeln(&g->init, _SLIT("\t_const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv);")); + strings__Builder_writeln(&init, _SLIT("\t_const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv);")); } else { - strings__Builder_writeln(&g->init, _SLIT("\t_const_os__args = os__init_os_args(___argc, (byte**)___argv);")); + strings__Builder_writeln(&init, _SLIT("\t_const_os__args = os__init_os_args(___argc, (byte**)___argv);")); } } else { if (unwrap_option) { - strings__Builder_writeln(&g->init, _SLIT("{")); - strings__Builder_writeln(&g->init, v__gen__c__Gen_expr_string_surround(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), 0, { .d_c = 0 }}})), expr, _SLIT(".data;"))); - strings__Builder_writeln(&g->init, _SLIT("}")); + strings__Builder_writeln(&init, _SLIT("{")); + strings__Builder_writeln(&init, v__gen__c__Gen_expr_string_surround(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), 0, { .d_c = 0 }}})), expr, _SLIT(".data;"))); + strings__Builder_writeln(&init, _SLIT("}")); } else { - strings__Builder_writeln(&g->init, v__gen__c__Gen_expr_string_surround(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), 0, { .d_c = 0 }}})), expr, _SLIT(";"))); + strings__Builder_writeln(&init, v__gen__c__Gen_expr_string_surround(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(" = "), 0, { .d_c = 0 }}})), expr, _SLIT(";"))); } } + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = mod,.def = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("; // inited later"), 0, { .d_c = 0 }}})),.init = string_trim_right(strings__Builder_str(&init), _SLIT("\n")),.dep_names = v__ast__Table_dependent_names_in_expr(g->table, expr),.order = 0,}); if (g->is_autofree) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (string_starts_with(styp, _SLIT("Array_"))) { @@ -72834,35 +73020,39 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa if (field.has_expr && (anon_fn_expr)._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn)); string fn_type_name = v__gen__c__Gen_get_anon_fn_type_name(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn), field.name); - 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 }}}))); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(fn_type_name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = 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 }}})),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); continue; } + strings__Builder def_builder = strings__new_builder(100); + string init = _SLIT(""); string _v_extern = (cextern ? (_SLIT("extern ")) : (_SLIT(""))); string modifier = (field.is_volatile ? (_SLIT(" volatile ")) : (_SLIT(""))); - 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 }}}))); + strings__Builder_write_string(&def_builder, 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")); + strings__Builder_writeln(&def_builder, _SLIT("; // global5")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = strings__Builder_str(&def_builder),.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = -1,}); 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 }}}))); + strings__Builder_write_string(&def_builder, 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 }}}))); } else if ((v__ast__Expr_is_literal(field.expr) && should_init) || cinit || ((field.expr)._typ == 289 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((field.expr)._v__ast__ArrayInit,(field.expr)._typ, 289) /*expected idx: 289, name: v.ast.ArrayInit */ ).is_fixed)) { - 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 }}}))); + strings__Builder_write_string(&def_builder, 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 }}}))); } else { - strings__Builder_writeln(&g->global_init, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT("; // 3global"), 0, { .d_c = 0 }}}))); + init = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.expr)}}, {_SLIT("; // 3global"), 0, { .d_c = 0 }}})); } } else if (!g->pref->translated) { string default_initializer = v__gen__c__Gen_type_default(g, field.typ); if (string__eq(default_initializer, _SLIT("{0}")) && should_init) { - strings__Builder_write_string(&g->definitions, _SLIT(" = {0}")); + strings__Builder_write_string(&def_builder, _SLIT(" = {0}")); } else { if (!(string__eq(field.name, _SLIT("as_cast_type_indexes")) || string__eq(field.name, _SLIT("g_memory_block")) || string__eq(field.name, _SLIT("global_allocator")))) { - strings__Builder_writeln(&g->global_init, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)&(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]){"), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_default(g, field.typ)}}, {_SLIT("}[0]); // global"), 0, { .d_c = 0 }}}))); + init = str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)&(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]){"), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_default(g, field.typ)}}, {_SLIT("}[0]); // global"), 0, { .d_c = 0 }}})); } } } - strings__Builder_writeln(&g->definitions, _SLIT("; // global4")); + strings__Builder_writeln(&def_builder, _SLIT("; // global4")); + (*(v__gen__c__GlobalConstDef*)map_get_and_set((map*)&g->global_const_defs, &(string[]){v__util__no_dots(field.name)}, &(v__gen__c__GlobalConstDef[]){ (v__gen__c__GlobalConstDef){.mod = (string){.str=(byteptr)"", .is_lit=1},.def = (string){.str=(byteptr)"", .is_lit=1},.init = (string){.str=(byteptr)"", .is_lit=1},.dep_names = __new_array(0, 0, sizeof(string)),.order = 0,} })) = ((v__gen__c__GlobalConstDef){.mod = node.mod,.def = strings__Builder_str(&def_builder),.init = init,.dep_names = v__ast__Table_dependent_names_in_expr(g->table, field.expr),.order = 0,}); } } @@ -72948,26 +73138,46 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; v__gen__c__Gen_write(g, _SLIT("\tas_cast_type_indexes = ")); v__gen__c__Gen_writeln(g, v__gen__c__Gen_as_cast_name_table(g)); v__gen__c__Gen_writeln(g, _SLIT("\tbuiltin_init();")); - v__gen__c__Gen_writeln(g, _SLIT("\tvinit_string_literals();")); if (g->nr_closures > 0) { v__gen__c__Gen_writeln(g, _SLIT("\t_closure_mtx_init();")); } for (int _t1 = 0; _t1 < g->table->modules.len; ++_t1) { string mod_name = ((string*)g->table->modules.data)[_t1]; - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t{ // Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(" :"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_write(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->inits), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); - v__gen__c__Gen_write(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->global_inits), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); + bool is_empty = true; + for (int _t2 = 0; _t2 < g->sorted_global_const_names.len; ++_t2) { + string var_name = ((string*)g->sorted_global_const_names.data)[_t2]; + v__gen__c__GlobalConstDef* _t4 = (v__gen__c__GlobalConstDef*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->global_const_defs), &(string[]){var_name})); + _option_v__gen__c__GlobalConstDef _t3 = {0}; + if (_t4) { + *((v__gen__c__GlobalConstDef*)&_t3.data) = *((v__gen__c__GlobalConstDef*)_t4); + } else { + _t3.state = 2; _t3.err = _v_error(_SLIT("array index out of range")); + } + + if (_t3.state == 0) { + v__gen__c__GlobalConstDef var = (*(v__gen__c__GlobalConstDef*)_t3.data); + if (string__eq(var.mod, mod_name) && var.init.len > 0) { + if (is_empty) { + is_empty = false; + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + v__gen__c__Gen_writeln(g, var.init); + } + } + } string init_fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(".init"), 0, { .d_c = 0 }}})); - _option_v__ast__Fn _t2; - if (_t2 = v__ast__Table_find_fn(g->table, init_fn_name), _t2.state == 0) { - v__ast__Fn initfn = *(v__ast__Fn*)_t2.data; + _option_v__ast__Fn _t5; + if (_t5 = v__ast__Table_find_fn(g->table, init_fn_name), _t5.state == 0) { + v__ast__Fn initfn = *(v__ast__Fn*)_t5.data; if (v__ast__Type_alias_eq(initfn.return_type, _const_v__ast__void_type) && initfn.params.len == 0) { + if (is_empty) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Initializations for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } string mod_c_name = v__util__no_dots(mod_name); string init_fn_c_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = mod_c_name}}, {_SLIT("__init"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = init_fn_c_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); } } - v__gen__c__Gen_writeln(g, _SLIT("\t}")); } v__gen__c__Gen_writeln(g, _SLIT("}")); if (g->pref->printfn_list.len > 0 && Array_string_contains(g->pref->printfn_list, _SLIT("_vinit"))) { @@ -72977,8 +73187,8 @@ bool v__gen__c__Gen_write_init_function_defer_0 = false; v__gen__c__Gen_writeln(g, _SLIT("void _vcleanup(void) {")); if (g->is_autofree) { Array_string reversed_table_modules = array_reverse(g->table->modules); - for (int _t3 = 0; _t3 < reversed_table_modules.len; ++_t3) { - string mod_name = ((string*)reversed_table_modules.data)[_t3]; + for (int _t6 = 0; _t6 < reversed_table_modules.len; ++_t6) { + string mod_name = ((string*)reversed_table_modules.data)[_t6]; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t// Cleanups for module "), /*115 &string*/0xfe10, {.d_s = mod_name}}, {_SLIT(" :"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, strings__Builder_str(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod_name}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })))); } @@ -73090,9 +73300,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_149065 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_149065.arg0; - string base = mr_149065.arg1; + multi_return_string_string mr_149616 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_149616.arg0; + string base = mr_149616.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -73217,6 +73427,45 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } +VV_LOCAL_SYMBOL void v__gen__c__Gen_sort_globals_consts(v__gen__c__Gen* g) { +bool v__gen__c__Gen_sort_globals_consts_defer_0 = false; + v__util__timing_start(_SLIT("Gen.sort_globals_consts")); + v__gen__c__Gen_sort_globals_consts_defer_0 = true; + array_clear(&g->sorted_global_const_names); + v__depgraph__DepGraph* dep_graph = v__depgraph__new_dep_graph(); + Map_string_v__gen__c__GlobalConstDef _t1 = g->global_const_defs; + int _t3 = _t1.key_values.len; + for (int _t2 = 0; _t2 < _t3; ++_t2 ) { + int _t4 = _t1.key_values.len - _t3; + _t3 = _t1.key_values.len; + if (_t4 < 0) { + _t2 = -1; + continue; + } + if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} + string var_name = /*key*/ *(string*)DenseArray_key(&_t1.key_values, _t2); + var_name = string_clone(var_name); + v__gen__c__GlobalConstDef var_info = (*(v__gen__c__GlobalConstDef*)DenseArray_value(&_t1.key_values, _t2)); + v__depgraph__DepGraph_add_with_value(dep_graph, var_name, var_info.dep_names, var_info.order); + } + v__depgraph__DepGraph* dep_graph_sorted = v__depgraph__DepGraph_resolve(dep_graph); + Array_int _t5 = new_array_from_c_array(2, 2, sizeof(int), _MOV((int[2]){-1, 0})); + for (int _t6 = 0; _t6 < _t5.len; ++_t6) { + int order = ((int*)_t5.data)[_t6]; + for (int _t7 = 0; _t7 < dep_graph_sorted->nodes.len; ++_t7) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)dep_graph_sorted->nodes.data)[_t7]; + if (node.value == order) { + array_push((array*)&g->sorted_global_const_names, _MOV((string[]){ string_clone(node.name) })); + } + } + } +// Defer begin +if (v__gen__c__Gen_sort_globals_consts_defer_0) { + v__util__timing_measure(_SLIT("Gen.sort_globals_consts")); +} +// Defer end +} + VV_LOCAL_SYMBOL Array_v__ast__TypeSymbol_ptr v__gen__c__Gen_sort_structs(v__gen__c__Gen* g, Array_v__ast__TypeSymbol_ptr typesa) { bool v__gen__c__Gen_sort_structs_defer_0 = false; v__util__timing_start(_SLIT("Gen.sort_structs")); @@ -73387,11 +73636,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_158929 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158929.arg0; - string pafile = mr_158929.arg1; - string pamod = mr_158929.arg2; - string pafn = mr_158929.arg3; + multi_return_int_string_string_string mr_159987 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_159987.arg0; + string pafile = mr_159987.arg1; + string pamod = mr_159987.arg2; + string pafn = mr_159987.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 }}}))); @@ -73414,11 +73663,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_160199 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_160199.arg0; - string pafile = mr_160199.arg1; - string pamod = mr_160199.arg2; - string pafn = mr_160199.arg3; + multi_return_int_string_string_string mr_161257 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_161257.arg0; + string pafile = mr_161257.arg1; + string pamod = mr_161257.arg2; + string pafn = mr_161257.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 }}}))); @@ -73528,11 +73777,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_162807 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162807.arg0; - string key_eq_fn = mr_162807.arg1; - string clone_fn = mr_162807.arg2; - string free_fn = mr_162807.arg3; + multi_return_string_string_string_string mr_163865 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_163865.arg0; + string key_eq_fn = mr_163865.arg1; + string clone_fn = mr_163865.arg2; + string free_fn = mr_163865.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(""))); @@ -73651,30 +73900,18 @@ VV_LOCAL_SYMBOL Array_string v__gen__c__Gen_get_all_test_function_names(v__gen__ Array_string tfuncs = __new_array_with_default(0, 0, sizeof(string), 0); string tsuite_begin = _SLIT(""); string tsuite_end = _SLIT(""); - Map_string_v__ast__Fn _t1 = g->table->fns; - int _t3 = _t1.key_values.len; - for (int _t2 = 0; _t2 < _t3; ++_t2 ) { - int _t4 = _t1.key_values.len - _t3; - _t3 = _t1.key_values.len; - if (_t4 < 0) { - _t2 = -1; + for (int _t1 = 0; _t1 < g->test_function_names.len; ++_t1) { + string name = ((string*)g->test_function_names.data)[_t1]; + if (string_ends_with(name, _SLIT(".testsuite_begin"))) { + tsuite_begin = name; continue; } - if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} - v__ast__Fn f = (*(v__ast__Fn*)DenseArray_value(&_t1.key_values, _t2)); - if (!f.is_test) { + if (string_contains(name, _SLIT(".test_"))) { + array_push((array*)&tfuncs, _MOV((string[]){ string_clone(name) })); continue; } - if (string_ends_with(f.name, _SLIT(".testsuite_begin"))) { - tsuite_begin = f.name; - continue; - } - if (string_contains(f.name, _SLIT(".test_"))) { - array_push((array*)&tfuncs, _MOV((string[]){ string_clone(f.name) })); - continue; - } - if (string_ends_with(f.name, _SLIT(".testsuite_end"))) { - tsuite_end = f.name; + if (string_ends_with(name, _SLIT(".testsuite_end"))) { + tsuite_end = name; continue; } } @@ -73682,12 +73919,12 @@ VV_LOCAL_SYMBOL Array_string v__gen__c__Gen_get_all_test_function_names(v__gen__ if (tsuite_begin.len > 0) { array_push((array*)&all_tfuncs, _MOV((string[]){ string_clone(tsuite_begin) })); } - _PUSH_MANY(&all_tfuncs, (tfuncs), _t7, Array_string); + _PUSH_MANY(&all_tfuncs, (tfuncs), _t4, Array_string); if (tsuite_end.len > 0) { array_push((array*)&all_tfuncs, _MOV((string[]){ string_clone(tsuite_end) })); } - Array_string _t9 = all_tfuncs; - return _t9; + Array_string _t6 = all_tfuncs; + return _t6; } VV_LOCAL_SYMBOL void v__gen__c__Gen_size_of(v__gen__c__Gen* g, v__ast__SizeOf node) { @@ -74068,8 +74305,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_177871 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_177871.arg0; + multi_return_Array_string_Array_string_Array_bool mr_178892 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_178892.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__")); @@ -74083,11 +74320,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { _option_multi_return_v__ast__Fn_Array_v__ast__Type _t26 = v__ast__Table_find_method_from_embeds(g->table, st_sym, method.name); if (_t26.state != 0) { /*or block*/ IError err = _t26.err; - *(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*) _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)),.dep_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_178335 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_178335.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_179356 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_179356.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 }}})); @@ -74461,6 +74698,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_leak) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_find_leak(1);")); } + v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_pages_executable(0);")); v__gen__c__Gen_writeln(g, _SLIT("\tGC_INIT();")); if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr || g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr_opt) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_enable_incremental();")); @@ -74500,22 +74738,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_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; + multi_return_int_string_string_string mr_5051 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_5051.arg0; + string pafile = mr_5051.arg1; + string pamod = mr_5051.arg2; + string pafn = mr_5051.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_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; + multi_return_int_string_string_string mr_5742 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5742.arg0; + string pafile = mr_5742.arg1; + string pamod = mr_5742.arg2; + string pafn = mr_5742.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);")); @@ -74547,6 +74785,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_leak) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_find_leak(1);")); } + v__gen__c__Gen_writeln(g, _SLIT("\tGC_set_pages_executable(0);")); v__gen__c__Gen_writeln(g, _SLIT("\tGC_INIT();")); if (g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr || g->pref->gc_mode == v__pref__GarbageCollectionMode__boehm_incr_opt) { v__gen__c__Gen_writeln(g, _SLIT("\tGC_enable_incremental();")); @@ -74573,7 +74812,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { for (int tnumber = 0; tnumber < all_tfuncs.len; ++tnumber) { string tname = ((string*)all_tfuncs.data)[tnumber]; string tcname = v__util__no_dots(tname); - v__ast__Fn testfn = (*(v__ast__Fn*)map_get(ADDR(map, g->table->fns), &(string[]){tname}, &(v__ast__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,.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,} })); + v__ast__Fn testfn = (*(v__ast__Fn*)map_get(ADDR(map, g->table->fns), &(string[]){tname}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.dep_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,.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,} })); int lnum = testfn.pos.line_nr + 1; v__gen__c__Gen_writeln(g, _SLIT("\tmain__VTestFnMetaInfo_free(test_runner.fn_test_info);")); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tstring tcname_"), /*100 &int*/0xfe07, {.d_i32 = tnumber}}, {_SLIT(" = _SLIT(\""), /*115 &string*/0xfe10, {.d_s = tcname}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); @@ -75771,6 +76010,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_decl(v__gen__c__Gen* g, v__ast__FnDecl no if (node.should_be_skipped) { return; } + if (node.is_test) { + array_push((array*)&g->test_function_names, _MOV((string[]){ string_clone(node.name) })); + } if (node.ninstances == 0 && node.generic_names.len > 0) { return; } @@ -76020,10 +76262,10 @@ int ctmp; v__gen__c__Gen_write(g, fn_header); } int arg_start_pos = g->out.len; - multi_return_Array_string_Array_string_Array_bool mr_8604 = v__gen__c__Gen_fn_decl_params(g, node->params, node->scope, node->is_variadic); - Array_string fargs = mr_8604.arg0; - Array_string fargtypes = mr_8604.arg1; - Array_bool heap_promoted = mr_8604.arg2; + multi_return_Array_string_Array_string_Array_bool mr_8663 = v__gen__c__Gen_fn_decl_params(g, node->params, node->scope, node->is_variadic); + Array_string fargs = mr_8663.arg0; + Array_string fargtypes = mr_8663.arg1; + Array_bool heap_promoted = mr_8663.arg2; if (is_closure) { g->nr_closures++; } @@ -76254,7 +76496,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF return; } string ctx_struct = v__gen__c__closure_ctx(node->decl); - v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup_uncollectable(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); g->indent++; for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { v__ast__Param var = ((v__ast__Param*)node->inherited_vars.data)[_t1]; @@ -77125,11 +77367,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_39946 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39946.arg0; - string pafile = mr_39946.arg1; - string pamod = mr_39946.arg2; - string pafn = mr_39946.arg3; + multi_return_int_string_string_string mr_40019 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_40019.arg0; + string pafile = mr_40019.arg1; + string pamod = mr_40019.arg2; + string pafn = mr_40019.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(")")); @@ -80068,7 +80310,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\topt_ok2(&res, ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("*)&ret, sizeof(res));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&dec, _SLIT("\treturn ret;\n}")); strings__Builder_writeln(&enc, _SLIT("\treturn o;\n}")); - strings__Builder_writeln(&g->definitions, strings__Builder_str(&dec)); + strings__Builder_writeln(&g->gowrappers, strings__Builder_str(&dec)); strings__Builder_writeln(&g->gowrappers, strings__Builder_str(&enc)); } } @@ -80414,11 +80656,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_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; + multi_return_string_string_string_string mr_20159 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20159.arg0; + string key_eq_fn = mr_20159.arg1; + string clone_fn = mr_20159.arg2; + string free_fn = mr_20159.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)) { @@ -84884,7 +85126,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } else if (lx._typ == 329 /* v.ast.SelectorExpr */) { if (op == v__token__Kind__decl_assign) { - v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("struct fields can only be declared during the initialization"), (*lx._v__ast__SelectorExpr).pos)))); + v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("use assignment `=` instead of declaration `:=` when modifying struct fields"), pos)))); return _t7; } } @@ -85538,7 +85780,7 @@ bool inside_array_lit; } else if (string__eq(p->tok.lit, _SLIT("map")) && p->peek_tok.kind == v__token__Kind__lcbr && !(p->builtin_mod && (string__eq(p->file_base, _SLIT("map.v")) || string__eq(p->file_base, _SLIT("map_d_gcboehm_opt.v"))))) { v__parser__Parser_error_with_pos(p, _SLIT("deprecated map syntax, use syntax like `{'age': 20}`"), v__token__Token_pos(&p->tok)); } else { - if (p->inside_if && v__parser__Parser_is_generic_name(p) && p->peek_tok.kind != v__token__Kind__dot) { + if (p->inside_comptime_if && v__parser__Parser_is_generic_name(p) && p->peek_tok.kind != v__token__Kind__dot) { p->expecting_type = true; } node = v__parser__Parser_name_expr(p); @@ -86046,7 +86288,11 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((node)._typ == 312 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); } - 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},})))); + bool is_c2v_prefix = p->peek_tok.kind == v__token__Kind__dollar; + 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),.is_c2v_prefix = is_c2v_prefix,.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); + if (is_c2v_prefix) { + v__parser__Parser_next(p); + } v__parser__Parser_next(p); } else { v__ast__Expr _t5 = node; @@ -86612,6 +86858,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ .params = params, .generic_names = generic_names, + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = p->mod, .file = p->file_name, @@ -86672,6 +86919,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Table_register_fn(p->table, ((v__ast__Fn){ .params = params, .generic_names = generic_names, + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = p->mod, .file = p->file_name, @@ -86935,7 +87183,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected "), /*115 &v.token.Token*/0xfe10, {.d_s = v__token__Token_str(p->tok)}}, {_SLIT(" after anonymous function signature, expecting `{`"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); } Array_string label_names = __new_array_with_default(0, 0, sizeof(string), 0); - v__ast__Fn func = ((v__ast__Fn){.params = args,.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 = return_type,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = is_variadic,.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 = false,.no_body = 0,.is_conditional = 0,}); + v__ast__Fn func = ((v__ast__Fn){.params = args,.generic_names = __new_array(0, 0, sizeof(string)),.dep_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 = return_type,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = is_variadic,.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 = false,.no_body = 0,.is_conditional = 0,}); string name = str_intp(4, _MOV((StrIntpData[]){{_SLIT("anon_fn_"), /*115 &string*/0xfe10, {.d_s = p->unique_prefix}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_fn_type_signature(p->table, (voidptr)&/*qq*/func)}}, {_SLIT("_"), /*100 &int*/0xfe07, {.d_i32 = p->tok.pos}}, {_SLIT0, 0, { .d_c = 0 }}})); string keep_fn_name = p->cur_fn_name; p->cur_fn_name = name; @@ -86951,7 +87199,19 @@ bool v__parser__Parser_anon_fn_defer_0 = false; int idx = v__ast__Table_find_or_register_fn_type(p->table, p->mod, func, true, 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){ + if (inherited_vars.len > 0 && args.len > 0) { + for (int _t3 = 0; _t3 < args.len; ++_t3) { + v__ast__Param arg = ((v__ast__Param*)args.data)[_t3]; + for (int _t4 = 0; _t4 < inherited_vars.len; ++_t4) { + v__ast__Param var = ((v__ast__Param*)inherited_vars.data)[_t4]; + if (string__eq(arg.name, var.name)) { + v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the parameter name `"), /*115 &string*/0xfe10, {.d_s = arg.name}}, {_SLIT("` conflicts with the captured value name"), 0, { .d_c = 0 }}})), arg.pos); + break; + } + } + } + } + v__ast__AnonFn _t5 = ((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)), @@ -87008,7 +87268,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_close_scope(p); } // Defer end - return _t3; + return _t5; } VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_args(v__parser__Parser* p) { @@ -87496,6 +87756,9 @@ bool was_inside_ct_if_expr; for (;;) { if (!((p->tok.kind == v__token__Kind__key_if || p->tok.kind == v__token__Kind__key_else))) break; p->inside_if = true; + if (is_comptime) { + p->inside_comptime_if = true; + } v__token__Pos start_pos = (is_comptime ? (v__token__Pos_extend(v__token__Token_pos(&p->prev_tok), v__token__Token_pos(&p->tok))) : (v__token__Token_pos(&p->tok))); if (p->tok.kind == v__token__Kind__key_else) { _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t1, Array_v__ast__Comment); @@ -87515,6 +87778,7 @@ bool was_inside_ct_if_expr; if (p->tok.kind == v__token__Kind__lcbr) { has_else = true; p->inside_if = false; + p->inside_comptime_if = false; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); v__token__Pos body_pos = v__token__Token_pos(&p->tok); v__parser__Parser_open_scope(p); @@ -87597,6 +87861,7 @@ bool was_inside_ct_if_expr; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); v__token__Pos body_pos = v__token__Token_pos(&p->tok); p->inside_if = false; + p->inside_comptime_if = false; v__parser__Parser_open_scope(p); Array_v__ast__Stmt stmts = v__parser__Parser_parse_block_no_scope(p, false); array_push((array*)&branches, _MOV((v__ast__IfBranch[]){ ((v__ast__IfBranch){ @@ -87831,9 +88096,9 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars } p->inside_match = true; p->inside_select = true; - multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_9380 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_9380.arg0; - Array_v__ast__Comment comments = mr_9380.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_9498 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_9498.arg0; + Array_v__ast__Comment comments = mr_9498.arg1; if (exprs.len != 1) { v__parser__Parser_error(p, _SLIT("only one expression allowed as `select` key")); v__ast__SelectExpr _t3 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); @@ -88374,6 +88639,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) v__ast__Fn func = ((v__ast__Fn){ .params = args, .generic_names = __new_array(0, 0, sizeof(string)), + .dep_names = __new_array(0, 0, sizeof(string)), .attrs = p->attrs, .mod = (string){.str=(byteptr)"", .is_lit=1}, .file = (string){.str=(byteptr)"", .is_lit=1}, @@ -88449,7 +88715,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) { array_push((array*)&_t1, &ti); } Array_string variant_names =_t1; - qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_14364895672131222426_string); + qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_16311103228414776939_string); string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}})); Array_v__ast__Type _t3 = {0}; Array_v__ast__TypeNode _t3_orig = variants; @@ -88872,7 +89138,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)),.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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 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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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,.gc_mode = v__pref__GarbageCollectionMode__unknown,.backend = 0,.ccompiler_type = 0,.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_comptime_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; @@ -88928,6 +89194,7 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -89014,6 +89281,7 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -89162,6 +89430,7 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -89258,6 +89527,7 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, + .inside_comptime_if = 0, .inside_if_expr = 0, .inside_if_cond = 0, .inside_ct_if_expr = 0, @@ -90960,9 +91230,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_49074 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_49074.arg0; - Array_v__ast__Comment left_comments = mr_49074.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_49106 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_49106.arg0; + Array_v__ast__Comment left_comments = mr_49106.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); } @@ -90975,7 +91245,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse if ((p->tok.kind == v__token__Kind__assign || p->tok.kind == v__token__Kind__decl_assign) || v__token__Kind_is_assign(p->tok.kind)) { v__ast__Stmt _t3 = v__parser__Parser_partial_assign_stmt(p, left, left_comments); return _t3; - } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { + } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !p->pref->is_vet && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr node = ((v__ast__Expr*)left.data)[_t4]; if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 295 /* v.ast.CallExpr */ && (node)._typ != 325 /* v.ast.PostfixExpr */ && (node)._typ != 300 /* v.ast.ComptimeCall */ && (node)._typ != 329 /* v.ast.SelectorExpr */ && (node)._typ != 304 /* v.ast.DumpExpr */) { @@ -91370,7 +91640,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) || (p->inside_match_case && p->tok.kind == v__token__Kind__name && p->peek_tok.pos - p->tok.pos == p->tok.len))) { + } else if (p->peek_tok.kind == v__token__Kind__lcbr && ((p->inside_if && lit0_is_capital && p->tok.lit.len > 1 && !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)) { @@ -92248,9 +92518,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_86019 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_86019.arg0; - Array_v__ast__Comment comments2 = mr_86019.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_86090 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_86090.arg0; + Array_v__ast__Comment comments2 = mr_86090.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)),}); @@ -92520,8 +92790,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_92515 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_92515.arg0; + multi_return_Array_v__ast__Type_Array_string mr_92586 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_92586.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); @@ -93831,6 +94101,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__Fn tmethod = ((v__ast__Fn){ .params = args, .generic_names = __new_array(0, 0, sizeof(string)), + .dep_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}, @@ -94944,7 +95215,7 @@ VV_LOCAL_SYMBOL void v__builder__Builder_post_process_c_compiler_output(v__build } return; } - if (res.exit_code != 0 && v->pref->gc_mode != v__pref__GarbageCollectionMode__no_gc && string_contains(res.output, _SLIT("libgc.a"))) { + if (res.exit_code != 0 && v->pref->gc_mode != v__pref__GarbageCollectionMode__no_gc && string_contains(res.output, _SLIT("libgc.a")) && !v->pref->is_o) { #if defined(_WIN32) { v__builder__verror(_SLIT("Your V installation may be out-of-date. Try removing `thirdparty\\tcc\\` and running `.\\make.bat`")); @@ -95083,6 +95354,9 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui if (v->pref->sanitize) { array_push((array*)&ccoptions.args, _MOV((string[]){ string_clone(_SLIT("-fsanitize=leak")) })); } + if (v->pref->is_o) { + array_push((array*)&ccoptions.args, _MOV((string[]){ string_clone(_SLIT("-c")) })); + } ccoptions.shared_postfix = _SLIT(".so"); #if defined(__APPLE__) { @@ -95153,15 +95427,15 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui Array_v__cflag__CFlag cflags = v__builder__Builder_get_os_cflags(v); if (v->pref->build_mode != v__pref__BuildMode__build_module) { Array_string only_o_files = Array_v__cflag__CFlag_c_options_only_object_files(cflags); - _PUSH_MANY(&ccoptions.o_args, (only_o_files), _t39, Array_string); + _PUSH_MANY(&ccoptions.o_args, (only_o_files), _t40, Array_string); } - multi_return_Array_string_Array_string_Array_string mr_12063 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_12063.arg0; - Array_string others = mr_12063.arg1; - Array_string libs = mr_12063.arg2; - _PUSH_MANY(&ccoptions.pre_args, (defines), _t40, Array_string); - _PUSH_MANY(&ccoptions.pre_args, (others), _t41, Array_string); - _PUSH_MANY(&ccoptions.linker_flags, (libs), _t42, Array_string); + multi_return_Array_string_Array_string_Array_string mr_12127 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_12127.arg0; + Array_string others = mr_12127.arg1; + Array_string libs = mr_12127.arg2; + _PUSH_MANY(&ccoptions.pre_args, (defines), _t41, Array_string); + _PUSH_MANY(&ccoptions.pre_args, (others), _t42, Array_string); + _PUSH_MANY(&ccoptions.linker_flags, (libs), _t43, Array_string); if (v->pref->use_cache && v->pref->build_mode != v__pref__BuildMode__build_module) { if (!ccoptions.is_cc_tcc) { } @@ -95327,7 +95601,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) { v__builder__Builder_build_thirdparty_obj_files(v); v__builder__Builder_setup_output_name(v); if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) { - string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); + string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); if (!os__exists(cpp_atomic_h_path)) { for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) { v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4]; @@ -95342,7 +95616,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) { } } if (_t5) { - string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); + string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter-v/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}}))); break; } @@ -95517,10 +95791,10 @@ VV_LOCAL_SYMBOL void v__builder__Builder_cc_linux_cross(v__builder__Builder* b) v__builder__Builder_ensure_linuxroot_exists(b, sysroot); string obj_file = string__plus(b->out_name_c, _SLIT(".o")); Array_v__cflag__CFlag cflags = v__builder__Builder_get_os_cflags(b); - multi_return_Array_string_Array_string_Array_string mr_23306 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_23306.arg0; - Array_string others = mr_23306.arg1; - Array_string libs = mr_23306.arg2; + multi_return_Array_string_Array_string_Array_string mr_23370 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_23370.arg0; + Array_string others = mr_23370.arg1; + Array_string libs = mr_23370.arg2; Array_string cc_args = __new_array_with_default(0, 0, sizeof(string), 0); array_push((array*)&cc_args, _MOV((string[]){ string_clone(_SLIT("-w")) })); array_push((array*)&cc_args, _MOV((string[]){ string_clone(_SLIT("-fPIC")) })); @@ -96994,7 +97268,7 @@ bool v__builder__Builder_should_rebuild(v__builder__Builder* b) { } 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); + qsort(v_program_files.data, v_program_files.len, v_program_files.element_size, (int (*)(const void *, const void *))&compare_7770354126342877024_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); @@ -97303,8 +97577,8 @@ v__util__Timers* timers; VUNREACHABLE(); } else if (string__eq(command, _SLIT("translate"))) { - eprintln(_SLIT("Translating C to V will be available in V 0.3")); - _v_exit(1); + Array_string _t10; + v__util__launch_tool(prefs->is_verbose, _SLIT("translate"), (_t10 = _const_os__args, array_slice(_t10, 1, _t10.len))); VUNREACHABLE(); } else { @@ -97476,10 +97750,9 @@ void _vinit(int ___argc, voidptr ___argv) { builtin_init(); - vinit_string_literals(); - { // Initializations for module strings : - } - { // Initializations for module math.bits : + // Initializations for module math.bits + _const_math__bits__overflow_error = _SLIT("Overflow Error"); + _const_math__bits__divide_error = _SLIT("Divide Error"); _const_math__bits__de_bruijn32tab = new_array_from_c_array(32, 32, sizeof(u8), _MOV((u8[32]){ ((u8)(0)), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, @@ -97626,8 +97899,9 @@ void _vinit(int ___argc, voidptr ___argv) { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08})); - } - { // Initializations for module strconv : + // Initializations for module strconv + _const_strconv__digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); + _const_strconv__base_digits = _SLIT("0123456789abcdefghijklmnopqrstuvwxyz"); _const_strconv__pos_exp = new_array_from_c_array(309, 309, sizeof(u64), _MOV((u64[309]){ ((u64)(0x3ff0000000000000U)), ((u64)(0x4024000000000000U)), ((u64)(0x4059000000000000U)), ((u64)(0x408f400000000000U)), ((u64)(0x40c3880000000000U)), ((u64)(0x40f86a0000000000U)), ((u64)(0x412e848000000000U)), ((u64)(0x416312d000000000U)), ((u64)(0x4197d78400000000U)), ((u64)(0x41cdcd6500000000U)), ((u64)(0x4202a05f20000000U)), ((u64)(0x42374876e8000000U)), ((u64)(0x426d1a94a2000000U)), ((u64)(0x42a2309ce5400000U)), ((u64)(0x42d6bcc41e900000U)), ((u64)(0x430c6bf526340000U)), ((u64)(0x4341c37937e08000U)), @@ -97817,19 +98091,16 @@ void _vinit(int ___argc, voidptr ___argv) { ((strconv__Uint128){.lo = ((u64)(0x4920a0d7a999ac96U)),.hi = ((u64)(0x0229f4fbbdfc73f1U)),}), ((strconv__Uint128){.lo = ((u64)(0x750101590f5c4757U)),.hi = ((u64)(0x037654c5fcc71fe8U)),}), ((strconv__Uint128){.lo = ((u64)(0x2a6734473f7d05dfU)),.hi = ((u64)(0x02c5109e63d27fedU)),}), ((strconv__Uint128){.lo = ((u64)(0xeeb8f69f65fd9e4cU)),.hi = ((u64)(0x0237407eb641fff0U)),}), ((strconv__Uint128){.lo = ((u64)(0xe45b24323cc8fd46U)),.hi = ((u64)(0x038b9a6456cfffe7U)),}), ((strconv__Uint128){.lo = ((u64)(0xb6af502830a0ca9fU)),.hi = ((u64)(0x02d6151d123fffecU)),}), ((strconv__Uint128){.lo = ((u64)(0xf88c402026e7087fU)),.hi = ((u64)(0x0244ddb0db666656U)),}), ((strconv__Uint128){.lo = ((u64)(0x2746cd003e3e73feU)),.hi = ((u64)(0x03a162b4923d708bU)),}), ((strconv__Uint128){.lo = ((u64)(0x1f6bd73364fec332U)),.hi = ((u64)(0x02e7822a0e978d3cU)),}), ((strconv__Uint128){.lo = ((u64)(0xe5efdf5c50cbcf5bU)),.hi = ((u64)(0x0252ce880bac70fcU)),}), ((strconv__Uint128){.lo = ((u64)(0x3cb2fefa1adfb22bU)),.hi = ((u64)(0x03b7b0d9ac471b2eU)),}), ((strconv__Uint128){.lo = ((u64)(0x308f3261af195b56U)),.hi = ((u64)(0x02f95a47bd05af58U)),}), ((strconv__Uint128){.lo = ((u64)(0x5a0c284e25ade2abU)),.hi = ((u64)(0x0261150630d15913U)),}), ((strconv__Uint128){.lo = ((u64)(0x29ad0d49d5e30445U)),.hi = ((u64)(0x03ce8809e7b55b52U)),}), ((strconv__Uint128){.lo = ((u64)(0x548a7107de4f369dU)),.hi = ((u64)(0x030ba007ec9115dbU)),}), ((strconv__Uint128){.lo = ((u64)(0xdd3b8d9fe50c2bb1U)),.hi = ((u64)(0x026fb3398a0dab15U)),}), ((strconv__Uint128){.lo = ((u64)(0x952c15cca1ad12b5U)),.hi = ((u64)(0x03e5eb8f434911bcU)),}), ((strconv__Uint128){.lo = ((u64)(0x775677d6e7bda891U)),.hi = ((u64)(0x031e560c35d40e30U)),}), ((strconv__Uint128){.lo = ((u64)(0xc5dec645863153a7U)),.hi = ((u64)(0x027eab3cf7dcd826U)),})})); - } - { // Initializations for module builtin : + // Initializations for module builtin + _const_digit_pairs = _SLIT("00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999"); + _const_si_s_code = _SLIT("0xfe10"); + _const_si_g32_code = _SLIT("0xfe0e"); + _const_si_g64_code = _SLIT("0xfe0f"); _const_none__ = /*&IError*/I_None___to_Interface_IError(((None__*)memdup(&(None__){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(None__)))); _const_children_bytes = sizeof(voidptr) * (_const_max_len + 1); - } - { // Initializations for module strings.textscanner : - } - { // Initializations for module dl : + // Initializations for module dl _const_dl__dl_ext = dl__get_shared_library_extension(); - } - { // Initializations for module os.cmdline : - } - { // Initializations for module v.token : + // Initializations for module v.token _const_v__token__assign_tokens = new_array_from_c_array(12, 12, sizeof(v__token__Kind), _MOV((v__token__Kind[12]){ v__token__Kind__assign, v__token__Kind__plus_assign, v__token__Kind__minus_assign, v__token__Kind__mult_assign, v__token__Kind__div_assign, v__token__Kind__xor_assign, v__token__Kind__mod_assign, v__token__Kind__or_assign, v__token__Kind__and_assign, v__token__Kind__right_shift_assign, v__token__Kind__left_shift_assign, v__token__Kind__unsigned_right_shift_assign})); @@ -97838,12 +98109,11 @@ void _vinit(int ___argc, voidptr ___argv) { _SLIT("@LINE"), _SLIT("@COLUMN"), _SLIT("@VHASH"), _SLIT("@VMOD_FILE")})); _const_v__token__token_str = v__token__build_token_str(); _const_v__token__keywords = v__token__build_keys(); - _const_v__token__matcher = v__token__new_keywords_matcher_T_v__token__Kind(_const_v__token__keywords); _const_v__token__precedences = v__token__build_precedences(); - } - { // Initializations for module v.mathutil : - } - { // Initializations for module time : + _const_v__token__matcher = v__token__new_keywords_matcher_T_v__token__Kind(_const_v__token__keywords); + // Initializations for module time + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), _SLIT("HH"), _SLIT("ZZ"), _SLIT("dd"), _SLIT("Qo"), _SLIT("QQ"), _SLIT("wo"), _SLIT("ww")})); @@ -97861,99 +98131,76 @@ void _vinit(int ___argc, voidptr ___argv) { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365})); _const_time__nanosecond = ((time__Duration)(1)); + _const_time__infinite = ((((i64)(9223372036854775807)))); + _const_time__start_time = time__init_win_time_start(); + _const_time__freq_time = time__init_win_time_freq(); + _const_time__start_local_time = time__local_as_unix_time(); _const_time__microsecond = ((1000 * _const_time__nanosecond)); _const_time__millisecond = ((1000 * _const_time__microsecond)); _const_time__second = ((1000 * _const_time__millisecond)); _const_time__minute = ((60 * _const_time__second)); _const_time__hour = ((60 * _const_time__minute)); - _const_time__infinite = ((((i64)(9223372036854775807)))); - _const_time__start_time = time__init_win_time_start(); - _const_time__freq_time = time__init_win_time_freq(); - _const_time__start_local_time = time__local_as_unix_time(); - } - { // Initializations for module v.dotgraph : - } - { // Initializations for module hash : - } - { // Initializations for module rand.constants : + // Initializations for module rand.constants _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; - } - { // Initializations for module hash.fnv1a : - } - { // Initializations for module rand.buffer : - } - { // Initializations for module flag : - } - { // Initializations for module semver : + // Initializations for module flag + _const_flag__space = _SLIT(" "); + _const_flag__underline = _SLIT("-----------------------------------------------"); + // Initializations for module semver + _const_semver__comparator_sep = _SLIT(" "); + _const_semver__comparator_set_sep = _SLIT(" || "); + _const_semver__hyphen_range_sep = _SLIT(" - "); + _const_semver__x_range_symbols = _SLIT("Xx*"); _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); - } - { // Initializations for module sync.stdatomic : - } - { // Initializations for module sync.threads : - } - { // Initializations for module os : + // Initializations for module os + _const_os__fslash_str = _SLIT("/"); + _const_os__dot_dot = _SLIT(".."); + _const_os__empty_str = _SLIT(""); + _const_os__dot_str = _SLIT("."); + _const_os__path_separator = _SLIT("\\"); + _const_os__path_delimiter = _SLIT(";"); _const_os__invalid_handle_value = ((voidptr)(-1)); _const_os__hkey_local_machine = ((voidptr)(0x80000002)); _const_os__hkey_current_user = ((voidptr)(0x80000001)); _const_os__hwnd_broadcast = ((voidptr)(0xFFFF)); _const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv); _const_os__wd_at_startup = os__getwd(); - } - { // Initializations for module v.errors : - } - { // Initializations for module v.depgraph : - } - { // Initializations for module v.vet : - } - { // Initializations for module rand.seed : - } - { // Initializations for module term : - } - { // Initializations for module v.util.version : - } - { // Initializations for module v.vcache : - } - { // Initializations for module v.util.diff : - } - { // Initializations for module v.vmod : + // Initializations for module v.util.version + _const_v__util__version__v_version = _SLIT("0.2.4"); + // Initializations for module v.vmod + _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); - } - { // Initializations for module v.util.recompilation : - } - { // Initializations for module v.cflag : - } - { // Initializations for module rand.config : - } - { // Initializations for module rand.wyrand : - } - { // Initializations for module v.pkgconfig : + // Initializations for module v.cflag + _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); + // Initializations for module v.pkgconfig + _const_v__pkgconfig__version = _SLIT("0.3.2"); _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), _SLIT("/opt/homebrew/lib/pkgconfig"), _SLIT("/usr/local/libdata/pkgconfig")})); - } - { // Initializations for module runtime : - } - { // Initializations for module rand : + // Initializations for module rand + _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); + _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); + _const_rand__hex_chars = _SLIT("abcdef0123456789"); + _const_rand__ascii_chars = _SLIT("!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~"); _const_rand__clock_seq_hi_and_reserved_valid_values = new_array_from_c_array(4, 4, sizeof(rune), _MOV((rune[4]){'8', '9', 'a', 'b'})); default_rng = *(rand__PRNG**)&((rand__PRNG*[]){0}[0]); // global rand__init(); - } - { // Initializations for module v.pref : - _const_v__pref__default_module_path = os__vmodules_dir(); + // Initializations for module v.pref _const_v__pref__list_of_flags_with_param = new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ _SLIT("o"), _SLIT("d"), _SLIT("define"), _SLIT("b"), _SLIT("backend"), _SLIT("cc"), _SLIT("os"), _SLIT("target-os"), _SLIT("cf"), _SLIT("cflags"), _SLIT("path"), _SLIT("arch")})); - } - { // Initializations for module sync : - } - { // Initializations for module help : - } - { // Initializations for module v.util : + _const_v__pref__default_module_path = os__vmodules_dir(); + // Initializations for module help + _const_help__unknown_topic = _SLIT("`v help`: unknown help topic provided. Use `v help` for usage information."); + // Initializations for module v.util + _const_v__util__double_escape = _SLIT("\\\\"); + _const_v__util__map_prefix = _SLIT("map[string]"); _const_v__util__emanager = v__util__new_error_manager(); _const_v__util__normalised_workdir = string__plus(string_replace(_const_os__wd_at_startup, _SLIT("\\"), _SLIT("/")), _SLIT("/")); + 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 _const_v__util__invalid_escapes = string_bytes(_SLIT("({$`.")); + g_timers = v__util__new_timers(((v__util__TimerParams){.should_print = false,.label = _SLIT("g_timers"),})); // 3global _const_v__util__builtin_module_parts = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("math.bits"), _SLIT("strconv"), _SLIT("dlmalloc"), _SLIT("strconv.ftoa"), _SLIT("strings"), _SLIT("builtin")})); _const_v__util__bundle_modules = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("clipboard"), _SLIT("fontstash"), _SLIT("gg"), _SLIT("gx"), _SLIT("sokol"), _SLIT("szip"), _SLIT("ui")})); _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), @@ -97969,13 +98216,9 @@ 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")})); - 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 - } - { // Initializations for module sync.pool : + // Initializations for module sync.pool _const_sync__pool__no_result = ((voidptr)(0)); - } - { // Initializations for module v.ast : + // Initializations for module v.ast _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), _MOV((int[4]){ 8, @@ -98132,6 +98375,13 @@ void _vinit(int ___argc, voidptr ___argv) { ; _const_v__ast__native_builtins = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("assert"), _SLIT("print"), _SLIT("eprint"), _SLIT("println"), _SLIT("eprintln"), _SLIT("exit"), _SLIT("C.syscall")})); + _const_v__ast__builtin_type_names = new_array_from_c_array(30, 30, sizeof(string), _MOV((string[30]){ + _SLIT("void"), _SLIT("voidptr"), _SLIT("byteptr"), _SLIT("charptr"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("isize"), + _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("usize"), _SLIT("f32"), _SLIT("f64"), _SLIT("char"), + _SLIT("bool"), _SLIT("none"), _SLIT("string"), _SLIT("rune"), _SLIT("array"), _SLIT("map"), _SLIT("chan"), _SLIT("any"), + _SLIT("float_literal"), _SLIT("int_literal"), _SLIT("thread"), _SLIT("Error"), _SLIT("u8")})); + _const_v__ast__ovoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__optional); + _const_v__ast__rvoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__result); _const_v__ast__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0}, .name = _SLIT("InvalidType"), @@ -98145,11 +98395,6 @@ void _vinit(int ___argc, voidptr ___argv) { .language = v__ast__Language__v, .is_pub = 0, }, sizeof(v__ast__TypeSymbol))); - _const_v__ast__builtin_type_names = new_array_from_c_array(30, 30, sizeof(string), _MOV((string[30]){ - _SLIT("void"), _SLIT("voidptr"), _SLIT("byteptr"), _SLIT("charptr"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("isize"), - _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("usize"), _SLIT("f32"), _SLIT("f64"), _SLIT("char"), - _SLIT("bool"), _SLIT("none"), _SLIT("string"), _SLIT("rune"), _SLIT("array"), _SLIT("map"), _SLIT("chan"), _SLIT("any"), - _SLIT("float_literal"), _SLIT("int_literal"), _SLIT("thread"), _SLIT("Error"), _SLIT("u8")})); _const_v__ast__builtin_type_names_matcher = v__ast__build_builtin_type_names_matcher(); _const_v__ast__integer_type_idxs = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ _const_v__ast__i8_type_idx, _const_v__ast__i16_type_idx, _const_v__ast__int_type_idx, _const_v__ast__i64_type_idx, _const_v__ast__byte_type_idx, _const_v__ast__u16_type_idx, _const_v__ast__u32_type_idx, _const_v__ast__u64_type_idx, _const_v__ast__isize_type_idx, @@ -98164,8 +98409,6 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__pointer_type_idxs = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_v__ast__voidptr_type_idx, _const_v__ast__byteptr_type_idx, _const_v__ast__charptr_type_idx})); _const_v__ast__string_type_idxs = new_array_from_c_array(1, 1, sizeof(int), _MOV((int[1]){_const_v__ast__string_type_idx})); _const_v__ast__void_type = v__ast__new_type(_const_v__ast__void_type_idx); - _const_v__ast__ovoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__optional); - _const_v__ast__rvoid_type = v__ast__Type_set_flag(v__ast__new_type(_const_v__ast__void_type_idx), v__ast__TypeFlag__result); _const_v__ast__voidptr_type = v__ast__new_type(_const_v__ast__voidptr_type_idx); _const_v__ast__byteptr_type = v__ast__new_type(_const_v__ast__byteptr_type_idx); _const_v__ast__charptr_type = v__ast__new_type(_const_v__ast__charptr_type_idx); @@ -98194,12 +98437,13 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__int_literal_type = v__ast__new_type(_const_v__ast__int_literal_type_idx); _const_v__ast__thread_type = v__ast__new_type(_const_v__ast__thread_type_idx); _const_v__ast__error_type = v__ast__new_type(_const_v__ast__error_type_idx); - _const_v__ast__charptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__charptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__char_type_idx), 1)})); - _const_v__ast__byteptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__byteptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__byte_type_idx), 1)})); - _const_v__ast__voidptr_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){_const_v__ast__voidptr_type, v__ast__Type_set_nr_muls(v__ast__new_type(_const_v__ast__voidptr_type_idx), 1)})); + _const_v__ast__charptr_types = v__ast__new_charptr_types(); + _const_v__ast__byteptr_types = v__ast__new_byteptr_types(); + _const_v__ast__voidptr_types = v__ast__new_voidptr_types(); _const_v__ast__cptr_types = v__ast__merge_types(new_array_from_c_array(3, 3, sizeof(Array_v__ast__Type), _MOV((Array_v__ast__Type[3]){_const_v__ast__voidptr_types, _const_v__ast__byteptr_types, _const_v__ast__charptr_types}))); - } - { // Initializations for module v.checker : + // Initializations for module v.checker + _const_v__checker__vroot_is_deprecated_message = _SLIT("@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead"); + _const_v__checker__unicode_lit_overflow_message = _SLIT("unicode character exceeds max allowed value of 0x10ffff, consider using a unicode literal (\\u####)"); _const_v__checker__int_min = ((int)(0x80000000)); _const_v__checker__valid_comptime_if_os = new_array_from_c_array(19, 19, sizeof(string), _MOV((string[19]){ _SLIT("windows"), _SLIT("ios"), _SLIT("macos"), _SLIT("mach"), _SLIT("darwin"), _SLIT("hpux"), _SLIT("gnu"), _SLIT("qnx"), _SLIT("linux"), @@ -98212,19 +98456,30 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__checker__valid_comptime_if_other = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("apk"), _SLIT("js"), _SLIT("debug"), _SLIT("prod"), _SLIT("test"), _SLIT("glibc"), _SLIT("prealloc"), _SLIT("no_bounds_checking"), _SLIT("freestanding"), _SLIT("threads"), _SLIT("js_node"), _SLIT("js_browser"), _SLIT("js_freestanding"), _SLIT("interpreter"), _SLIT("es5"), _SLIT("profile")})); - _const_v__checker__valid_comptime_not_user_defined = v__checker__all_valid_comptime_idents(); _const_v__checker__array_builtin_methods = new_array_from_c_array(15, 15, sizeof(string), _MOV((string[15]){ _SLIT("filter"), _SLIT("clone"), _SLIT("repeat"), _SLIT("reverse"), _SLIT("map"), _SLIT("slice"), _SLIT("sort"), _SLIT("contains"), _SLIT("index"), _SLIT("wait"), _SLIT("any"), _SLIT("all"), _SLIT("first"), _SLIT("last"), _SLIT("pop")})); _const_v__checker__reserved_type_names = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("byte"), _SLIT("bool"), _SLIT("char"), _SLIT("i8"), _SLIT("i16"), _SLIT("int"), _SLIT("i64"), _SLIT("u8"), _SLIT("u16"), _SLIT("u32"), _SLIT("u64"), _SLIT("f32"), _SLIT("f64"), _SLIT("map"), _SLIT("string"), _SLIT("rune")})); - } - { // Initializations for module v.transformer : - } - { // Initializations for module v.markused : - } - { // Initializations for module v.gen.c : + _const_v__checker__valid_comptime_not_user_defined = v__checker__all_valid_comptime_idents(); + // Initializations for module v.gen.c + _const_v__gen__c__si_s_code = _SLIT("0xfe10"); + _const_v__gen__c__result_name = _SLIT("_result"); + _const_v__gen__c__option_name = _SLIT("_option"); + _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); + _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); + _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); + _const_v__gen__c__c_common_macros = _SLIT("\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\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n\011#define __V_arm32 1\n\011#undef __V_architecture\n\011#define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n\011#define __V_x86 1\n\011#undef __V_architecture\n\011#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\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#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\011#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\011#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\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#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\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n\011#if defined(__MINGW32__) || defined(__MINGW64__)\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); + _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\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"); + _const_v__gen__c__c_helper_macros = _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"); + _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_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\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__c_wyhash_headers = _SLIT("\n// ============== wyhash ==============\n#ifndef wyhash_final_version_3\n#define wyhash_final_version_3\n\n#ifndef WYHASH_CONDOM\n// protections that produce different results:\n// 1: normal valid behavior\n// 2: extra protection against entropy loss (probability=2^-63), aka. \"blind multiplication\"\n#define WYHASH_CONDOM 1\n#endif\n\n#ifndef WYHASH_32BIT_MUM\n// 0: normal version, slow on 32 bit systems\n// 1: faster on 32 bit systems but produces different results, incompatible with wy2u0k function\n#define WYHASH_32BIT_MUM 0\n#endif\n\n// includes\n#include \n#if defined(_MSC_VER) && defined(_M_X64)\n\011#include \n\011#pragma intrinsic(_umul128)\n#endif\n\n// 128bit multiply function\nstatic inline uint64_t _wyrot(uint64_t x) { return (x>>32)|(x<<32); }\nstatic inline void _wymum(uint64_t *A, uint64_t *B){\n#if(WYHASH_32BIT_MUM)\n\011uint64_t hh=(*A>>32)*(*B>>32), hl=(*A>>32)*(uint32_t)*B, lh=(uint32_t)*A*(*B>>32), ll=(uint64_t)(uint32_t)*A*(uint32_t)*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=_wyrot(hl)^hh; *B^=_wyrot(lh)^ll;\n\011#else\n\011*A=_wyrot(hl)^hh; *B=_wyrot(lh)^ll;\n\011#endif\n#elif defined(__SIZEOF_INT128__) && !defined(VWASM)\n\011__uint128_t r=*A; r*=*B;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=(uint64_t)r; *B^=(uint64_t)(r>>64);\n\011#else\n\011*A=(uint64_t)r; *B=(uint64_t)(r>>64);\n\011#endif\n#elif defined(_MSC_VER) && defined(_M_X64)\n\011#if(WYHASH_CONDOM>1)\n\011uint64_t a, b;\n\011a=_umul128(*A,*B,&b);\n\011*A^=a; *B^=b;\n\011#else\n\011*A=_umul128(*A,*B,B);\n\011#endif\n#else\n\011uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B, hi, lo;\n\011uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t>32)+(rm1>>32)+c;\n\011#if(WYHASH_CONDOM>1)\n\011*A^=lo; *B^=hi;\n\011#else\n\011*A=lo; *B=hi;\n\011#endif\n#endif\n}\n\n// multiply and xor mix function, aka MUM\nstatic inline uint64_t _wymix(uint64_t A, uint64_t B){ _wymum(&A,&B); return A^B; }\n\n// endian macros\n#ifndef WYHASH_LITTLE_ENDIAN\n\011#ifdef TARGET_ORDER_IS_LITTLE\n\011\011#define WYHASH_LITTLE_ENDIAN 1\n\011#else\n\011\011#define WYHASH_LITTLE_ENDIAN 0\n\011#endif\n#endif\n\n// read functions\n#if (WYHASH_LITTLE_ENDIAN)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return v;}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return v;}\n#elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return __builtin_bswap64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return __builtin_bswap32(v);}\n#elif defined(_MSC_VER)\n\011static inline uint64_t _wyr8(const uint8_t *p) { uint64_t v; memcpy(&v, p, 8); return _byteswap_uint64(v);}\n\011static inline uint64_t _wyr4(const uint8_t *p) { uint32_t v; memcpy(&v, p, 4); return _byteswap_ulong(v);}\n#else\n\011static inline uint64_t _wyr8(const uint8_t *p) {\n\011\011uint64_t v; memcpy(&v, p, 8);\n\011\011return (((v >> 56) & 0xff)| ((v >> 40) & 0xff00)| ((v >> 24) & 0xff0000)| ((v >> 8) & 0xff000000)| ((v << 8) & 0xff00000000)| ((v << 24) & 0xff0000000000)| ((v << 40) & 0xff000000000000)| ((v << 56) & 0xff00000000000000));\n\011}\n\011static inline uint64_t _wyr4(const uint8_t *p) {\n\011\011uint32_t v; memcpy(&v, p, 4);\n\011\011return (((v >> 24) & 0xff)| ((v >> 8) & 0xff00)| ((v << 8) & 0xff0000)| ((v << 24) & 0xff000000));\n\011}\n#endif\nstatic inline uint64_t _wyr3(const uint8_t *p, size_t k) { return (((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1];}\n// wyhash main function\nstatic inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const uint64_t *secret){\n\011const uint8_t *p=(const uint8_t *)key; seed^=*secret;\011uint64_t a, b;\n\011if (_likely_(len<=16)) {\n\011\011if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); }\n\011\011else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; }\n\011\011else a=b=0;\n\011} else {\n\011\011size_t i=len;\n\011\011if (_unlikely_(i>48)) {\n\011\011\011uint64_t see1=seed, see2=seed;\n\011\011\011do {\n\011\011\011\011seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed);\n\011\011\011\011see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1);\n\011\011\011\011see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2);\n\011\011\011\011p+=48; i-=48;\n\011\011\011} while(_likely_(i>48));\n\011\011\011seed^=see1^see2;\n\011\011}\n\011\011while(_unlikely_(i>16)) { seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; }\n\011\011a=_wyr8(p+i-16); b=_wyr8(p+i-8);\n\011}\n\011return _wymix(secret[1]^len,_wymix(a^secret[1],b^seed));\n}\n// the default secret parameters\nstatic const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0x8ebc6af09c88c6e3ull, 0x589965cc75374cc3ull};\n\n// a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand\nstatic inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642full; B^=0xe7037ed1a0b428dbull; _wymum(&A,&B); return _wymix(A^0xa0761d6478bd642full,B^0xe7037ed1a0b428dbull);}\n\n// the wyrand PRNG that pass BigCrush and PractRand\nstatic inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}\n\n#ifndef __vinix__\n// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;}\n\n// convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;}\n#endif\n\n#if(!WYHASH_32BIT_MUM)\n// fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash.\nstatic inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; }\n#endif\n#endif\n\n#define _IN_MAP(val, m) map_exists(m, val)\n\n"); + _const_v__gen__c__closure_ctx = _SLIT("_V_closure_ctx"); + _const_v__gen__c__posix_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); + _const_v__gen__c__windows_hotcode_definitions_1 = _SLIT("\nvoid v_bind_live_symbols(void* live_lib){\n\011@LOAD_FNS@\n}\n"); _const_v__gen__c__unsupported_ctemp_assert_transform = I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(((v__gen__c__UnsupportedAssertCtempTransform*)memdup(&(v__gen__c__UnsupportedAssertCtempTransform){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(v__gen__c__UnsupportedAssertCtempTransform)))); _const_v__gen__c__c_reserved = new_array_from_c_array(60, 60, sizeof(string), _MOV((string[60]){ _SLIT("array"), _SLIT("auto"), _SLIT("bool"), _SLIT("break"), _SLIT("calloc"), _SLIT("case"), _SLIT("char"), _SLIT("class"), _SLIT("complex"), @@ -98235,39 +98490,29 @@ void _vinit(int ___argc, voidptr ___argv) { _SLIT("sizeof"), _SLIT("static"), _SLIT("string"), _SLIT("struct"), _SLIT("switch"), _SLIT("typedef"), _SLIT("typename"), _SLIT("union"), _SLIT("unix"), _SLIT("unsigned"), _SLIT("void"), _SLIT("volatile"), _SLIT("while"), _SLIT("template"), _SLIT("true"), _SLIT("small"), _SLIT("stdout"), _SLIT("stdin"), _SLIT("stderr")})); - _const_v__gen__c__c_reserved_map = v__gen__c__string_array_to_map(_const_v__gen__c__c_reserved); _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 #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")})); - } - { // Initializations for module v.scanner : - } - { // Initializations for module v.ast.walker : - } - { // Initializations for module v.parser : + _const_v__gen__c__c_reserved_map = v__gen__c__string_array_to_map(_const_v__gen__c__c_reserved); + _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)})); + // Initializations for module v.parser + _const_v__parser__tmpl_str_end = _SLIT("')\n"); _const_v__parser__supported_comptime_calls = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("html"), _SLIT("tmpl"), _SLIT("env"), _SLIT("embed_file"), _SLIT("pkgconfig"), _SLIT("compile_error"), _SLIT("compile_warn")})); _const_v__parser__comptime_types = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("Map"), _SLIT("Array"), _SLIT("Int"), _SLIT("Float"), _SLIT("Struct"), _SLIT("Interface"), _SLIT("Enum"), _SLIT("Sumtype")})); - _const_v__parser__valid_tokens_inside_types = new_array_from_c_array(7, 7, sizeof(v__token__Kind), _MOV((v__token__Kind[7]){v__token__Kind__lsbr, v__token__Kind__rsbr, v__token__Kind__name, v__token__Kind__dot, v__token__Kind__comma, v__token__Kind__key_fn, v__token__Kind__lt})); codegen_files = __new_array_with_default(0, 0, sizeof(v__ast__File*), 0); // 3global - } - { // Initializations for module v.callgraph : - } - { // Initializations for module v.builder : + _const_v__parser__valid_tokens_inside_types = new_array_from_c_array(7, 7, sizeof(v__token__Kind), _MOV((v__token__Kind[7]){v__token__Kind__lsbr, v__token__Kind__rsbr, v__token__Kind__name, v__token__Kind__dot, v__token__Kind__comma, v__token__Kind__key_fn, v__token__Kind__lt})); + // Initializations for module v.builder + _const_v__builder__c_verror_message_marker = _SLIT("VERROR_MESSAGE "); + _const_v__builder__c_error_info = _SLIT("\n==================\nC error. This should never happen.\n\nThis is a compiler bug, please report it using `v bug file.v`.\n\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use #help on Discord: https://discord.gg/vlang\n"); + _const_v__builder__no_compiler_error = _SLIT("\n==================\nError: no C compiler detected.\n\nYou can find instructions on how to install one in the V wiki:\nhttps://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows\n\nIf you think you have one installed, make sure it is in your PATH.\nIf you do have one in your PATH, please raise an issue on GitHub:\nhttps://github.com/vlang/v/issues/new/choose\n\nYou can also use `v doctor`, to see what V knows about your current environment.\n\nYou can also seek #help on Discord: https://discord.gg/vlang\n"); _const_v__builder__hkey_local_machine = ((v__builder__RegKey)(0x80000002)); - } - { // Initializations for module v.builder.cbuilder : - } - { // Initializations for module main : + // Initializations for module main _const_main__external_tools = new_array_from_c_array(33, 33, sizeof(string), _MOV((string[33]){ _SLIT("ast"), _SLIT("bin2v"), _SLIT("bug"), _SLIT("build-examples"), _SLIT("build-tools"), _SLIT("build-vbinaries"), _SLIT("bump"), _SLIT("check-md"), _SLIT("complete"), _SLIT("compress"), _SLIT("doc"), _SLIT("doctor"), _SLIT("fmt"), _SLIT("gret"), _SLIT("missdoc"), _SLIT("repl"), _SLIT("self"), _SLIT("setup-freetype"), _SLIT("shader"), _SLIT("should-compile-all"), _SLIT("symlink"), _SLIT("scan"), _SLIT("test"), _SLIT("test-all"), _SLIT("test-cleancode"), _SLIT("test-fmt"), _SLIT("test-parser"), _SLIT("test-self"), _SLIT("tracev"), _SLIT("up"), _SLIT("vet"), _SLIT("wipe-cache"), _SLIT("watch")})); _const_main__list_of_flags_that_allow_duplicates = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("cc"), _SLIT("d"), _SLIT("define"), _SLIT("cf"), _SLIT("cflags")})); - } } void _vcleanup(void) { }