diff --git a/v.c b/v.c index 4c0661b..e4335aa 100644 --- a/v.c +++ b/v.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "3baf1741b" +#define V_COMMIT_HASH "41857b0ac" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "91a9137b3" + #define V_COMMIT_HASH "3baf1741b" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "3baf174" + #define V_CURRENT_COMMIT_HASH "41857b0" #endif // V comptime_definitions: @@ -661,6 +661,10 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in #undef VWEAK #define VWEAK #endif + #if defined(__MINGW32__) || defined(__MINGW64__) + #undef VWEAK + #define VWEAK + #endif #endif #if !defined(VNORETURN) @@ -718,11 +722,6 @@ typedef int (*qsort_callback_func)(const void*, const void*); #if defined __has_include #if __has_include () #include - #else - // Most probably musl OR __ANDROID__ ... - int backtrace (void **__array, int __size) { return 0; } - char **backtrace_symbols (void *const *__array, int __size){ return 0; } - void backtrace_symbols_fd (void *const *__array, int __size, int __fd){} #endif #endif #endif @@ -2722,6 +2721,12 @@ typedef enum { v__ast__Kind__thread, // +38 } v__ast__Kind; +typedef enum { + v__checker__ComptimeBranchSkipState__eval, // + v__checker__ComptimeBranchSkipState__skip, // +1 + v__checker__ComptimeBranchSkipState__unknown, // +2 +} v__checker__ComptimeBranchSkipState; + typedef enum { v__gen__c__StrIntpType__si_no_str = 0, // 0 v__gen__c__StrIntpType__si_c, // 0+1 @@ -3883,37 +3888,37 @@ struct v__builder__MsvcResult { struct v__ast__Table { - string parsing_type; - Array_v__ast__TypeSymbol_ptr type_symbols; Map_string_int type_idxs; Map_string_v__ast__Fn fns; Map_string_Array_v__ast__Type iface_types; Map_int_string dumps; - Array_string imports; - Array_string modules; - v__ast__Scope* global_scope; - Array_v__cflag__CFlag cflags; - Array_string redefined_fns; Map_string_Array_Array_v__ast__Type fn_generic_types; Map_int_v__ast__InterfaceDecl interfaces; - string cmod_prefix; - bool is_fmt; Map_string_bool used_fns; Map_string_bool used_consts; Map_string_bool used_globals; - Array_v__ast__Type used_vweb_types; - int used_maps; - v__ast__FnPanicHandler panic_handler; - voidptr panic_userdata; - int panic_npanics; - v__ast__FnDecl* cur_fn; - Array_v__ast__Type cur_concrete_types; - int gostmts; Map_string_v__ast__EnumDecl enum_decls; Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + Array_v__ast__TypeSymbol_ptr type_symbols; + Array_string imports; + Array_string modules; + Array_v__cflag__CFlag cflags; + Array_string redefined_fns; + Array_v__ast__Type used_vweb_types; + Array_v__ast__Type cur_concrete_types; + string parsing_type; + string cmod_prefix; + v__ast__Scope* global_scope; + v__ast__FnDecl* cur_fn; + int used_maps; + int panic_npanics; + int gostmts; int pointer_size; + v__ast__FnPanicHandler panic_handler; + voidptr panic_userdata; + bool is_fmt : 1; }; @@ -3994,13 +3999,13 @@ struct v__token__WIndex { typedef Array_v__token__WIndex Array_fixed_Array_v__token__WIndex_20 [20]; struct v__token__Token { - v__token__Kind kind; string lit; int line_nr; int col; int pos; int len; int tidx; + v__token__Kind kind : 7; }; @@ -4120,12 +4125,12 @@ struct v__ast__Scope { struct v__ast__EmbeddedFile { + Array_u8 bytes; string rpath; string apath; string compression_type; - bool is_compressed; - Array_u8 bytes; int len; + bool is_compressed : 1; }; @@ -4138,11 +4143,11 @@ struct v__ast__IdentFn { struct v__ast__IdentVar { v__ast__Type typ; - bool is_mut; - bool is_static; - bool is_volatile; - bool is_optional; - v__ast__ShareType share; + v__ast__ShareType share : 2; + bool is_mut : 1; + bool is_static : 1; + bool is_volatile : 1; + bool is_optional : 1; }; @@ -4165,28 +4170,31 @@ struct v__ast__Struct { Array_v__ast__Attr attrs; Array_v__ast__Type embeds; Array_v__ast__StructField fields; - bool is_typedef; - bool is_union; - bool is_heap; - bool is_generic; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool is_typedef : 1; + bool is_union : 1; + bool is_heap : 1; + bool is_minify : 1; + bool is_generic : 1; }; struct v__ast__TypeSymbol { - int parent_idx; + Array_v__ast__Fn methods; v__ast__TypeInfo info; - v__ast__Kind kind; string name; string cname; - Array_v__ast__Fn methods; string mod; - bool is_pub; - v__ast__Language language; + int parent_idx; int idx; + int size; + int align; + v__ast__Kind kind : 6; + v__ast__Language language : 4; + bool is_pub : 1; }; @@ -4207,42 +4215,42 @@ struct v__ast__GetEmbedsOptions { struct v__ast__Alias { v__ast__Type parent_type; - v__ast__Language language; - bool is_import; + v__ast__Language language : 4; + bool is_import : 1; }; struct v__ast__Interface { + Map_int_Array_v__ast__Type conversions; Array_v__ast__Type types; Array_v__ast__StructField fields; Array_v__ast__Fn methods; Array_v__ast__Type embeds; - Map_int_Array_v__ast__Type conversions; - bool is_generic; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool is_generic : 1; }; struct v__ast__SumType { Array_v__ast__StructField fields; - bool found_fields; - bool is_anon; - bool is_generic; Array_v__ast__Type variants; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool found_fields : 1; + bool is_anon : 1; + bool is_generic : 1; }; struct v__ast__ArrayFixed { - int size; v__ast__Expr size_expr; + int size; v__ast__Type elem_type; }; @@ -4278,13 +4286,14 @@ struct v__ast__Enum { Array_string vals; bool is_flag; bool is_multi_allowed; + bool uses_exprs; }; struct v__ast__FnSignatureOpts { - bool skip_receiver; - bool type_only; + bool skip_receiver : 1; + bool type_only : 1; }; @@ -4307,40 +4316,40 @@ struct v__transformer__IndexState { struct v__scanner__Scanner { - string file_path; - string file_base; - string text; - int pos; - int line_nr; - int last_nl_pos; - bool is_crlf; - bool is_inside_string; - bool is_inter_start; - bool is_inter_end; - bool is_enclosed_inter; - string line_comment; - int last_lt; - bool is_started; - bool is_print_line_on_error; - bool is_print_colored_error; - bool is_print_rel_paths_on_error; - u8 quote; - u8 inter_quote; - int nr_lines; - bool is_vh; - bool is_fmt; - v__scanner__CommentsMode comments_mode; - bool is_inside_toplvl_statement; Array_v__token__Token all_tokens; - int tidx; - int eofs; - v__pref__Preferences* pref; Array_string error_details; Array_v__errors__Error errors; Array_v__errors__Warning warnings; Array_v__errors__Notice notices; Array_v__vet__Error vet_errors; - bool should_abort; + string file_path; + string file_base; + string text; + string line_comment; + v__pref__Preferences* pref; + int pos; + int line_nr; + int last_nl_pos; + int last_lt; + int nr_lines; + int tidx; + int eofs; + u8 quote; + u8 inter_quote; + v__scanner__CommentsMode comments_mode : 2; + bool is_crlf : 1; + bool is_inside_string : 1; + bool is_inter_start : 1; + bool is_inter_end : 1; + bool is_enclosed_inter : 1; + bool is_started : 1; + bool is_print_line_on_error : 1; + bool is_print_colored_error : 1; + bool is_print_rel_paths_on_error : 1; + bool is_vh : 1; + bool is_fmt : 1; + bool is_inside_toplvl_statement : 1; + bool should_abort : 1; }; @@ -4658,102 +4667,104 @@ struct os__Process { struct v__pref__Preferences { - v__pref__OS os; - v__pref__Backend backend; - v__pref__BuildMode build_mode; - v__pref__Arch arch; - v__pref__OutputMode output_mode; - bool is_verbose; - bool is_test; - bool is_script; - bool is_vsh; - bool is_livemain; - bool is_liveshared; - bool is_shared; - bool is_o; - bool is_prof; - string test_runner; - string profile_file; - bool profile_no_inline; + v__vcache__CacheManager cache_manager; Array_string profile_fns; - bool translated; - bool is_prod; - bool obfuscate; - bool is_repl; - bool is_run; - bool is_debug; - bool is_vlines; - bool sanitize; - bool sourcemap; - bool sourcemap_inline; - bool sourcemap_src_included; - bool show_cc; - bool show_c_output; - bool show_callgraph; - bool show_depgraph; - string dump_c_flags; - bool use_cache; - bool retry_compilation; - bool is_stats; - string cflags; - bool m64; - string ccompiler; - v__pref__CompilerType ccompiler_type; - string third_party_option; - bool building_v; - bool autofree; - bool compress; - bool no_builtin; - bool enable_globals; - bool is_fmt; - bool is_vet; - bool is_bare; - string bare_builtin_dir; - bool no_preludes; - string custom_prelude; Array_string lookup_path; - bool output_cross_c; - bool output_es5; - bool prealloc; - string vroot; - string out_name_c; - string out_name; - string path; Array_string run_only; Array_string compile_defines; Array_string compile_defines_all; Array_string run_args; Array_string printfn_list; - bool print_v_files; - bool skip_running; - bool skip_warnings; - bool warn_impure_v; - bool warns_are_errors; - bool fatal_errors; - bool reuse_tmpc; - bool no_rsp; - bool no_std; - v__pref__ColorOutput use_color; - bool no_parallel; - bool is_vweb; - bool only_check_syntax; - bool check_only; - bool experimental; - bool skip_unused; - bool show_timings; - bool is_ios_simulator; - bool is_apk; Array_string cleanup_files; Array_string build_options; - v__vcache__CacheManager cache_manager; - bool is_help; - v__pref__GarbageCollectionMode gc_mode; - bool is_cstrict; - v__pref__AssertFailureMode assert_failure_mode; + string test_runner; + string profile_file; + string dump_c_flags; + string cflags; + string ccompiler; + string third_party_option; + string bare_builtin_dir; + string custom_prelude; + string vroot; + string out_name_c; + string out_name; + string path; int message_limit; - bool nofloat; int checker_match_exhaustive_cutoff_limit; int thread_stack_size; + v__pref__OS os : 5; + v__pref__Arch arch : 4; + v__pref__Backend backend : 3; + v__pref__CompilerType ccompiler_type : 3; + v__pref__GarbageCollectionMode gc_mode : 3; + v__pref__ColorOutput use_color : 2; + v__pref__AssertFailureMode assert_failure_mode : 2; + v__pref__BuildMode build_mode : 2; + v__pref__OutputMode output_mode : 2; + bool is_verbose : 1; + bool is_glibc : 1; + bool is_musl : 1; + bool is_test : 1; + bool is_script : 1; + bool is_vsh : 1; + bool is_livemain : 1; + bool is_liveshared : 1; + bool is_shared : 1; + bool is_o : 1; + bool is_prof : 1; + bool is_prod : 1; + bool is_repl : 1; + bool is_run : 1; + bool is_debug : 1; + bool is_vlines : 1; + bool is_stats : 1; + bool is_fmt : 1; + bool is_vet : 1; + bool is_vweb : 1; + bool is_ios_simulator : 1; + bool is_apk : 1; + bool is_help : 1; + bool is_cstrict : 1; + bool profile_no_inline : 1; + bool translated : 1; + bool obfuscate : 1; + bool sanitize : 1; + bool sourcemap : 1; + bool sourcemap_inline : 1; + bool sourcemap_src_included : 1; + bool show_cc : 1; + bool show_c_output : 1; + bool show_callgraph : 1; + bool show_depgraph : 1; + bool use_cache : 1; + bool retry_compilation : 1; + bool m64 : 1; + bool building_v : 1; + bool autofree : 1; + bool compress : 1; + bool no_builtin : 1; + bool enable_globals : 1; + bool is_bare : 1; + bool no_preludes : 1; + bool output_cross_c : 1; + bool output_es5 : 1; + bool prealloc : 1; + bool print_v_files : 1; + bool skip_running : 1; + bool skip_warnings : 1; + bool warn_impure_v : 1; + bool warns_are_errors : 1; + bool fatal_errors : 1; + bool reuse_tmpc : 1; + bool no_rsp : 1; + bool no_std : 1; + bool no_parallel : 1; + bool only_check_syntax : 1; + bool check_only : 1; + bool experimental : 1; + bool skip_unused : 1; + bool show_timings : 1; + bool nofloat : 1; }; @@ -4787,9 +4798,9 @@ struct v__errors__Error { string message; string details; string file_path; - v__token__Pos pos; string backtrace; - v__errors__Reporter reporter; + v__token__Pos pos; + v__errors__Reporter reporter : 3; }; @@ -4875,25 +4886,25 @@ struct v__ast__ArrayDecompose { struct v__ast__ArrayInit { - v__token__Pos pos; - v__token__Pos elem_type_pos; Array_Array_v__ast__Comment ecmnts; Array_v__ast__Comment pre_cmnts; - bool is_fixed; - bool has_val; - string mod; - bool has_len; - bool has_cap; - bool has_default; - bool has_it; Array_v__ast__Expr exprs; + Array_v__ast__Type expr_types; + string mod; v__ast__Expr len_expr; v__ast__Expr cap_expr; v__ast__Expr default_expr; - Array_v__ast__Type expr_types; + v__token__Pos pos; + v__token__Pos elem_type_pos; v__ast__Type elem_type; v__ast__Type default_type; v__ast__Type typ; + bool is_fixed : 1; + bool has_val : 1; + bool has_len : 1; + bool has_cap : 1; + bool has_default : 1; + bool has_it : 1; }; @@ -4908,12 +4919,12 @@ struct v__ast__AsCast { struct v__ast__Assoc { - string var_name; Array_string fields; - v__token__Pos pos; Array_v__ast__Expr exprs; - v__ast__Type typ; + string var_name; v__ast__Scope* scope; + v__token__Pos pos; + v__ast__Type typ; }; @@ -4936,12 +4947,12 @@ struct v__ast__BoolLiteral { struct v__ast__CastExpr { v__ast__Expr arg; - v__ast__Type typ; v__ast__Expr expr; string typname; - v__ast__Type expr_type; - bool has_arg; v__token__Pos pos; + v__ast__Type typ; + v__ast__Type expr_type; + bool has_arg : 1; }; @@ -4973,12 +4984,12 @@ struct v__ast__Comment { struct v__ast__ComptimeSelector { - bool has_parens; - v__token__Pos pos; v__ast__Expr left; - v__ast__Type left_type; v__ast__Expr field_expr; + v__token__Pos pos; + v__ast__Type left_type; v__ast__Type typ; + bool has_parens : 1; }; @@ -4999,10 +5010,10 @@ struct v__ast__ConcatExpr { struct v__ast__DumpExpr { - v__token__Pos pos; v__ast__Expr expr; - v__ast__Type expr_type; string cname; + v__token__Pos pos; + v__ast__Type expr_type; }; @@ -5025,32 +5036,32 @@ struct v__ast__FloatLiteral { struct v__ast__Ident { - v__ast__Language language; - v__token__Kind tok_kind; - v__token__Pos pos; - v__token__Pos mut_pos; - bool comptime; - v__ast__Scope* scope; v__ast__ScopeObject obj; string mod; string name; - v__ast__IdentKind kind; v__ast__IdentInfo info; - bool is_mut; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos mut_pos; + v__token__Kind tok_kind : 7; + v__ast__Language language : 4; + v__ast__IdentKind kind : 3; + bool comptime : 1; + bool is_mut : 1; }; struct v__ast__IfExpr { - bool is_comptime; - v__token__Kind tok_kind; - v__token__Pos pos; Array_v__ast__Comment post_comments; - v__ast__Expr left; Array_v__ast__IfBranch branches; - bool is_expr; + v__ast__Expr left; + v__token__Pos pos; v__ast__Type typ; - bool has_else; + v__token__Kind tok_kind : 7; + bool is_comptime : 1; + bool is_expr : 1; + bool has_else : 1; }; @@ -5093,12 +5104,12 @@ struct v__ast__LockExpr { struct v__ast__MapInit { - v__token__Pos pos; Array_Array_v__ast__Comment comments; Array_v__ast__Comment pre_cmnts; Array_v__ast__Expr keys; Array_v__ast__Expr vals; Array_v__ast__Type val_types; + v__token__Pos pos; v__ast__Type typ; v__ast__Type key_type; v__ast__Type value_type; @@ -5107,16 +5118,16 @@ struct v__ast__MapInit { struct v__ast__MatchExpr { - v__token__Kind tok_kind; - v__token__Pos pos; Array_v__ast__Comment comments; - v__ast__Expr cond; Array_v__ast__MatchBranch branches; - bool is_expr; + v__ast__Expr cond; + v__token__Pos pos; v__ast__Type return_type; v__ast__Type cond_type; v__ast__Type expected_type; - bool is_sum_type; + v__token__Kind tok_kind : 7; + bool is_expr : 1; + bool is_sum_type : 1; }; @@ -5135,9 +5146,9 @@ struct v__ast__None { struct v__ast__OffsetOf { - v__ast__Type struct_type; string field; v__token__Pos pos; + v__ast__Type struct_type; }; @@ -5167,12 +5178,12 @@ struct v__ast__PostfixExpr { struct v__ast__RangeExpr { - bool has_high; - bool has_low; - v__token__Pos pos; - bool is_gated; v__ast__Expr low; v__ast__Expr high; + v__token__Pos pos; + bool has_high : 1; + bool has_low : 1; + bool is_gated : 1; }; @@ -5188,18 +5199,18 @@ struct v__ast__SelectExpr { struct v__ast__SelectorExpr { - v__token__Pos pos; + Array_v__ast__Type from_embed_types; string field_name; - bool is_mut; - v__token__Pos mut_pos; - v__token__Kind next_token; v__ast__Expr expr; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos mut_pos; v__ast__Type expr_type; v__ast__Type typ; v__ast__Type name_type; - v__ast__GenericKindField gkind_field; - v__ast__Scope* scope; - Array_v__ast__Type from_embed_types; + v__token__Kind next_token : 7; + v__ast__GenericKindField gkind_field : 2; + bool is_mut : 1; }; @@ -5231,30 +5242,30 @@ struct v__ast__StringInterLiteral { struct v__ast__StringLiteral { string val; - bool is_raw; - v__ast__Language language; v__token__Pos pos; + v__ast__Language language : 4; + bool is_raw : 1; }; struct v__ast__StructInit { - v__token__Pos pos; - v__token__Pos name_pos; - bool is_short; - bool is_short_syntax; - bool unresolved; Array_v__ast__Comment pre_comments; - string typ_str; - v__ast__Type typ; - v__ast__Expr update_expr; - v__ast__Type update_expr_type; Array_v__ast__Comment update_expr_comments; - bool is_update_embed; - bool has_update_expr; Array_v__ast__StructInitField fields; Array_v__ast__StructInitEmbed embeds; Array_v__ast__Type generic_types; + string typ_str; + v__ast__Expr update_expr; + v__token__Pos pos; + v__token__Pos name_pos; + v__ast__Type typ; + v__ast__Type update_expr_type; + bool is_short : 1; + bool is_short_syntax : 1; + bool unresolved : 1; + bool is_update_embed : 1; + bool has_update_expr : 1; }; @@ -5267,8 +5278,8 @@ struct v__ast__TypeNode { struct v__ast__TypeOf { - v__token__Pos pos; v__ast__Expr expr; + v__token__Pos pos; v__ast__Type expr_type; }; @@ -5282,43 +5293,43 @@ struct v__ast__UnsafeExpr { struct v__ast__AsmStmt { - v__pref__Arch arch; - bool is_basic; - bool is_volatile; - bool is_goto; Array_v__ast__AsmClobbered clobbered; - v__token__Pos pos; Array_v__ast__AsmTemplate templates; - v__ast__Scope* scope; Array_v__ast__AsmIO output; Array_v__ast__AsmIO input; Array_string global_labels; Array_string local_labels; + v__ast__Scope* scope; + v__token__Pos pos; + v__pref__Arch arch : 4; + bool is_basic : 1; + bool is_volatile : 1; + bool is_goto : 1; }; struct v__ast__AssertStmt { - v__token__Pos pos; v__ast__Expr expr; - bool is_used; + v__token__Pos pos; + bool is_used : 1; }; struct v__ast__AssignStmt { - v__token__Kind op; - v__token__Pos pos; Array_v__ast__Comment comments; Array_v__ast__Comment end_comments; Array_v__ast__Expr right; Array_v__ast__Expr left; Array_v__ast__Type left_types; Array_v__ast__Type right_types; - bool is_static; - bool is_volatile; - bool is_simple; - bool has_cross_var; + v__token__Pos pos; + v__token__Kind op : 7; + bool is_static : 1; + bool is_volatile : 1; + bool is_simple : 1; + bool has_cross_var : 1; }; @@ -5332,9 +5343,9 @@ struct v__ast__Block { struct v__ast__BranchStmt { - v__token__Kind kind; string label; v__token__Pos pos; + v__token__Kind kind : 7; }; @@ -5351,21 +5362,21 @@ struct v__ast__ComptimeFor { struct v__ast__ConstDecl { - bool is_pub; - v__token__Pos pos; Array_v__ast__Attr attrs; Array_v__ast__ConstField fields; Array_v__ast__Comment end_comments; - bool is_block; + v__token__Pos pos; + bool is_pub : 1; + bool is_block : 1; }; struct v__ast__DeferStmt { Array_v__ast__Stmt stmts; - v__token__Pos pos; Array_v__ast__Ident defer_vars; string ifdef; + v__token__Pos pos; int idx_in_fn; }; @@ -5378,14 +5389,14 @@ struct v__ast__EmptyStmt { struct v__ast__EnumDecl { - string name; - bool is_pub; - bool is_flag; - bool is_multi_allowed; Array_v__ast__Comment comments; Array_v__ast__EnumField fields; Array_v__ast__Attr attrs; + string name; v__token__Pos pos; + bool is_pub : 1; + bool is_flag : 1; + bool is_multi_allowed : 1; }; @@ -5417,21 +5428,21 @@ struct v__ast__ForCStmt { struct v__ast__ForInStmt { + Array_v__ast__Stmt stmts; string key_var; string val_var; - bool is_range; v__ast__Expr high; - Array_v__ast__Stmt stmts; - v__token__Pos pos; - bool val_is_mut; v__ast__Expr cond; + string label; + v__ast__Scope* scope; + v__token__Pos pos; v__ast__Type key_type; v__ast__Type val_type; v__ast__Type cond_type; v__ast__Type high_type; - v__ast__Kind kind; - string label; - v__ast__Scope* scope; + v__ast__Kind kind : 6; + bool is_range : 1; + bool val_is_mut : 1; }; @@ -5500,21 +5511,21 @@ struct v__ast__Import { struct v__ast__InterfaceDecl { - string name; - v__ast__Type typ; - v__token__Pos name_pos; - v__ast__Language language; Array_string field_names; - bool is_pub; - int mut_pos; - v__token__Pos pos; Array_v__ast__Comment pre_comments; Array_v__ast__Type generic_types; Array_v__ast__Attr attrs; Array_v__ast__FnDecl methods; Array_v__ast__StructField fields; Array_v__ast__InterfaceEmbedding embeds; - bool are_embeds_expanded; + string name; + v__token__Pos name_pos; + v__token__Pos pos; + v__ast__Type typ; + int mut_pos; + v__ast__Language language : 4; + bool is_pub : 1; + bool are_embeds_expanded : 1; }; @@ -5548,21 +5559,21 @@ struct v__ast__SqlStmt { struct v__ast__StructDecl { - v__token__Pos pos; - string name; Array_v__ast__Type generic_types; - bool is_pub; + Array_v__ast__Attr attrs; + Array_v__ast__Comment end_comments; + Array_v__ast__Embed embeds; + Array_v__ast__StructField fields; + string name; + v__token__Pos pos; int mut_pos; int pub_pos; int pub_mut_pos; int global_pos; int module_pos; - v__ast__Language language; - bool is_union; - Array_v__ast__Attr attrs; - Array_v__ast__Comment end_comments; - Array_v__ast__Embed embeds; - Array_v__ast__StructField fields; + v__ast__Language language : 4; + bool is_pub : 1; + bool is_union : 1; }; @@ -5583,50 +5594,50 @@ struct v__ast__ConstField { struct v__ast__GlobalField { + Array_v__ast__Comment comments; string name; - bool has_expr; + v__ast__Expr expr; v__token__Pos pos; v__token__Pos typ_pos; - bool is_markused; - bool is_volatile; - v__ast__Expr expr; v__ast__Type typ; - Array_v__ast__Comment comments; + bool has_expr : 1; + bool is_markused : 1; + bool is_volatile : 1; }; struct v__ast__Var { + Array_v__ast__Type smartcasts; string name; - v__ast__ShareType share; - bool is_mut; - bool is_autofree_tmp; - bool is_arg; - bool is_auto_deref; - bool is_inherited; v__ast__Expr expr; + v__token__Pos pos; v__ast__Type typ; v__ast__Type orig_type; - Array_v__ast__Type smartcasts; - v__token__Pos pos; - bool is_used; - bool is_changed; - bool is_or; - bool is_tmp; - bool is_auto_heap; - bool is_stack_obj; + v__ast__ShareType share : 2; + bool is_mut : 1; + bool is_autofree_tmp : 1; + bool is_arg : 1; + bool is_auto_deref : 1; + bool is_inherited : 1; + bool is_used : 1; + bool is_changed : 1; + bool is_or : 1; + bool is_tmp : 1; + bool is_auto_heap : 1; + bool is_stack_obj : 1; }; struct v__ast__CallArg { - bool is_mut; - v__ast__ShareType share; Array_v__ast__Comment comments; v__ast__Expr expr; - v__ast__Type typ; - bool is_tmp_autofree; v__token__Pos pos; + v__ast__Type typ; + v__ast__ShareType share : 2; + bool is_mut : 1; + bool is_tmp_autofree : 1; }; @@ -5668,32 +5679,33 @@ struct v__ast__MatchBranch { struct v__ast__Param { - v__token__Pos pos; string name; - bool is_mut; - bool is_auto_rec; + v__token__Pos pos; v__token__Pos type_pos; - bool is_hidden; v__ast__Type typ; + bool is_mut : 1; + bool is_auto_rec : 1; + bool is_hidden : 1; }; struct v__ast__StructField { + Array_v__ast__Comment comments; + Array_v__ast__Attr attrs; + string default_val; + v__ast__Expr default_expr; + string name; v__token__Pos pos; v__token__Pos type_pos; - Array_v__ast__Comment comments; - bool has_default_expr; - Array_v__ast__Attr attrs; - bool is_pub; - string default_val; - bool is_mut; - bool is_global; - bool is_volatile; - v__ast__Expr default_expr; + int i; v__ast__Type default_expr_typ; - string name; v__ast__Type typ; + bool has_default_expr : 1; + bool is_pub : 1; + bool is_mut : 1; + bool is_global : 1; + bool is_volatile : 1; }; @@ -5714,14 +5726,14 @@ struct v__ast__StructInitField { struct v__ast__Attr { string name; - bool has_arg; string arg; - v__ast__AttrKind kind; v__ast__Expr ct_expr; - bool ct_opt; v__token__Pos pos; - bool ct_evaled; - bool ct_skip; + v__ast__AttrKind kind : 3; + bool has_arg : 1; + bool ct_opt : 1; + bool ct_evaled : 1; + bool ct_skip : 1; }; @@ -5763,11 +5775,11 @@ struct v__ast__ImportSymbol { struct v__ast__ScopeStructField { - v__ast__Type struct_type; + Array_v__ast__Type smartcasts; string name; v__token__Pos pos; + v__ast__Type struct_type; v__ast__Type typ; - Array_v__ast__Type smartcasts; v__ast__Type orig_type; }; @@ -5781,12 +5793,12 @@ struct v__ast__AsmClobbered { struct v__ast__AsmTemplate { - string name; - bool is_label; - bool is_directive; Array_v__ast__AsmArg args; Array_v__ast__Comment comments; + string name; v__token__Pos pos; + bool is_label : 1; + bool is_directive : 1; }; @@ -5837,114 +5849,114 @@ struct v__ast__IfGuardVar { struct v__ast__Fn { - bool is_variadic; - v__ast__Language language; - bool is_pub; - bool is_ctor_new; - bool is_deprecated; - bool is_noreturn; - bool is_unsafe; - bool is_placeholder; - bool is_main; - bool is_test; - bool is_keep_alive; - bool is_method; - bool no_body; + Array_v__ast__Param params; + Array_string generic_names; + Array_v__ast__Attr attrs; string mod; string file; - v__ast__Language file_mode; + string name; v__token__Pos pos; v__token__Pos return_type_pos; v__ast__Type return_type; v__ast__Type receiver_type; - string name; - Array_v__ast__Param params; - voidptr source_fn; int usages; - Array_string generic_names; - Array_v__ast__Attr attrs; - bool is_conditional; int ctdefine_idx; + voidptr source_fn; + v__ast__Language language : 4; + v__ast__Language file_mode : 4; + bool is_variadic : 1; + bool is_pub : 1; + bool is_ctor_new : 1; + bool is_deprecated : 1; + bool is_noreturn : 1; + bool is_unsafe : 1; + bool is_placeholder : 1; + bool is_main : 1; + bool is_test : 1; + bool is_keep_alive : 1; + bool is_method : 1; + bool no_body : 1; + bool is_conditional : 1; }; struct v__parser__Parser { - v__pref__Preferences* pref; - string file_base; - string file_name; - string file_name_dir; - string unique_prefix; - v__ast__Language file_backend_mode; - v__scanner__Scanner* scanner; - v__scanner__CommentsMode comments_mode; + Map_string_string imports; + Map_string_string imported_symbols; v__token__Token tok; v__token__Token prev_tok; v__token__Token peek_tok; - v__ast__Table* table; - v__ast__Language language; - v__ast__Language fn_language; - int expr_level; - bool inside_vlib_file; - bool inside_test_file; - bool inside_if; - bool inside_if_expr; - bool inside_if_cond; - bool inside_ct_if_expr; - bool inside_or_expr; - bool inside_for; - bool inside_fn; - bool inside_fn_return; - bool inside_unsafe_fn; - bool inside_str_interp; - bool inside_array_lit; - bool inside_in_array; - bool inside_match; - bool inside_select; - bool inside_match_case; - bool inside_match_body; - bool inside_unsafe; - bool inside_sum_type; - bool inside_asm_template; - bool inside_asm; - bool inside_defer; - bool inside_generic_params; - bool inside_receiver_param; - bool inside_struct_field_decl; - bool or_is_handled; - bool builtin_mod; - string mod; - bool is_manualfree; - bool has_globals; - bool is_generated; - bool is_translated; Array_v__ast__Attr attrs; - string expr_mod; - v__ast__Scope* scope; - Map_string_string imports; Array_v__ast__Import ast_imports; Array_string used_imports; Array_string auto_imports; - Map_string_string imported_symbols; - bool is_amp; - bool returns; - bool is_stmt_ident; - bool expecting_type; Array_v__errors__Error errors; Array_v__errors__Warning warnings; Array_v__errors__Notice notices; Array_v__vet__Error vet_errors; - string cur_fn_name; Array_string label_names; - bool name_error; - int n_asm; Array_string global_labels; - bool comptime_if_cond; Array_v__ast__Ident defer_vars; - bool should_abort; - string codegen_text; Array_v__ast__Type struct_init_generic_types; Array_v__ast__Comment if_cond_comments; + string file_base; + string file_name; + string file_name_dir; + string unique_prefix; + string mod; + string expr_mod; + string cur_fn_name; + string codegen_text; + v__pref__Preferences* pref; + v__scanner__Scanner* scanner; + v__ast__Table* table; + v__ast__Scope* scope; + int expr_level; + int n_asm; + v__ast__Language file_backend_mode : 4; + v__ast__Language language : 4; + v__ast__Language fn_language : 4; + v__scanner__CommentsMode comments_mode : 2; + bool inside_vlib_file : 1; + bool inside_test_file : 1; + bool inside_if : 1; + bool inside_if_expr : 1; + bool inside_if_cond : 1; + bool inside_ct_if_expr : 1; + bool inside_or_expr : 1; + bool inside_for : 1; + bool inside_fn : 1; + bool inside_fn_return : 1; + bool inside_unsafe_fn : 1; + bool inside_str_interp : 1; + bool inside_array_lit : 1; + bool inside_in_array : 1; + bool inside_match : 1; + bool inside_select : 1; + bool inside_match_case : 1; + bool inside_match_body : 1; + bool inside_unsafe : 1; + bool inside_sum_type : 1; + bool inside_asm_template : 1; + bool inside_asm : 1; + bool inside_defer : 1; + bool inside_generic_params : 1; + bool inside_receiver_param : 1; + bool inside_struct_field_decl : 1; + bool or_is_handled : 1; + bool builtin_mod : 1; + bool is_manualfree : 1; + bool has_globals : 1; + bool is_generated : 1; + bool is_translated : 1; + bool is_amp : 1; + bool returns : 1; + bool is_stmt_ident : 1; + bool expecting_type : 1; + bool name_error : 1; + bool comptime_if_cond : 1; + bool should_abort : 1; }; @@ -5961,13 +5973,13 @@ struct v__parser__ReceiverParsingInfo { struct v__vet__Error { - v__vet__ErrorKind kind; string message; string details; string file_path; v__token__Pos pos; - v__vet__FixKind fix; - v__vet__ErrorType typ; + v__vet__FixKind fix : 2; + v__vet__ErrorType typ : 2; + v__vet__ErrorKind kind : 2; }; @@ -6095,134 +6107,134 @@ struct v__ast__File { struct v__ast__FnDecl { - string name; - string short_name; - string mod; - bool is_deprecated; - bool is_pub; - bool is_variadic; - bool is_anon; - bool is_noreturn; - bool is_manualfree; - bool is_main; - bool is_test; - bool is_conditional; - bool is_exported; - bool is_keep_alive; - bool is_unsafe; - bool is_markused; v__ast__StructField receiver; - v__token__Pos receiver_pos; - bool is_method; - v__token__Pos method_type_pos; - int method_idx; - bool rec_mut; - v__ast__ShareType rec_share; - v__ast__Language language; - v__ast__Language file_mode; - bool no_body; - bool is_builtin; - v__token__Pos body_pos; - string file; Array_string generic_names; - bool is_direct_arr; Array_v__ast__Attr attrs; - int ctdefine_idx; - int idx; Array_v__ast__Param params; Array_v__ast__Stmt stmts; Array_v__ast__DeferStmt defer_stmts; - v__ast__Type return_type; - v__token__Pos return_type_pos; - bool has_return; - bool should_be_skipped; - int ninstances; - bool has_await; Array_v__ast__Comment comments; Array_v__ast__Comment end_comments; Array_v__ast__Comment next_comments; + Array_string label_names; + string name; + string short_name; + string mod; + string file; v__ast__File* source_file; v__ast__Scope* scope; - Array_string label_names; + v__token__Pos receiver_pos; + v__token__Pos method_type_pos; + v__token__Pos body_pos; + v__token__Pos return_type_pos; v__token__Pos pos; + int method_idx; + int ctdefine_idx; + int idx; + v__ast__Type return_type; + int ninstances; + v__ast__Language language : 4; + v__ast__Language file_mode : 4; + v__ast__ShareType rec_share : 2; + bool is_deprecated : 1; + bool is_pub : 1; + bool is_variadic : 1; + bool is_anon : 1; + bool is_noreturn : 1; + bool is_manualfree : 1; + bool is_main : 1; + bool is_test : 1; + bool is_conditional : 1; + bool is_exported : 1; + bool is_keep_alive : 1; + bool is_unsafe : 1; + bool is_markused : 1; + bool is_method : 1; + bool rec_mut : 1; + bool no_body : 1; + bool is_builtin : 1; + bool is_direct_arr : 1; + bool has_return : 1; + bool should_be_skipped : 1; + bool has_await : 1; }; struct v__ast__CallExpr { - v__token__Pos pos; - v__token__Pos name_pos; - string mod; - string name; - bool is_method; - bool is_field; - bool is_fn_var; - bool is_keep_alive; - bool is_noreturn; - bool is_ctor_new; + v__ast__OrExpr or_block; Array_v__ast__CallArg args; Array_v__ast__Type expected_arg_types; - v__ast__Language language; - v__ast__OrExpr or_block; + Array_v__ast__Type concrete_types; + Array_v__ast__Type raw_concrete_types; + Array_v__ast__Type from_embed_types; + Array_v__ast__Comment comments; + string mod; + string name; v__ast__Expr left; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos name_pos; + v__token__Pos concrete_list_pos; v__ast__Type left_type; v__ast__Type receiver_type; v__ast__Type return_type; v__ast__Type fn_var_type; - bool should_be_skipped; - Array_v__ast__Type concrete_types; - v__token__Pos concrete_list_pos; - Array_v__ast__Type raw_concrete_types; - bool free_receiver; - v__ast__Scope* scope; - Array_v__ast__Type from_embed_types; - Array_v__ast__Comment comments; + v__ast__Language language : 4; + bool is_method : 1; + bool is_field : 1; + bool is_fn_var : 1; + bool is_keep_alive : 1; + bool is_noreturn : 1; + bool is_ctor_new : 1; + bool should_be_skipped : 1; + bool free_receiver : 1; }; struct v__ast__IndexExpr { - v__token__Pos pos; - v__ast__Expr index; v__ast__OrExpr or_expr; + v__ast__Expr index; v__ast__Expr left; + v__token__Pos pos; v__ast__Type left_type; - bool is_setter; - bool is_map; - bool is_array; - bool is_farray; - bool is_option; - bool is_direct; - bool is_gated; + bool is_setter : 1; + bool is_map : 1; + bool is_array : 1; + bool is_farray : 1; + bool is_option : 1; + bool is_direct : 1; + bool is_gated : 1; }; struct v__ast__InfixExpr { - v__token__Kind op; - v__token__Pos pos; - bool is_stmt; + v__ast__OrExpr or_block; v__ast__Expr left; v__ast__Expr right; + string auto_locked; + v__ast__ComptTimeConstValue ct_left_value; + v__ast__ComptTimeConstValue ct_right_value; + v__token__Pos pos; v__ast__Type left_type; v__ast__Type right_type; - string auto_locked; - v__ast__OrExpr or_block; - bool ct_left_value_evaled; - v__ast__ComptTimeConstValue ct_left_value; - bool ct_right_value_evaled; - v__ast__ComptTimeConstValue ct_right_value; + v__token__Kind op : 7; + bool is_stmt : 1; + bool ct_left_value_evaled : 1; + bool ct_right_value_evaled : 1; }; struct v__ast__PrefixExpr { - v__token__Kind op; + v__ast__OrExpr or_block; + v__ast__Expr right; v__token__Pos pos; v__ast__Type right_type; - v__ast__Expr right; - v__ast__OrExpr or_block; - bool is_option; + v__token__Kind op : 7; + bool is_option : 1; }; @@ -6250,13 +6262,13 @@ struct v__ast__SqlExpr { struct v__ast__SelectBranch { - v__token__Pos pos; v__ast__Comment comment; - bool is_else; - bool is_timeout; Array_v__ast__Comment post_comments; - v__ast__Stmt stmt; Array_v__ast__Stmt stmts; + v__ast__Stmt stmt; + v__token__Pos pos; + bool is_else : 1; + bool is_timeout : 1; }; @@ -6457,70 +6469,70 @@ struct sync__pool__PoolProcessor { struct v__checker__Checker { - v__pref__Preferences* pref; - v__ast__Table* table; - v__ast__File* file; - int nr_errors; - int nr_warnings; - int nr_notices; + v__ast__FnDecl main_fn_decl_node; + v__ast__TypeSymbol cur_orm_ts; + Map_string_v__ast__Type comptime_fields_type; Array_v__errors__Error errors; Array_v__errors__Warning warnings; Array_v__errors__Notice notices; Array_int error_lines; - v__ast__Type expected_type; - v__ast__Type expected_or_type; - v__ast__Type expected_expr_type; - string mod; - string const_decl; Array_string const_deps; Array_string const_names; Array_string global_names; Array_string locked_names; Array_string rlocked_names; - int in_for_count; - bool should_abort; - bool returns; - bool scope_returns; - bool is_builtin_mod; - bool is_just_builtin_mod; - bool is_generated; - bool inside_unsafe; - bool inside_const; - bool inside_anon_fn; - bool inside_ref_lit; - bool inside_defer; - bool inside_fn_arg; - bool inside_ct_attr; - bool inside_comptime_for_field; - bool skip_flags; - int fn_level; - v__token__Pos smartcast_mut_pos; - v__token__Pos smartcast_cond_pos; Array_v__ast__Expr ct_cond_stack; - int stmt_level; Array_v__ast__File files; - int expr_level; - v__ast__TypeSymbol cur_orm_ts; Array_string error_details; + Array_v__ast__Type vweb_gen_types; + string mod; + string const_decl; string vmod_file_content; string loop_label; - Array_v__ast__Type vweb_gen_types; + v__pref__Preferences* pref; + v__ast__Table* table; + v__ast__File* file; v__util__Timers* timers; - v__ast__Type comptime_fields_default_type; - Map_string_v__ast__Type comptime_fields_type; v__ast__Scope* fn_scope; - v__ast__FnDecl main_fn_decl_node; + v__token__Pos smartcast_mut_pos; + v__token__Pos smartcast_cond_pos; + int nr_errors; + int nr_warnings; + int nr_notices; + v__ast__Type expected_type; + v__ast__Type expected_or_type; + v__ast__Type expected_expr_type; + int in_for_count; + int fn_level; + int stmt_level; + int expr_level; + v__ast__Type comptime_fields_default_type; int match_exhaustive_cutoff_limit; - bool is_last_stmt; - bool prevent_sum_type_unwrapping_once; - bool using_new_err_struct; - bool need_recheck_generic_fns; - bool inside_sql; - bool inside_selector_expr; - bool inside_println_arg; - bool inside_decl_rhs; - bool inside_if_guard; int comptime_call_pos; + bool should_abort : 1; + bool returns : 1; + bool scope_returns : 1; + bool is_builtin_mod : 1; + bool is_just_builtin_mod : 1; + bool is_generated : 1; + bool inside_unsafe : 1; + bool inside_const : 1; + bool inside_anon_fn : 1; + bool inside_ref_lit : 1; + bool inside_defer : 1; + bool inside_fn_arg : 1; + bool inside_ct_attr : 1; + bool inside_comptime_for_field : 1; + bool skip_flags : 1; + bool is_last_stmt : 1; + bool prevent_sum_type_unwrapping_once : 1; + bool using_new_err_struct : 1; + bool need_recheck_generic_fns : 1; + bool inside_sql : 1; + bool inside_selector_expr : 1; + bool inside_println_arg : 1; + bool inside_decl_rhs : 1; + bool inside_if_guard : 1; }; @@ -6544,32 +6556,32 @@ struct v__ast__AnonFn { struct v__ast__ComptimeCall { - v__token__Pos pos; - bool has_parens; + v__ast__File vweb_tmpl; + v__ast__EmbeddedFile embed_file; + Array_v__ast__CallArg args; string method_name; - v__token__Pos method_pos; - v__ast__Scope* scope; v__ast__Expr left; string args_var; - bool is_vweb; - v__ast__File vweb_tmpl; - bool is_embed; - bool is_env; + string env_value; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos method_pos; v__token__Pos env_pos; - bool is_pkgconfig; v__ast__Type left_type; v__ast__Type result_type; - string env_value; - Array_v__ast__CallArg args; - v__ast__EmbeddedFile embed_file; + bool has_parens : 1; + bool is_vweb : 1; + bool is_embed : 1; + bool is_env : 1; + bool is_pkgconfig : 1; }; struct v__ast__GoExpr { - v__token__Pos pos; v__ast__CallExpr call_expr; - bool is_expr; + v__token__Pos pos; + bool is_expr : 1; }; @@ -7474,6 +7486,7 @@ void _v_exit(int code); VV_LOCAL_SYMBOL string vcommithash(void); VV_LOCAL_SYMBOL void panic_debug(int line_no, string file, string mod, string fn_name, string s); void panic_optional_not_set(string s); +void panic_result_not_set(string s); void _v_panic(string s); string c_error_number_str(int errnum); void panic_error_number(string basestr, int errnum); @@ -9040,6 +9053,7 @@ 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); void v__pref__eprintln_cond(bool condition, string s); void v__pref__Preferences_vrun_elog(v__pref__Preferences* pref, string s); @@ -9561,7 +9575,7 @@ bool v__ast__TypeSymbol_is_string(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_number(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_primitive(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t); -int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); +multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple); string v__ast__Kind_str(v__ast__Kind k); string Array_v__ast__Kind_str(Array_v__ast__Kind kinds); @@ -9697,7 +9711,7 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp VV_LOCAL_SYMBOL multi_return_bool_int_int v__checker__Checker_verify_vweb_params_for_method(v__checker__Checker* c, v__ast__Fn node); VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Checker* c); VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__checker__Checker* c, v__ast__Attr* node); -VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos); +VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos); v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__ArrayInit* node); VV_LOCAL_SYMBOL void v__checker__Checker_check_array_init_para_type(v__checker__Checker* c, string para, v__ast__Expr expr, v__token__Pos pos); void v__checker__Checker_ensure_sumtype_array_has_default_value(v__checker__Checker* c, v__ast__ArrayInit node); @@ -9744,7 +9758,13 @@ string _const_v__checker__unicode_lit_overflow_message; // a string literal, ini 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_2892273012681280244_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { + if (a->i < b->i) return -1; + else return 1; +} + VV_LOCAL_SYMBOL bool v__transformer__IndexState_safe_access(v__transformer__IndexState* i, string key, int _v_new); VV_LOCAL_SYMBOL int v__transformer__IndexState_safe_offset(v__transformer__IndexState* i, string key); VV_LOCAL_SYMBOL void v__transformer__IndexState_indent(v__transformer__IndexState* i, bool is_function); @@ -9792,9 +9812,9 @@ void v__markused__Walker_fn_by_name(v__markused__Walker* w, string fn_name); void v__markused__Walker_struct_fields(v__markused__Walker* w, Array_v__ast__StructField sfields); void v__markused__Walker_const_fields(v__markused__Walker* w, Array_v__ast__ConstField cfields); void v__markused__Walker_or_block(v__markused__Walker* w, v__ast__OrExpr node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type); -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp); +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, string var_name); +VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type, string var_name); +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp, string var_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort_call(v__gen__c__Gen* g, v__ast__CallExpr node, string compare_fn); @@ -10288,6 +10308,7 @@ void v__parser__Parser_init_parse_fns(v__parser__Parser* p); void v__parser__Parser_read_first_token(v__parser__Parser* p); v__token__Token v__parser__Parser_peek_token(v__parser__Parser* p, int n); v__token__Token v__parser__Parser_peek_token_after_var_list(v__parser__Parser* p); +VV_LOCAL_SYMBOL bool v__parser__Parser_is_array_type(v__parser__Parser* p); void v__parser__Parser_open_scope(v__parser__Parser* p); void v__parser__Parser_close_scope(v__parser__Parser* p); Array_v__ast__Stmt v__parser__Parser_parse_block(v__parser__Parser* p); @@ -10493,10 +10514,10 @@ static string Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a); // auto static string indent_Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a, int indent_count); // auto static string Map_string_int_str(Map_string_int m); // auto static string indent_Map_string_int_str(Map_string_int m, int indent_count); // auto -static string Array_v__ast__CallArg_str(Array_v__ast__CallArg a); // auto -static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int indent_count); // auto static string v__ast__OrExpr_str(v__ast__OrExpr it); // auto static string indent_v__ast__OrExpr_str(v__ast__OrExpr it, int indent_count); // auto +static string Array_v__ast__CallArg_str(Array_v__ast__CallArg a); // auto +static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int indent_count); // auto static string Array_v__ast__Comment_str(Array_v__ast__Comment a); // auto static string indent_Array_v__ast__Comment_str(Array_v__ast__Comment a, int indent_count); // auto static string v__ast__Aggregate_str(v__ast__Aggregate it); // auto @@ -10536,10 +10557,10 @@ static string v__ast__Comment_str(v__ast__Comment it); // auto static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count); // auto static string Array_v__ast__StructField_str(Array_v__ast__StructField a); // auto static string indent_Array_v__ast__StructField_str(Array_v__ast__StructField a, int indent_count); // auto -static string Array_v__ast__Fn_str(Array_v__ast__Fn a); // auto -static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count); // auto static string Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m); // auto static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m, int indent_count); // auto +static string Array_v__ast__Fn_str(Array_v__ast__Fn a); // auto +static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count); // auto static string v__ast__Param_str(v__ast__Param it); // auto static string indent_v__ast__Param_str(v__ast__Param it, int indent_count); // auto static string v__ast__StructField_str(v__ast__StructField it); // auto @@ -11072,7 +11093,7 @@ void vinit_string_literals(void){ _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#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_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"); @@ -11335,6 +11356,7 @@ static string indent_Map_string_int_str(Map_string_int m, int indent_count) { /* strings__Builder_free(&sb); return res; } +static string v__ast__OrExpr_str(v__ast__OrExpr it) { return indent_v__ast__OrExpr_str(it, 0);} static string Array_v__ast__CallArg_str(Array_v__ast__CallArg a) { return indent_Array_v__ast__CallArg_str(a, 0);} static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int indent_count) { strings__Builder sb = strings__new_builder(a.len * 10); @@ -11353,7 +11375,6 @@ static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int inde strings__Builder_free(&sb); return res; } -static string v__ast__OrExpr_str(v__ast__OrExpr it) { return indent_v__ast__OrExpr_str(it, 0);} static string Array_v__ast__Comment_str(Array_v__ast__Comment a) { return indent_Array_v__ast__Comment_str(a, 0);} static string indent_Array_v__ast__Comment_str(Array_v__ast__Comment a, int indent_count) { strings__Builder sb = strings__new_builder(a.len * 10); @@ -11447,23 +11468,6 @@ static string indent_Array_v__ast__StructField_str(Array_v__ast__StructField a, strings__Builder_free(&sb); return res; } -static string Array_v__ast__Fn_str(Array_v__ast__Fn a) { return indent_Array_v__ast__Fn_str(a, 0);} -static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count) { - strings__Builder sb = strings__new_builder(a.len * 10); - strings__Builder_write_string(&sb, _SLIT("[")); - for (int i = 0; i < a.len; ++i) { - v__ast__Fn it = *(v__ast__Fn*)array_get(a, i); - string x = indent_v__ast__Fn_str(it, indent_count); - strings__Builder_write_string(&sb, x); - if (i < a.len-1) { - strings__Builder_write_string(&sb, _SLIT(", ")); - } - } - strings__Builder_write_string(&sb, _SLIT("]")); - string res = strings__Builder_str(&sb); - strings__Builder_free(&sb); - return res; -} static string Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m) { return indent_Map_int_Array_v__ast__Type_str(m, 0);} static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m, int indent_count) { /* gen_str_for_map */ strings__Builder sb = strings__new_builder(m.key_values.len*10); @@ -11483,6 +11487,23 @@ static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m strings__Builder_free(&sb); return res; } +static string Array_v__ast__Fn_str(Array_v__ast__Fn a) { return indent_Array_v__ast__Fn_str(a, 0);} +static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count) { + strings__Builder sb = strings__new_builder(a.len * 10); + strings__Builder_write_string(&sb, _SLIT("[")); + for (int i = 0; i < a.len; ++i) { + v__ast__Fn it = *(v__ast__Fn*)array_get(a, i); + string x = indent_v__ast__Fn_str(it, indent_count); + strings__Builder_write_string(&sb, x); + if (i < a.len-1) { + strings__Builder_write_string(&sb, _SLIT(", ")); + } + } + strings__Builder_write_string(&sb, _SLIT("]")); + string res = strings__Builder_str(&sb); + strings__Builder_free(&sb); + return res; +} static string v__ast__Param_str(v__ast__Param it) { return indent_v__ast__Param_str(it, 0);} static string v__ast__StructField_str(v__ast__StructField it) { return indent_v__ast__StructField_str(it, 0);} @@ -11490,52 +11511,52 @@ static string v__ast__StructField_str(v__ast__StructField it) { return indent_v_ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t1 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t2 = indent_v__token__Pos_str(it.name_pos, indent_count + 1); - string _t3 = indent_Array_v__ast__CallArg_str(it.args, indent_count + 1); - string _t4 = indent_Array_v__ast__Type_str(it.expected_arg_types, indent_count + 1); - string _t5 = v__ast__Language_str(it.language); - string _t6 = indent_v__ast__OrExpr_str(it.or_block, indent_count + 1); - string _t7 = v__ast__Expr_str(it.left); - string _t8 = v__ast__Type_str(it.left_type); - string _t9 = v__ast__Type_str(it.receiver_type); - string _t10 = v__ast__Type_str(it.return_type); - string _t11 = v__ast__Type_str(it.fn_var_type); - string _t12 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t13 = indent_v__token__Pos_str(it.concrete_list_pos, indent_count + 1); - string _t14 = indent_Array_v__ast__Type_str(it.raw_concrete_types, indent_count + 1); - string _t15 = isnil(it.scope) ? _SLIT("nil") : (indent_count > 25) ? _SLIT("") : v__ast__Scope_str(*it.scope); - string _t16 = indent_Array_v__ast__Type_str(it.from_embed_types, indent_count + 1); - string _t17 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t1 = indent_v__ast__OrExpr_str(it.or_block, indent_count + 1); + string _t2 = indent_Array_v__ast__CallArg_str(it.args, indent_count + 1); + string _t3 = indent_Array_v__ast__Type_str(it.expected_arg_types, indent_count + 1); + string _t4 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t5 = indent_Array_v__ast__Type_str(it.raw_concrete_types, indent_count + 1); + string _t6 = indent_Array_v__ast__Type_str(it.from_embed_types, indent_count + 1); + string _t7 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t8 = v__ast__Expr_str(it.left); + string _t9 = isnil(it.scope) ? _SLIT("nil") : (indent_count > 25) ? _SLIT("") : v__ast__Scope_str(*it.scope); + string _t10 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t11 = indent_v__token__Pos_str(it.name_pos, indent_count + 1); + string _t12 = indent_v__token__Pos_str(it.concrete_list_pos, indent_count + 1); + string _t13 = v__ast__Type_str(it.left_type); + string _t14 = v__ast__Type_str(it.receiver_type); + string _t15 = v__ast__Type_str(it.return_type); + string _t16 = v__ast__Type_str(it.fn_var_type); + string _t17 = v__ast__Language_str(it.language); string res = str_intp( 111, _MOV((StrIntpData[]){ {_SLIT("v.ast.CallExpr{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t1}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t2}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" or_block: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t1}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t2}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" expected_arg_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t3}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t4}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" raw_concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t5}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" from_embed_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t6}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t7}}, {_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(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t8}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" scope: &"), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t9}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t10}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t11}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_list_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t12}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t13}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t14}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t15}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fn_var_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t16}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t17}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_method: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_method ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_field: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_field ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_fn_var: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_fn_var ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_keep_alive: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_keep_alive ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_noreturn: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_noreturn ? _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}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t3}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" expected_arg_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t4}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t5}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" or_block: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t6}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t7}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t8}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t9}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t10}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fn_var_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t11}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" should_be_skipped: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.should_be_skipped ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t12}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_list_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t13}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" raw_concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t14}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" free_receiver: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.free_receiver ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" scope: &"), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t15}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" from_embed_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t16}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t17}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t17); @@ -11623,19 +11644,33 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t18 = v__ast__Language_str(it.language); - string _t19 = v__ast__Language_str(it.file_mode); - string _t20 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t21 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); - string _t22 = v__ast__Type_str(it.return_type); - string _t23 = v__ast__Type_str(it.receiver_type); - string _t24 = indent_Array_v__ast__Param_str(it.params, indent_count + 1); - string _t25 = Array_string_str(it.generic_names); - string _t26 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + 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[]){ {_SLIT("v.ast.Fn{\n"), 0, {.d_c=0}}, - {_SLIT0, 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(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t18}}, {_SLIT(""), 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(" 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(" 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(" 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}}, {_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}}, @@ -11647,21 +11682,7 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_keep_alive: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_keep_alive ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_method: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_method ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" no_body: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.no_body ? _SLIT("true") : _SLIT("false")}}, {_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(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t19}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t21}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_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(" params: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_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(" usages: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.usages}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, {_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(" 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("}"), 0, {.d_c=0}}, })); string_free(&_t26); @@ -11709,11 +11730,12 @@ static string indent_v__gen__c__StrType_str(v__gen__c__StrType it, int indent_co 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 res = str_intp( 15, _MOV((StrIntpData[]){ + 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}}, {_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); @@ -11913,8 +11935,8 @@ static string indent_v__ast__ArrayFixed_str(v__ast__ArrayFixed it, int indent_co string _t48 = 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: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.size}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_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=_t48}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); @@ -11969,25 +11991,25 @@ static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_ static string indent_v__ast__Interface_str(v__ast__Interface 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__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_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t52 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t53 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t54 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t55 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); + string _t56 = indent_Array_v__ast__Type_str(it.embeds, 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( 39, _MOV((StrIntpData[]){ {_SLIT("v.ast.Interface{\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}}, - {_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(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_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}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t52}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 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(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t54}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t55}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 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_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); @@ -12039,18 +12061,19 @@ static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { string _t66 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); string _t67 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); string _t68 = v__ast__Type_str(it.parent_type); - string res = str_intp( 43, _MOV((StrIntpData[]){ + 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=_t63}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_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}}, - {_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(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t66}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t67}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_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}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_minify: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_minify ? _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(&_t68); @@ -12073,13 +12096,13 @@ static string indent_v__ast__SumType_str(v__ast__SumType it, int indent_count) { 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=_t69}}, {_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(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_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(&_t73); @@ -12138,13 +12161,13 @@ static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { string _t78 = 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(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t76}}, {_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}}, + {_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=_t76}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t77}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t78}}, {_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(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t77}}, {_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(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t78}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t78); @@ -12156,29 +12179,30 @@ static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t79 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t80 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t81 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); - string _t82 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t83 = v__ast__Expr_str(it.default_expr); + string _t79 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t80 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t81 = v__ast__Expr_str(it.default_expr); + string _t82 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t83 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); string _t84 = v__ast__Type_str(it.default_expr_typ); string _t85 = v__ast__Type_str(it.typ); - string res = str_intp( 59, _MOV((StrIntpData[]){ + string res = str_intp( 63, _MOV((StrIntpData[]){ {_SLIT("v.ast.StructField{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t79}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t80}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t81}}, {_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(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t82}}, {_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}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t79}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t80}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_val: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.default_val}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t81}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t82}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t83}}, {_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=_t84}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t85}}, {_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}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_global: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_global ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_volatile: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_volatile ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 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=_t84}}, {_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(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t85}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t85); @@ -13054,17 +13078,17 @@ static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b) { } static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__EmbeddedFile b) { - return string__eq(a.rpath, b.rpath) + return Array_u8_arr_eq(a.bytes, b.bytes) + && string__eq(a.rpath, b.rpath) && string__eq(a.apath, b.apath) && string__eq(a.compression_type, b.compression_type) - && a.is_compressed == b.is_compressed - && Array_u8_arr_eq(a.bytes, b.bytes) - && a.len == b.len; + && a.len == b.len + && a.is_compressed == b.is_compressed; } void v__ast__Param_free(v__ast__Param* it) { - v__token__Pos_free(&(it->pos)); string_free(&(it->name)); + v__token__Pos_free(&(it->pos)); v__token__Pos_free(&(it->type_pos)); } @@ -13089,14 +13113,14 @@ void Array_v__ast__Attr_free(Array_v__ast__Attr* it) { } void v__ast__Fn_free(v__ast__Fn* it) { - string_free(&(it->mod)); - string_free(&(it->file)); - v__token__Pos_free(&(it->pos)); - v__token__Pos_free(&(it->return_type_pos)); - string_free(&(it->name)); Array_v__ast__Param_free(&(it->params)); Array_string_free(&(it->generic_names)); Array_v__ast__Attr_free(&(it->attrs)); + string_free(&(it->mod)); + string_free(&(it->file)); + string_free(&(it->name)); + v__token__Pos_free(&(it->pos)); + v__token__Pos_free(&(it->return_type_pos)); } void Array_v__ast__Fn_free(Array_v__ast__Fn* it) { @@ -13107,9 +13131,9 @@ void Array_v__ast__Fn_free(Array_v__ast__Fn* it) { } void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) { + Array_v__ast__Fn_free(&(it->methods)); string_free(&(it->name)); string_free(&(it->cname)); - Array_v__ast__Fn_free(&(it->methods)); string_free(&(it->mod)); } @@ -13146,13 +13170,13 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_os__FileNotOpenedError_index) return 65648; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65649; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65662; - if (sidx == _IError_flag__UnkownFlagError_index) return 66096; - if (sidx == _IError_flag__ArgsCountError_index) return 66097; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66107; - if (sidx == _IError_semver__EmptyInputError_index) return 66109; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66110; + if (sidx == _IError_flag__UnkownFlagError_index) return 66097; + if (sidx == _IError_flag__ArgsCountError_index) return 66098; + 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_time__TimeParseError_index) return 221; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 499; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 500; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -13564,21 +13588,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 494; + return 495; } 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 495; + return 496; } 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 496; + return 497; } 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"; @@ -13587,9 +13611,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 66023; - return 532; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 535; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66024; + return 533; } // << typeof() support for sum types @@ -17912,6 +17936,13 @@ VNORETURN void panic_optional_not_set(string s) { while(1); } +// Attr: [noreturn] +VNORETURN void panic_result_not_set(string s) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("result not set ("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + while(1); +} + // Attr: [noreturn] VNORETURN void _v_panic(string s) { #if defined(_VFREESTANDING) @@ -37883,7 +37914,7 @@ string rand__ascii(int len) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -37958,7 +37989,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("91a9137b3"); + string vhash = _SLIT("3baf1741b"); 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; @@ -38493,8 +38524,45 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn return _t1; } +// Attr: [linux] +VV_LOCAL_SYMBOL void v__pref__detect_musl(v__pref__Preferences* res) { + res->is_glibc = true; + res->is_musl = false; + if (os__exists(_SLIT("/etc/alpine-release"))) { + res->is_musl = true; + res->is_glibc = false; + return; + } + Array_string _t1 = {0}; + Array_string _t1_orig = os__walk_ext(_SLIT("/proc/self/map_files/"), _SLIT("")); + int _t1_len = _t1_orig.len; + _t1 = __new_array(0, _t1_len, sizeof(string)); + + for (int _t2 = 0; _t2 < _t1_len; ++_t2) { + string it = ((string*) _t1_orig.data)[_t2]; + string ti = os__real_path(it); + array_push((array*)&_t1, &ti); + } + Array_string my_libs =_t1; + bool _t3 = false; + Array_string _t3_orig = my_libs; + int _t3_len = _t3_orig.len; + for (int _t4 = 0; _t4 < _t3_len; ++_t4) { + string it = ((string*) _t3_orig.data)[_t4]; + if (string_contains(it, _SLIT("musl"))) { + _t3 = true; + break; + } + } + if (_t3) { + res->is_musl = true; + res->is_glibc = false; + } +} + multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__detect_musl(res); #if defined(TARGET_IS_64BIT) { res->m64 = true; @@ -38704,6 +38772,16 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-no-retry-compilation"))) { res->retry_compilation = false; } + else if (string__eq(arg, _SLIT("-musl"))) { + res->is_musl = true; + res->is_glibc = false; + array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); + } + else if (string__eq(arg, _SLIT("-glibc"))) { + res->is_musl = false; + res->is_glibc = true; + array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); + } else if (string__eq(arg, _SLIT("-no-builtin"))) { res->no_builtin = true; array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); @@ -38721,7 +38799,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-profile-fns"))) { Array_string profile_fns = string_split(os__cmdline__option(current_args, arg, _SLIT("")), _SLIT(",")); if (profile_fns.len > 0) { - _PUSH_MANY(&res->profile_fns, (profile_fns), _t15, Array_string); + _PUSH_MANY(&res->profile_fns, (profile_fns), _t17, Array_string); } i++; } @@ -38831,9 +38909,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-os"))) { string target_os = os__cmdline__option(current_args, _SLIT("-os"), _SLIT("")); i++; - Option_v__pref__OS _t20 = v__pref__os_from_string(target_os); - if (_t20.state != 0) { /*or block*/ - IError err = _t20.err; + Option_v__pref__OS _t22 = v__pref__os_from_string(target_os); + if (_t22.state != 0) { /*or block*/ + IError err = _t22.err; if (string__eq(target_os, _SLIT("cross"))) { res->output_cross_c = true; continue; @@ -38844,7 +38922,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors ; } - v__pref__OS target_os_kind = (*(v__pref__OS*)_t20.data); + v__pref__OS target_os_kind = (*(v__pref__OS*)_t22.data); if (target_os_kind == v__pref__OS__wasm32) { res->is_bare = true; } @@ -38852,7 +38930,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors 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 = target_os}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } else if (string__eq(arg, _SLIT("-printfn"))) { - _PUSH_MANY(&res->printfn_list, (string_split(os__cmdline__option(current_args, _SLIT("-printfn"), _SLIT("")), _SLIT(","))), _t22, Array_string); + _PUSH_MANY(&res->printfn_list, (string_split(os__cmdline__option(current_args, _SLIT("-printfn"), _SLIT("")), _SLIT(","))), _t24, Array_string); i++; } else if (string__eq(arg, _SLIT("-cflags"))) { @@ -38878,6 +38956,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-cc"))) { res->ccompiler = os__cmdline__option(current_args, _SLIT("-cc"), _SLIT("cc")); 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 = res->ccompiler}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + if (string__eq(res->ccompiler, _SLIT("musl-gcc"))) { + res->is_musl = true; + res->is_glibc = false; + } i++; } else if (string__eq(arg, _SLIT("-checker-match-exhaustive-cutoff-limit"))) { @@ -38900,13 +38982,13 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors 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 }}}))) })); - Option_v__pref__Backend _t26 = v__pref__backend_from_string(sbackend); - if (_t26.state != 0) { /*or block*/ - IError err = _t26.err; + Option_v__pref__Backend _t28 = v__pref__backend_from_string(sbackend); + if (_t28.state != 0) { /*or block*/ + IError err = _t28.err; continue; } - v__pref__Backend b = (*(v__pref__Backend*)_t26.data); + v__pref__Backend b = (*(v__pref__Backend*)_t28.data); if (v__pref__Backend_is_js(b)) { res->output_cross_c = true; } @@ -38931,16 +39013,16 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-custom-prelude"))) { string path = os__cmdline__option(current_args, _SLIT("-custom-prelude"), _SLIT("")); 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 = path}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - Option_string _t30 = os__read_file(path); - if (_t30.state != 0) { /*or block*/ - IError err = _t30.err; + Option_string _t32 = os__read_file(path); + if (_t32.state != 0) { /*or block*/ + IError err = _t32.err; eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot open custom prelude file: "), /*115 &IError*/0xfe10, {.d_s = IError_str(err)}}, {_SLIT0, 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); ; } - string prelude = (*(string*)_t30.data); + string prelude = (*(string*)_t32.data); res->custom_prelude = prelude; i++; } @@ -39003,8 +39085,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); } res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); - Array_string _t31; - res->run_args = (_t31 = args, array_slice(_t31, command_pos + 2, _t31.len)); + Array_string _t33; + res->run_args = (_t33 = args, array_slice(_t33, command_pos + 2, _t33.len)); if (string__eq(res->path, _SLIT("-"))) { string tmp_file_path = rand__ulid(); string tmp_exe_file_path = res->out_name; @@ -39015,9 +39097,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } string tmp_v_file_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_file_path}}, {_SLIT(".v"), 0, { .d_c = 0 }}})); string contents = os__get_raw_lines_joined(); - Option_void _t32 = os__write_file(tmp_v_file_path, contents); - if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { - IError err = _t32.err; + Option_void _t34 = os__write_file(tmp_v_file_path, contents); + if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { + IError err = _t34.err; _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to create temporary file "), /*115 &string*/0xfe10, {.d_s = tmp_v_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); VUNREACHABLE(); ; @@ -39025,8 +39107,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors ; string run_options = Array_string_join(os__cmdline__options_before(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), _SLIT(" ")); - Array_string _t33; - string command_options = Array_string_join((_t33 = os__cmdline__options_after(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), array_slice(_t33, 1, _t33.len)), _SLIT(" ")); + Array_string _t35; + string command_options = Array_string_join((_t35 = os__cmdline__options_after(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), array_slice(_t35, 1, _t35.len)), _SLIT(" ")); string vexe = v__pref__vexe_path(); string tmp_cmd = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = output_option}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = run_options}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(tmp_v_file_path)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = command_options}}, {_SLIT0, 0, { .d_c = 0 }}})); v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("tmp_cmd: "), /*115 &string*/0xfe10, {.d_s = tmp_cmd}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -39034,17 +39116,17 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("exit code: "), /*100 &int*/0xfe07, {.d_i32 = tmp_result}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (output_option.len != 0) { v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("remove tmp exe file: "), /*115 &string*/0xfe10, {.d_s = tmp_exe_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); - Option_void _t34 = os__rm(tmp_exe_file_path); - if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { - IError err = _t34.err; + Option_void _t36 = os__rm(tmp_exe_file_path); + if (_t36.state != 0 && _t36.err._typ != _IError_None___index) { + IError err = _t36.err; } ; } v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("remove tmp v file: "), /*115 &string*/0xfe10, {.d_s = tmp_v_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); - Option_void _t35 = os__rm(tmp_v_file_path); - if (_t35.state != 0 && _t35.err._typ != _IError_None___index) { - IError err = _t35.err; + Option_void _t37 = os__rm(tmp_v_file_path); + if (_t37.state != 0 && _t37.err._typ != _IError_None___index) { + IError err = _t37.err; } ; @@ -39065,8 +39147,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if (string_ends_with(command, _SLIT(".vsh"))) { res->is_run = true; res->path = command; - Array_string _t36; - res->run_args = (_t36 = args, array_slice(_t36, command_pos + 1, _t36.len)); + Array_string _t38; + res->run_args = (_t38 = args, array_slice(_t38, command_pos + 1, _t38.len)); } else if (string__eq(command, _SLIT("interpret"))) { res->backend = v__pref__Backend__interpret; if (command_pos + 2 > args.len) { @@ -39075,8 +39157,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); } res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); - Array_string _t37; - res->run_args = (_t37 = args, array_slice(_t37, command_pos + 2, _t37.len)); + Array_string _t39; + res->run_args = (_t39 = args, array_slice(_t39, command_pos + 2, _t39.len)); v__pref__must_exist(res->path); if (!string_ends_with(res->path, _SLIT(".v")) && os__is_executable(res->path) && os__is_file(res->path) && os__is_file(string__plus(res->path, _SLIT(".v")))) { eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("It looks like you wanted to run \""), /*115 &string*/0xfe10, {.d_s = res->path}}, {_SLIT(".v\", so we went ahead and did that since \""), /*115 &string*/0xfe10, {.d_s = res->path}}, {_SLIT("\" is an executable."), 0, { .d_c = 0 }}}))); @@ -39093,8 +39175,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); } Map_string_string m = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - for (int _t38 = 0; _t38 < res->build_options.len; ++_t38) { - string x = ((string*)res->build_options.data)[_t38]; + for (int _t40 = 0; _t40 < res->build_options.len; ++_t40) { + string x = ((string*)res->build_options.data)[_t40]; map_set(&m, &(string[]){x}, &(string[]) { _SLIT("") }); } res->build_options = map_keys(&m); @@ -44164,25 +44246,25 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ }; } v__ast__Expr _t3 = v__ast__ArrayInit_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayInit, (((v__ast__ArrayInit){ - .pos = node.pos, - .elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)), .pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)), + .exprs = exprs, + .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), + .mod = (string){.str=(byteptr)"", .is_lit=1}, + .len_expr = len_expr, + .cap_expr = cap_expr, + .default_expr = default_expr, + .pos = node.pos, + .elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .elem_type = array_info.elem_type, + .default_type = 0, + .typ = typ, .is_fixed = 0, .has_val = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .has_len = has_len, .has_cap = has_cap, .has_default = has_default, .has_it = 0, - .exprs = exprs, - .len_expr = len_expr, - .cap_expr = cap_expr, - .default_expr = default_expr, - .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), - .elem_type = array_info.elem_type, - .default_type = 0, - .typ = typ, })))); return _t3; } else if (type_sym->kind == v__ast__Kind__map) { @@ -44191,13 +44273,13 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ Array_v__ast__Expr vals = __new_array_with_default(0, 0, sizeof(v__ast__Expr), 0); for (int _t4 = 0; _t4 < node.fields.len; ++_t4) { v__ast__StructInitField field = ((v__ast__StructInitField*)node.fields.data)[_t4]; - array_push((array*)&keys, _MOV((v__ast__Expr[]){ v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = field.name,.is_raw = 0,.language = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))) })); + array_push((array*)&keys, _MOV((v__ast__Expr[]){ v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = field.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.is_raw = 0,})))) })); array_push((array*)&vals, _MOV((v__ast__Expr[]){ field.expr })); } - v__ast__Expr _t7 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = typ,.key_type = map_info.key_type,.value_type = map_info.value_type,})))); + v__ast__Expr _t7 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.key_type = map_info.key_type,.value_type = map_info.value_type,})))); return _t7; } - v__ast__Expr _t8 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){node.pos,node.name_pos,node.is_short,node.is_short_syntax,.unresolved = false,node.pre_comments,node.typ_str,node.typ,node.update_expr,node.update_expr_type,node.update_expr_comments,node.is_update_embed,node.has_update_expr,node.fields,node.embeds,node.generic_types,})))); + v__ast__Expr _t8 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){node.pre_comments,node.update_expr_comments,node.fields,node.embeds,node.generic_types,node.typ_str,node.update_expr,node.pos,node.name_pos,node.typ,node.update_expr_type,node.is_short,node.is_short_syntax,.unresolved = false,node.is_update_embed,node.has_update_expr,})))); return _t8; } @@ -44359,7 +44441,7 @@ void v__ast__Scope_register_struct_field(v__ast__Scope* s, string name, v__ast__ return; } } - (*(v__ast__ScopeStructField*)map_get_and_set((map*)&s->struct_fields, &(string[]){name}, &(v__ast__ScopeStructField[]){ (v__ast__ScopeStructField){.struct_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.orig_type = 0,} })) = field; + (*(v__ast__ScopeStructField*)map_get_and_set((map*)&s->struct_fields, &(string[]){name}, &(v__ast__ScopeStructField[]){ (v__ast__ScopeStructField){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.struct_type = 0,.typ = 0,.orig_type = 0,} })) = field; } void v__ast__Scope_register(v__ast__Scope* s, v__ast__ScopeObject obj) { @@ -45278,7 +45360,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}; + 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,}; } v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v__ast__Type new_type) { @@ -45294,7 +45376,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; + return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -45318,7 +45400,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.pointer_size = 0,}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -45478,14 +45560,14 @@ 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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 }); } } void v__ast__Table_register_interface(v__ast__Table* t, v__ast__InterfaceDecl idecl) { - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&t->interfaces, &(int[]){idecl.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })) = idecl; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&t->interfaces, &(int[]){idecl.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })) = idecl; } int v__ast__TypeSymbol_register_method(v__ast__TypeSymbol* t, v__ast__Fn new_fn) { @@ -45500,7 +45582,7 @@ Option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__a } v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 430) /*expected idx: 430, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__Fn new_fn = ((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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); @@ -45598,9 +45680,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12435 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12435.arg0; - Array_v__ast__Type types = mr_12435.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12461 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12461.arg0; + Array_v__ast__Type types = mr_12461.arg1; 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); @@ -45632,9 +45714,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13093 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_13093.arg0; - Array_v__ast__Type types = mr_13093.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13119 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13119.arg0; + Array_v__ast__Type types = mr_13119.arg1; 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); @@ -45657,9 +45739,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13556 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13556.arg0; - Array_v__ast__Type embed_types = mr_13556.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13582 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13582.arg0; + Array_v__ast__Type embed_types = mr_13582.arg1; if (embed_types.len != 0) { Option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok(&(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)); @@ -45686,8 +45768,8 @@ Option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__ast return (Option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_14017 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14017.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14043 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14043.arg0; Option_v__ast__Fn _t5; opt_ok(&(v__ast__Fn[]) { func }, (Option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -45715,7 +45797,7 @@ VV_LOCAL_SYMBOL Option_v__ast__StructField v__ast__Table_register_aggregate_fiel } v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 430) /*expected idx: 430, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__StructField new_field = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); 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); @@ -45728,7 +45810,7 @@ VV_LOCAL_SYMBOL Option_v__ast__StructField v__ast__Table_register_aggregate_fiel } else if (!v__ast__Type_alias_eq(new_field.typ, type_field.typ)) { return (Option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` type is different"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - new_field = ((v__ast__StructField){new_field.pos,new_field.type_pos,new_field.comments,new_field.has_default_expr,new_field.attrs,.is_pub = new_field.is_pub && type_field.is_pub,new_field.default_val,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,new_field.default_expr,new_field.default_expr_typ,new_field.name,new_field.typ,}); + new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,}); } else { IError err = _t2.err; return (Option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("` has no field or method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -45850,9 +45932,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17264 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17264.arg0; - Array_v__ast__Type types = mr_17264.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17290 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17290.arg0; + Array_v__ast__Type types = mr_17290.arg1; 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); @@ -45875,9 +45957,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17717 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17717.arg0; - Array_v__ast__Type embed_types = mr_17717.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17743 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17743.arg0; + Array_v__ast__Type embed_types = mr_17743.arg1; if (embed_types.len > 0) { Option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok(&(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)); @@ -45908,8 +45990,8 @@ Option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* t return (Option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18315 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18315.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18341 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18341.arg0; Option_v__ast__StructField _t5; opt_ok(&(v__ast__StructField[]) { field }, (Option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -45944,9 +46026,9 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS for (int _t3 = 0; _t3 < fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)fields.data)[_t3]; if (!_IN_MAP(ADDR(string, field.name), ADDR(map, field_map))) { - (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })) = field; + (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) = field; (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; - } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })))) { + } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })))) { (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; } } @@ -45964,7 +46046,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS field = string_clone(field); int nr_definitions = (*(int*)DenseArray_value(&field_usages.key_values, _t4)); if (nr_definitions == info.variants.len) { - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,} })) })); } } info.found_fields = true; @@ -46071,17 +46153,17 @@ VV_LOCAL_SYMBOL int v__ast__Table_rewrite_already_registered_symbol(v__ast__Tabl } #endif if (existing_symbol->kind == v__ast__Kind__placeholder) { - (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,typ.kind,typ.name,typ.cname,.methods = existing_symbol->methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = existing_symbol->methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,typ.kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); int _t1 = existing_idx; return _t1; } if ((existing_idx >= _const_v__ast__string_type_idx && existing_idx <= _const_v__ast__map_type_idx) || existing_idx == _const_v__ast__error_type_idx) { if (existing_idx == _const_v__ast__string_type_idx) { { // Unsafe block - *existing_symbol = *((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,.kind = existing_symbol->kind,typ.name,typ.cname,typ.methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + *existing_symbol = *((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,.kind = existing_symbol->kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); } } else { - (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,typ.kind,typ.name,typ.cname,typ.methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,typ.kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); } int _t2 = existing_idx; return _t2; @@ -46135,7 +46217,7 @@ int idx; } } idx = t->type_symbols.len; - array_push((array*)&t->type_symbols, _MOV((v__ast__TypeSymbol*[]){ ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){sym.parent_idx,sym.info,sym.kind,sym.name,sym.cname,sym.methods,sym.mod,sym.is_pub,sym.language,sym.idx,}, sizeof(v__ast__TypeSymbol))) })); + array_push((array*)&t->type_symbols, _MOV((v__ast__TypeSymbol*[]){ ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){sym.methods,sym.info,sym.name,sym.cname,sym.mod,sym.parent_idx,sym.idx,sym.size,sym.align,sym.kind,sym.language,sym.is_pub,}, sizeof(v__ast__TypeSymbol))) })); (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx))->idx = idx; map_set(&t->type_idxs, &(string[]){sym.name}, &(int[]) { idx }); int _t4 = idx; @@ -46152,7 +46234,7 @@ int idx; // Attr: [inline] inline void v__ast__Table_register_enum_decl(v__ast__Table* t, v__ast__EnumDecl enum_decl) { - (*(v__ast__EnumDecl*)map_get_and_set((map*)&t->enum_decls, &(string[]){enum_decl.name}, &(v__ast__EnumDecl[]){ (v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = enum_decl; + (*(v__ast__EnumDecl*)map_get_and_set((map*)&t->enum_decls, &(string[]){enum_decl.name}, &(v__ast__EnumDecl[]){ (v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,} })) = enum_decl; } bool v__ast__Table_known_type(v__ast__Table* t, string name) { @@ -46354,7 +46436,7 @@ int v__ast__Table_find_or_register_chan(v__ast__Table* t, v__ast__Type elem_type int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol chan_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__chan_type_idx,.info = v__ast__Chan_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Chan, (((v__ast__Chan){.elem_type = elem_type,.is_mut = is_mut,})))),.kind = v__ast__Kind__chan,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol chan_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Chan_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Chan, (((v__ast__Chan){.elem_type = elem_type,.is_mut = is_mut,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__chan_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__chan,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, chan_typ); return _t2; } @@ -46367,7 +46449,7 @@ int v__ast__Table_find_or_register_map(v__ast__Table* t, v__ast__Type key_type, int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol map_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__map_type_idx,.info = v__ast__Map_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Map, (((v__ast__Map){.key_type = key_type,.value_type = value_type,})))),.kind = v__ast__Kind__map,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol map_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Map_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Map, (((v__ast__Map){.key_type = key_type,.value_type = value_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__map_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__map,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, map_typ); return _t2; } @@ -46380,7 +46462,7 @@ int v__ast__Table_find_or_register_thread(v__ast__Table* t, v__ast__Type return_ int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol thread_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__thread_type_idx,.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = return_type,})))),.kind = v__ast__Kind__thread,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol thread_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = return_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__thread_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__thread,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, thread_typ); return _t2; } @@ -46393,7 +46475,7 @@ int v__ast__Table_find_or_register_promise(v__ast__Table* t, v__ast__Type return int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol promise_type = ((v__ast__TypeSymbol){.parent_idx = (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("Promise")}, &(int[]){ 0 })),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){return_type, (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("JS.Any")}, &(int[]){ 0 }))})),.parent_type = 0,})))),.kind = v__ast__Kind__struct_,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol promise_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){return_type, (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("JS.Any")}, &(int[]){ 0 }))})),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("Promise")}, &(int[]){ 0 })),.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__struct_,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, promise_type); return _t2; } @@ -46406,7 +46488,7 @@ int v__ast__Table_find_or_register_array(v__ast__Table* t, v__ast__Type elem_typ return _t1; } string cname = v__ast__Table_array_cname(t, elem_type); - v__ast__TypeSymbol array_type_ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__array_type_idx,.info = v__ast__Array_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Array, (((v__ast__Array){.nr_dims = 1,.elem_type = elem_type,})))),.kind = v__ast__Kind__array,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol array_type_ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Array_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Array, (((v__ast__Array){.nr_dims = 1,.elem_type = elem_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__array_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, array_type_); return _t2; } @@ -46428,7 +46510,7 @@ int v__ast__Table_find_or_register_array_fixed(v__ast__Table* t, v__ast__Type el return _t1; } string cname = v__ast__Table_array_fixed_cname(t, elem_type, size); - v__ast__TypeSymbol array_fixed_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__ArrayFixed, (((v__ast__ArrayFixed){.size = size,.size_expr = size_expr,.elem_type = elem_type,})))),.kind = v__ast__Kind__array_fixed,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol array_fixed_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__ArrayFixed, (((v__ast__ArrayFixed){.size_expr = size_expr,.size = size,.elem_type = elem_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array_fixed,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, array_fixed_type); return _t2; } @@ -46439,9 +46521,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_31373 = (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_31373.arg0; - string cref = mr_31373.arg1; + multi_return_string_string mr_31399 = (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_31399.arg0; + string cref = mr_31399.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) { @@ -46454,7 +46536,7 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol mr_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__MultiReturn, (((v__ast__MultiReturn){.types = mr_typs,})))),.kind = v__ast__Kind__multi_return,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol mr_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__MultiReturn, (((v__ast__MultiReturn){.types = mr_typs,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__multi_return,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, mr_type); return _t2; } @@ -46468,7 +46550,7 @@ int v__ast__Table_find_or_register_fn_type(v__ast__Table* t, string mod, v__ast_ int _t1 = existing_idx; return _t1; } - int _t2 = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__FnType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__FnType, (((v__ast__FnType){.is_anon = anon,.has_decl = has_decl,.func = f,})))),.kind = v__ast__Kind__function,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = mod,.is_pub = 0,.language = 0,.idx = 0,})); + int _t2 = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__FnType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__FnType, (((v__ast__FnType){.is_anon = anon,.has_decl = has_decl,.func = f,})))),.name = name,.cname = cname,.mod = mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__function,.language = 0,.is_pub = 0,})); return _t2; } @@ -46477,7 +46559,7 @@ int v__ast__Table_add_placeholder_type(v__ast__Table* t, string name, v__ast__La if (string_contains(name, _SLIT("."))) { modname = string_all_before_last(name, _SLIT(".")); } - v__ast__TypeSymbol ph_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__placeholder,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = modname,.is_pub = 0,.language = language,.idx = 0,}); + v__ast__TypeSymbol ph_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = modname,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__placeholder,.language = language,.is_pub = 0,}); int _t1 = v__ast__Table_register_sym(t, ph_type); return _t1; } @@ -46756,7 +46838,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type return _t5; } if ((inter_sym->info)._typ == 435 /* v.ast.Interface */) { - Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).attrs; + Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; if (string__eq(attr.name, _SLIT("single_impl"))) { @@ -47340,7 +47422,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.concrete_types = final_concrete_types; info.parent_type = typ; info.fields = fields; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__struct_,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__struct_,.language = 0,.is_pub = 0,})); for (int _t32 = 0; _t32 < needs_unwrap_types.len; ++_t32) { v__ast__Type typ_ = ((v__ast__Type*)needs_unwrap_types.data)[_t32]; v__ast__Table_unwrap_generic_type(t, typ_, generic_names, concrete_types); @@ -47370,7 +47452,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.parent_type = typ; info.fields = fields; info.variants = variants; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__sum_type,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__sum_type,.language = 0,.is_pub = 0,})); for (int _t35 = 0; _t35 < needs_unwrap_types.len; ++_t35) { v__ast__Type typ_ = ((v__ast__Type*)needs_unwrap_types.data)[_t35]; v__ast__Table_unwrap_generic_type(t, typ_, generic_names, concrete_types); @@ -47412,7 +47494,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.parent_type = typ; info.fields = fields; info.methods = imethods; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__interface_,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__interface_,.language = 0,.is_pub = 0,})); v__ast__TypeSymbol* ts_copy = v__ast__Table_sym(t, new_idx); for (int _t43 = 0; _t43 < all_methods.len; ++_t43) { v__ast__Fn method = ((v__ast__Fn*)all_methods.data)[_t43]; @@ -47574,7 +47656,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { parent_info.concrete_types = array_clone_to_depth(&info.concrete_types, 0); parent_info.fields = fields; parent_info.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic); - (*typ)->info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){parent_info.attrs,parent_info.embeds,.fields = fields,parent_info.is_typedef,parent_info.is_union,parent_info.is_heap,.is_generic = false,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){parent_info.attrs,parent_info.embeds,.fields = fields,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),parent_info.is_typedef,parent_info.is_union,parent_info.is_heap,parent_info.is_minify,.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent_info.parent_type); @@ -47646,7 +47728,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { } } } - (*typ)->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){parent_info.types,.fields = fields,.methods = imethods,parent_info.embeds,parent_info.conversions,.is_generic = false,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){parent_info.conversions,parent_info.types,.fields = fields,.methods = imethods,parent_info.embeds,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; (*typ)->methods = all_methods; @@ -47697,7 +47779,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { } } } - (*typ)->info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = fields,parent_info.found_fields,parent_info.is_anon,.is_generic = false,.variants = variants,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = fields,.variants = variants,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),parent_info.found_fields,parent_info.is_anon,.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; } else { @@ -48214,7 +48296,7 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.enum_info")); VUNREACHABLE(); - return (v__ast__Enum){.vals = __new_array(0, 0, sizeof(string)),.is_flag = 0,.is_multi_allowed = 0,}; + return (v__ast__Enum){.vals = __new_array(0, 0, sizeof(string)),.is_flag = 0,.is_multi_allowed = 0,.uses_exprs = 0,}; } // Attr: [inline] @@ -48340,7 +48422,7 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.struct_info")); VUNREACHABLE(); - return (v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}; + return (v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}; } // Attr: [inline] @@ -48358,7 +48440,7 @@ inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.sumtype_info")); VUNREACHABLE(); - return (v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = 0,.is_generic = 0,.variants = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}; + return (v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = 0,.is_generic = 0,}; } bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { @@ -48374,37 +48456,37 @@ bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { } void v__ast__Table_register_builtin_type_symbols(v__ast__Table* t) { - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__placeholder,.name = _SLIT("reserved_0"),.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__void,.name = _SLIT("void"),.cname = _SLIT("void"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__voidptr,.name = _SLIT("voidptr"),.cname = _SLIT("voidptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__byteptr,.name = _SLIT("byteptr"),.cname = _SLIT("byteptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__charptr,.name = _SLIT("charptr"),.cname = _SLIT("charptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i8,.name = _SLIT("i8"),.cname = _SLIT("i8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i16,.name = _SLIT("i16"),.cname = _SLIT("i16"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__int,.name = _SLIT("int"),.cname = _SLIT("int"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i64,.name = _SLIT("i64"),.cname = _SLIT("i64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__isize,.name = _SLIT("isize"),.cname = _SLIT("isize"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u8,.name = _SLIT("u8"),.cname = _SLIT("u8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u16,.name = _SLIT("u16"),.cname = _SLIT("u16"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u32,.name = _SLIT("u32"),.cname = _SLIT("u32"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u64,.name = _SLIT("u64"),.cname = _SLIT("u64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__usize,.name = _SLIT("usize"),.cname = _SLIT("usize"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__f32,.name = _SLIT("f32"),.cname = _SLIT("f32"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__f64,.name = _SLIT("f64"),.cname = _SLIT("f64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__char,.name = _SLIT("char"),.cname = _SLIT("char"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__bool,.name = _SLIT("bool"),.cname = _SLIT("bool"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__none_,.name = _SLIT("none"),.cname = _SLIT("none"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__string,.name = _SLIT("string"),.cname = _SLIT("string"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__rune,.name = _SLIT("rune"),.cname = _SLIT("rune"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__array,.name = _SLIT("array"),.cname = _SLIT("array"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__map,.name = _SLIT("map"),.cname = _SLIT("map"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__chan,.name = _SLIT("chan"),.cname = _SLIT("chan"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = _SLIT("any"),.cname = _SLIT("any"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__float_literal,.name = _SLIT("float literal"),.cname = _SLIT("float_literal"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__int_literal,.name = _SLIT("int literal"),.cname = _SLIT("int_literal"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = _const_v__ast__void_type,})))),.kind = v__ast__Kind__thread,.name = _SLIT("thread"),.cname = _SLIT("__v_thread"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__interface_,.name = _SLIT("IError"),.cname = _SLIT("IError"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u8,.name = _SLIT("zu8"),.cname = _SLIT("zu8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("reserved_0"),.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__placeholder,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("void"),.cname = _SLIT("void"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__void,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("voidptr"),.cname = _SLIT("voidptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__voidptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("byteptr"),.cname = _SLIT("byteptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__byteptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("charptr"),.cname = _SLIT("charptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__charptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i8"),.cname = _SLIT("i8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i8,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i16"),.cname = _SLIT("i16"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i16,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("int"),.cname = _SLIT("int"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__int,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i64"),.cname = _SLIT("i64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("isize"),.cname = _SLIT("isize"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__isize,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u8"),.cname = _SLIT("u8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u8,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u16"),.cname = _SLIT("u16"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u16,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u32"),.cname = _SLIT("u32"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u32,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u64"),.cname = _SLIT("u64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("usize"),.cname = _SLIT("usize"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__usize,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("f32"),.cname = _SLIT("f32"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__f32,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("f64"),.cname = _SLIT("f64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__f64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("char"),.cname = _SLIT("char"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__char,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("bool"),.cname = _SLIT("bool"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__bool,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("none"),.cname = _SLIT("none"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__none_,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("string"),.cname = _SLIT("string"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__string,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("rune"),.cname = _SLIT("rune"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__rune,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("array"),.cname = _SLIT("array"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("map"),.cname = _SLIT("map"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__map,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("chan"),.cname = _SLIT("chan"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__chan,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("any"),.cname = _SLIT("any"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("float literal"),.cname = _SLIT("float_literal"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__float_literal,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("int literal"),.cname = _SLIT("int_literal"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__int_literal,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = _const_v__ast__void_type,})))),.name = _SLIT("thread"),.cname = _SLIT("__v_thread"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__thread,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("IError"),.cname = _SLIT("IError"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__interface_,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("zu8"),.cname = _SLIT("zu8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u8,.language = 0,.is_pub = 0,})); } // Attr: [inline] @@ -48454,23 +48536,26 @@ inline bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t) { return _t1; } -int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { +multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { - int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); + multi_return_int_int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); return _t1; } if (v__ast__Type_nr_muls(typ) > 0) { - int _t2 = t->pointer_size; - return _t2; + return (multi_return_int_int){.arg0=t->pointer_size, .arg1=t->pointer_size}; } v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); + if (sym->size != -1) { + return (multi_return_int_int){.arg0=sym->size, .arg1=sym->align}; + } + int size = 0; + int align = 0; switch (sym->kind) { case v__ast__Kind__placeholder: case v__ast__Kind__void: case v__ast__Kind__none_: + case v__ast__Kind__generic_inst: { - int _t3 = 0; - return _t3; break; } case v__ast__Kind__voidptr: @@ -48483,8 +48568,7 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__thread: case v__ast__Kind__chan: { - int _t4 = t->pointer_size; - return _t4; + size = t->pointer_size; break; } case v__ast__Kind__i8: @@ -48492,15 +48576,15 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__char: case v__ast__Kind__bool: { - int _t5 = 1; - return _t5; + size = 1; + align = 1; break; } case v__ast__Kind__i16: case v__ast__Kind__u16: { - int _t6 = 2; - return _t6; + size = 2; + align = 2; break; } case v__ast__Kind__int: @@ -48509,8 +48593,8 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__f32: case v__ast__Kind__enum_: { - int _t7 = 4; - return _t7; + size = 4; + align = 4; break; } case v__ast__Kind__i64: @@ -48519,14 +48603,15 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__f64: case v__ast__Kind__float_literal: { - int _t8 = 8; - return _t8; + size = 8; + align = 8; break; } case v__ast__Kind__alias: { - int _t9 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type); - return _t9; + multi_return_int_int mr_21155 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type); + size = mr_21155.arg0; + align = mr_21155.arg1; break; } case v__ast__Kind__struct_: @@ -48535,34 +48620,35 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { { int max_alignment = 0; int total_size = 0; - Array_v__ast__Type _t10; /* if prepend */ + Array_v__ast__Type _t4; /* if prepend */ if ((sym->info)._typ == 417 /* v.ast.Struct */) { - Array_v__ast__Type _t11 = {0}; - Array_v__ast__StructField _t11_orig = (*sym->info._v__ast__Struct).fields; - int _t11_len = _t11_orig.len; - _t11 = __new_array(0, _t11_len, sizeof(v__ast__Type)); + Array_v__ast__Type _t5 = {0}; + Array_v__ast__StructField _t5_orig = (*sym->info._v__ast__Struct).fields; + int _t5_len = _t5_orig.len; + _t5 = __new_array(0, _t5_len, sizeof(v__ast__Type)); - for (int _t12 = 0; _t12 < _t11_len; ++_t12) { - v__ast__StructField it = ((v__ast__StructField*) _t11_orig.data)[_t12]; + for (int _t6 = 0; _t6 < _t5_len; ++_t6) { + v__ast__StructField it = ((v__ast__StructField*) _t5_orig.data)[_t6]; v__ast__Type ti = it.typ; - array_push((array*)&_t11, &ti); + array_push((array*)&_t5, &ti); } - _t10 =_t11; + _t4 =_t5; } else { - _t10 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.MultiReturn */ ).types; } - Array_v__ast__Type types = _t10; - for (int _t13 = 0; _t13 < types.len; ++_t13) { - v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t13]; - int field_size = v__ast__Table_type_size(t, ftyp); - int alignment = (field_size > t->pointer_size ? (t->pointer_size) : (field_size)); + 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_21466 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21466.arg0; + int alignment = mr_21466.arg1; if (alignment > max_alignment) { max_alignment = alignment; } total_size = v__ast__round_up(total_size, alignment) + field_size; } - int _t14 = v__ast__round_up(total_size, max_alignment); - return _t14; + size = v__ast__round_up(total_size, max_alignment); + align = max_alignment; break; } case v__ast__Kind__sum_type: @@ -48570,26 +48656,25 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__aggregate: { if (sym->info._typ == 436 /* v.ast.SumType */) { - int _t15 = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; - return _t15; + size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; + align = t->pointer_size; } else if (sym->info._typ == 430 /* v.ast.Aggregate */) { - int _t16 = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; - return _t16; + size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; + align = t->pointer_size; } else if (sym->info._typ == 435 /* v.ast.Interface */) { - int res = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; - for (int _t17 = 0; _t17 < (*sym->info._v__ast__Interface).embeds.len; ++_t17) { - v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t17]; - res += v__ast__Table_type_size(t, etyp) - 2 * t->pointer_size; + size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; + align = t->pointer_size; + for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { + v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; + multi_return_int_int mr_22027 = v__ast__Table_type_size(t, etyp); + int esize = mr_22027.arg0; + size += esize - 2 * t->pointer_size; } - int _t18 = res; - return _t18; } else { - int _t19 = 0; - return _t19; } ; break; @@ -48597,31 +48682,30 @@ 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, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ; - int _t20 = info.size * v__ast__Table_type_size(t, info.elem_type); - return _t20; + multi_return_int_int mr_22224 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22224.arg0; + int elem_align = mr_22224.arg1; + size = info.size * elem_size; + align = elem_align; break; } case v__ast__Kind__map: { - int _t21 = (t->pointer_size == 8 ? (120) : (80)); - return _t21; + size = (t->pointer_size == 8 ? (120) : (80)); + align = t->pointer_size; break; } case v__ast__Kind__array: { - int _t22 = (t->pointer_size == 8 ? (32) : (24)); - return _t22; - break; - } - case v__ast__Kind__generic_inst: - { - int _t23 = 0; - return _t23; + size = (t->pointer_size == 8 ? (32) : (24)); + align = t->pointer_size; break; } } ; - return 0; + sym->size = size; + sym->align = align; + return (multi_return_int_int){.arg0=size, .arg1=align}; } // Attr: [inline] @@ -49811,7 +49895,7 @@ v__ast__StructField v__ast__Struct_get_field(v__ast__Struct* s, string name) { } _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown field `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); - return (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}; + return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}; } Option_v__ast__StructField v__ast__SumType_find_field(v__ast__SumType* s, string name) { @@ -50229,28 +50313,28 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } int modified_left_type = _t6; *node = ((v__ast__AssignStmt){ - .op = v__token__Kind__assign, - .pos = node->pos, .comments = node->comments, .end_comments = node->end_comments, .right = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = v__token__Kind__right_shift, - .pos = node->pos, - .is_stmt = 0, - .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = modified_left_type,.expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)),.typname = v__ast__Table_type_str(c->table, modified_left_type),.expr_type = 0,.has_arg = 0,.pos = node->pos,})))), + .or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}, + .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)),.typname = v__ast__Table_type_str(c->table, modified_left_type),.pos = node->pos,.typ = modified_left_type,.expr_type = 0,.has_arg = 0,})))), .right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, 0)), + .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = node->pos, .left_type = modified_left_type, .right_type = right_type, - .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, - .or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}, + .op = v__token__Kind__right_shift, + .is_stmt = 0, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), }))))})), .left = node->left, .left_types = node->left_types, .right_types = node->right_types, + .pos = node->pos, + .op = v__token__Kind__assign, .is_static = node->is_static, .is_volatile = 0, .is_simple = node->is_simple, @@ -50406,97 +50490,116 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v return _t5; } } + if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) { + bool _t6 = true; + return _t6; + } v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); if (got_sym->kind == v__ast__Kind__enum_) { - if (v__ast__TypeSymbol_is_number(expected_sym)) { - bool _t6 = true; - return _t6; - } - } else if (got_sym->kind == v__ast__Kind__array_fixed) { if (v__ast__TypeSymbol_is_number(expected_sym)) { bool _t7 = true; return _t7; } + } else if (got_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(expected_sym)) { + bool _t8 = true; + return _t8; + } else if (v__ast__Type_is_any_kind_of_pointer(expected)) { + bool _t9 = true; + return _t9; + } + } else if (expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + bool _t10 = true; + return _t10; + } else if (got_sym->kind == v__ast__Kind__array) { + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ; + v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ; + if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { + bool _t11 = true; + return _t11; + } + } } if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t8 = true; - return _t8; + bool _t12 = true; + return _t12; } if (got_is_ptr && exp_is_ptr) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t9 = true; - return _t9; + bool _t13 = true; + return _t13; } } } if (got_is_ptr && exp_is_ptr) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { - bool _t10 = false; - return _t10; + bool _t14 = false; + return _t14; } } int exp_idx = v__ast__Type_idx(expected); int got_idx = v__ast__Type_idx(got); if (exp_idx == got_idx) { - bool _t11 = true; - return _t11; + bool _t15 = true; + return _t15; } if (exp_idx == _const_v__ast__voidptr_type_idx || exp_idx == _const_v__ast__byteptr_type_idx || (v__ast__Type_is_ptr(expected) && v__ast__Type_idx(v__ast__Type_deref(expected)) == _const_v__ast__byte_type_idx)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) { - bool _t12 = true; - return _t12; + bool _t16 = true; + return _t16; } } if (v__ast__Type_is_real_pointer(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { - bool _t13 = true; - return _t13; + bool _t17 = true; + return _t17; } } if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { - bool _t14 = true; - return _t14; + bool _t18 = true; + return _t18; } } if (v__ast__Type_alias_eq(expected, _const_v__ast__charptr_type) && v__ast__Type_alias_eq(got, v__ast__Type_ref(_const_v__ast__char_type))) { - bool _t15 = true; - return _t15; + bool _t19 = true; + return _t19; } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got); if (((sym->idx == _const_v__ast__error_type_idx || (v__ast__Type_alias_eq(got, _const_v__ast__none_type) || v__ast__Type_alias_eq(got, _const_v__ast__error_type))) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional)) || ((sym->idx == _const_v__ast__error_type_idx || v__ast__Type_alias_eq(got, _const_v__ast__error_type)) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__result))) { - bool _t16 = true; - return _t16; - } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { - bool _t17 = false; - return _t17; - } - } - if (!v__checker__Checker_check_basic(c, got, expected)) { - bool _t18 = false; - return _t18; - } - if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { - if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { - bool _t19 = true; - return _t19; - } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { bool _t20 = true; return _t20; - } - if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { + } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { bool _t21 = false; return _t21; } } - if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { + if (!v__checker__Checker_check_basic(c, got, expected)) { bool _t22 = false; return _t22; } - bool _t23 = true; - return _t23; + if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { + if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { + bool _t23 = true; + return _t23; + } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { + bool _t24 = true; + return _t24; + } + if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { + bool _t25 = false; + return _t25; + } + } + if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { + bool _t26 = false; + return _t26; + } + bool _t27 = true; + return _t27; } Option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg) { @@ -50547,20 +50650,25 @@ Option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, return (Option_void){0}; } } - if (v__checker__Checker_check_types(c, got, expected)) { - if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { - return (Option_void){0}; - } - } v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); string got_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); string expected_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); - if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { - if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { - return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + if (v__checker__Checker_check_types(c, got, expected)) { + if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { + return (Option_void){0}; } - return (Option_void){0}; + } else { + if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { + if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { + return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + return (Option_void){0}; + } + if (v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { + return (Option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(arg.expr)}}, {_SLIT("` (no value) used as value"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } if (!v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -50839,10 +50947,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_16973 = type_hi; - v__ast__Type _var_16982 = type_lo; - type_hi = _var_16982; - type_lo = _var_16973; + v__ast__Type _var_17710 = type_hi; + v__ast__Type _var_17719 = type_lo; + type_hi = _var_17719; + type_lo = _var_17710; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -51052,7 +51160,9 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { - to_set = arg_elem_info.elem_type; + if (string__eq(param_elem_sym->name, gt_name)) { + typ = arg_elem_info.elem_type; + } break; } } @@ -51068,7 +51178,9 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { - to_set = arg_elem_info.elem_type; + if (string__eq(param_elem_sym->name, gt_name)) { + typ = arg_elem_info.elem_type; + } break; } } @@ -51081,6 +51193,20 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param_map_info.value_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_map_info.value_type)->name, gt_name)) { typ = arg_map_info.value_type; } + } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.FnType */ ).func; + if (param_type_func.params.len == arg_type_func.params.len) { + for (int n = 0; n < param_type_func.params.len; ++n) { + v__ast__Param fn_param = ((v__ast__Param*)param_type_func.params.data)[n]; + if (v__ast__Type_has_flag(fn_param.typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, fn_param.typ)->name, gt_name)) { + typ = (*(v__ast__Param*)/*ee elem_sym */array_get(arg_type_func.params, n)).typ; + } + } + if (v__ast__Type_has_flag(param_type_func.return_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_type_func.return_type)->name, gt_name)) { + typ = arg_type_func.return_type; + } + } } else if (arg_sym->kind == v__ast__Kind__struct_ || arg_sym->kind == v__ast__Kind__interface_ || arg_sym->kind == v__ast__Kind__sum_type) { Array_v__ast__Type generic_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); @@ -51166,7 +51292,7 @@ v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Pref timers_should_print = true; } #endif - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); return _t1; } @@ -51192,7 +51318,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_fil c->expr_level = 0; c->stmt_level = 0; c->inside_sql = false; - c->cur_orm_ts = ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + c->cur_orm_ts = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = 0,.language = 0,.is_pub = 0,}); c->prevent_sum_type_unwrapping_once = false; c->loop_label = _SLIT(""); c->using_new_err_struct = false; @@ -51327,9 +51453,35 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ if (c->pref->is_script && !c->pref->is_test) { v__ast__File* the_main_file = (*(v__ast__File**)array_last(files_from_main_module)); array_push((array*)&the_main_file->stmts, _MOV((v__ast__Stmt[]){ v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = __new_array(0, 0, sizeof(string)), .name = _SLIT("main.main"), .short_name = (string){.str=(byteptr)"", .is_lit=1}, .mod = _SLIT("main"), + .file = the_main_file->path, + .source_file = 0, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = 0, @@ -51343,40 +51495,14 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = the_main_file->path, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .label_names = __new_array(0, 0, sizeof(string)), - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, })))) })); has_main_fn = true; } @@ -51651,8 +51777,8 @@ Array_v__ast__InterfaceEmbedding v__checker__Checker_expand_iface_embeds(v__chec Array_v__ast__InterfaceEmbedding list = iface_decl.embeds; if (!iface_decl.are_embeds_expanded) { list = v__checker__Checker_expand_iface_embeds(c, idecl, level + 1, iface_decl.embeds); - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).embeds = list; - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).are_embeds_expanded = true; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).embeds = list; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).are_embeds_expanded = true; } for (int _t6 = 0; _t6 < list.len; ++_t6) { v__ast__InterfaceEmbedding partial = ((v__ast__InterfaceEmbedding*)list.data)[_t6]; @@ -51789,9 +51915,11 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative value cannot be compared with `"), /*115 &string*/0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node->left._v__ast__IntegerLiteral).pos); } } else if (is_left_type_signed != is_right_type_signed && left_type != _const_v__ast__int_literal_type_idx && right_type != _const_v__ast__int_literal_type_idx) { - int ls = v__ast__Table_type_size(c->table, left_type); - int rs = v__ast__Table_type_size(c->table, right_type); - if ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls)) { + multi_return_int_int mr_23224 = v__ast__Table_type_size(c->table, left_type); + int ls = mr_23224.arg0; + multi_return_int_int mr_23267 = v__ast__Table_type_size(c->table, right_type); + int rs = mr_23267.arg0; + if (!c->pref->translated && ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls))) { string lt = v__ast__Table_sym(c->table, left_type)->name; string rt = v__ast__Table_sym(c->table, right_type)->name; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = lt}}, {_SLIT("` cannot be compared with `"), /*115 &string*/0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); @@ -52063,8 +52191,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, _SLIT("array append cannot be used in an expression"), node->pos); } v__checker__Checker_check_expr_opt_call(c, node->right, right_type); - multi_return_string_v__token__Pos mr_33942 = v__checker__Checker_fail_if_immutable(c, node->left); - node->auto_locked = mr_33942.arg0; + multi_return_string_v__token__Pos mr_33986 = v__checker__Checker_fail_if_immutable(c, node->left); + node->auto_locked = mr_33986.arg0; v__ast__Type left_value_type = v__ast__Table_value_type(c->table, v__checker__Checker_unwrap_generic(c, left_type)); v__ast__TypeSymbol* left_value_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, left_value_type)); if (left_value_sym->kind == v__ast__Kind__interface_) { @@ -52177,19 +52305,19 @@ v__ast__Type former_expected_type; return _t18; } *node = ((v__ast__InfixExpr){ - .op = v__token__Kind__right_shift, - .pos = node->pos, - .is_stmt = false, - .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = modified_left_type,.expr = node->left,.typname = v__ast__Table_type_str(c->table, modified_left_type),.expr_type = 0,.has_arg = 0,.pos = node->pos,})))), + .or_block = node->or_block, + .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = node->left,.typname = v__ast__Table_type_str(c->table, modified_left_type),.pos = node->pos,.typ = modified_left_type,.expr_type = 0,.has_arg = 0,})))), .right = node->right, + .auto_locked = node->auto_locked, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = node->pos, .left_type = left_type, .right_type = right_type, - .auto_locked = node->auto_locked, - .or_block = node->or_block, + .op = v__token__Kind__right_shift, + .is_stmt = false, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), }); v__ast__Type _t19 = v__checker__Checker_check_shift(c, node, left_type, right_type); // Defer begin @@ -52472,7 +52600,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } } } else if (((*expr._v__ast__Ident).obj)._typ == 323 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { - if (!c->inside_unsafe) { + if (!c->inside_unsafe && !c->pref->translated) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot modify constant `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*expr._v__ast__Ident).pos); } } @@ -52500,19 +52628,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_44340 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_44340.arg0; - pos = mr_44340.arg1; + multi_return_string_v__token__Pos mr_44503 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_44503.arg0; + pos = mr_44503.arg1; } else if (expr._typ == 282 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_44409 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_44409.arg0; - pos = mr_44409.arg1; + multi_return_string_v__token__Pos mr_44572 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_44572.arg0; + pos = mr_44572.arg1; } else if (expr._typ == 284 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_44481 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_44481.arg0; - pos = mr_44481.arg1; + multi_return_string_v__token__Pos mr_44644 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_44644.arg0; + pos = mr_44644.arg1; } else if (expr._typ == 287 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -52534,7 +52662,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (_t6.state != 0) { /*or block*/ IError err = _t6.err; has_field = false; - *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); } v__ast__StructField field_info = (*(v__ast__StructField*)_t6.data); @@ -52562,9 +52690,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_45945 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_45945.arg0; - pos = mr_45945.arg1; + multi_return_string_v__token__Pos mr_46108 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_46108.arg0; + pos = mr_46108.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -52670,9 +52798,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 253 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_47768 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_47768.arg0; - pos = mr_47768.arg1; + multi_return_string_v__token__Pos mr_47931 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_47931.arg0; + pos = mr_47931.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -53059,7 +53187,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; - v__ast__StructField field = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 417 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; @@ -53087,12 +53215,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_61862 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_61862.arg0; - embed_types = mr_61862.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_62025 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_62025.arg0; + embed_types = mr_62025.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); @@ -53123,12 +53251,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_62693 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_62693.arg0; - embed_types = mr_62693.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_62856 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_62856.arg0; + embed_types = mr_62856.arg1; node->from_embed_types = embed_types; } } @@ -53365,7 +53493,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__ast__Ident id = ident; if ((id.info)._typ == 377 /* v.ast.IdentVar */) { if (id.comptime && Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, id.name)) { - (*(v__ast__Ident*)/*ee elem_sym */array_get((*node._v__ast__DeferStmt).defer_vars, i)) = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT(""),.kind = 0,.info = {0},.is_mut = 0,}); + (*(v__ast__Ident*)/*ee elem_sym */array_get((*node._v__ast__DeferStmt).defer_vars, i)) = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT(""),.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); continue; } v__ast__Type typ = v__checker__Checker_ident(c, (voidptr)&/*qq*/id); @@ -53611,18 +53739,18 @@ VV_LOCAL_SYMBOL Array_string v__checker__Checker_asm_ios(v__checker__Checker* c, array_push((array*)&aliases, _MOV((string[]){ string_clone(io.alias) })); if (_IN_MAP(ADDR(string, io.alias), ADDR(map, scope->objects))) { map_set(&scope->objects, &(string[]){io.alias}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = io.alias, + .expr = io.expr, + .pos = io.pos, + .typ = typ, + .orig_type = typ, .share = 0, .is_mut = 0, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = 0, .is_inherited = 0, - .expr = io.expr, - .typ = typ, - .orig_type = typ, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = io.pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -54146,7 +54274,7 @@ bool v__checker__Checker_expr_defer_0 = false; return _t19; } else if (node._typ == 259 /* v.ast.ComptimeSelector */) { - (*node._v__ast__ComptimeSelector).left_type = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).left)); + (*node._v__ast__ComptimeSelector).left_type = v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).left); v__ast__Type expr_type = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).field_expr)); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, expr_type); if (!v__ast__Type_alias_eq(expr_type, _const_v__ast__string_type)) { @@ -54903,7 +55031,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; if (obj._typ == 324 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; return _t7; @@ -54951,7 +55079,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } bool is_optional = v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional); node->kind = v__ast__IdentKind__variable; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = is_optional,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = is_optional,})))); if (!is_sum_type_cast) { (*obj._v__ast__Var).typ = typ; } @@ -54997,7 +55125,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } node->name = name; node->kind = v__ast__IdentKind__constant; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); (*obj._v__ast__ConstField).typ = typ; node->obj = obj; v__ast__Type _t13 = typ; @@ -55120,11 +55248,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as if (!is_mut || (*expr._v__ast__SelectorExpr).is_mut) { array_push((array*)&smartcasts, _MOV((v__ast__Type[]){ to_type })); v__ast__Scope_register_struct_field(scope, v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr), ((v__ast__ScopeStructField){ - .struct_type = (*expr._v__ast__SelectorExpr).expr_type, + .smartcasts = smartcasts, .name = (*expr._v__ast__SelectorExpr).field_name, .pos = (*expr._v__ast__SelectorExpr).pos, + .struct_type = (*expr._v__ast__SelectorExpr).expr_type, .typ = cur_type, - .smartcasts = smartcasts, .orig_type = orig_type, })); } else { @@ -55147,18 +55275,18 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as if ((!is_mut || (*expr._v__ast__Ident).is_mut) && !is_already_casted) { array_push((array*)&smartcasts, _MOV((v__ast__Type[]){ to_type })); v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = smartcasts, .name = (*expr._v__ast__Ident).name, + .expr = {0}, + .pos = (*expr._v__ast__Ident).pos, + .typ = cur_type, + .orig_type = orig_type, .share = 0, .is_mut = (*expr._v__ast__Ident).is_mut, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = 0, .is_inherited = 0, - .expr = {0}, - .typ = cur_type, - .orig_type = orig_type, - .smartcasts = smartcasts, - .pos = (*expr._v__ast__Ident).pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -55363,8 +55491,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_117098 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_117098.arg0; + multi_return_string_v__token__Pos mr_117243 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_117243.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -55454,6 +55582,12 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre if ((*node->right._v__ast__PrefixExpr).op == v__token__Kind__amp) { v__checker__Checker_error(c, _SLIT("unexpected `&`, expecting expression"), (*node->right._v__ast__PrefixExpr).pos); } + } else if ((node->right)._typ == 287 /* v.ast.SelectorExpr */) { + v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); + v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 417) /*expected idx: 417, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.Enum */ ).uses_exprs))) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take address of field in struct `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, (*node->right._v__ast__SelectorExpr).expr_type)}}, {_SLIT("`, which is tagged as `[minify]`"), 0, { .d_c = 0 }}})), v__token__Pos_extend(node->pos, (*node->right._v__ast__SelectorExpr).pos)); + } } } if (node->op == v__token__Kind__amp && !v__ast__Type_is_ptr(right_type)) { @@ -55892,7 +56026,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_warn_or_error(v__checker__Checker* c, s return; } if (!Array_int_contains(c->error_lines, pos.line_nr)) { - v__errors__Error err = ((v__errors__Error){.message = message,.details = details,.file_path = c->file->path,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__checker,}); + v__errors__Error err = ((v__errors__Error){.message = message,.details = details,.file_path = c->file->path,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__checker,}); array_push((array*)&c->file->errors, _MOV((v__errors__Error[]){ err })); array_push((array*)&c->errors, _MOV((v__errors__Error[]){ err })); array_push((array*)&c->error_lines, _MOV((int[]){ pos.line_nr })); @@ -56145,7 +56279,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -56243,8 +56377,10 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp return _t2; } else if (expr._typ == 288 /* v.ast.SizeOf */) { + multi_return_int_int mr_3715 = v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ); + int s = mr_3715.arg0; Option_v__ast__ComptTimeConstValue _t3; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ)))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(&s) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); return _t3; } else if (expr._typ == 265 /* v.ast.FloatLiteral */) { @@ -57429,10 +57565,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Chec for (int _t2 = 0; _t2 < sym_app->methods.len; ++_t2) { v__ast__Fn m = ((v__ast__Fn*)sym_app->methods.data)[_t2]; if (m.return_type == typ_vweb_result) { - multi_return_bool_int_int mr_9819 = v__checker__Checker_verify_vweb_params_for_method(c, m); - bool is_ok = mr_9819.arg0; - int nroute_attributes = mr_9819.arg1; - int nargs = mr_9819.arg2; + multi_return_bool_int_int mr_9832 = v__checker__Checker_verify_vweb_params_for_method(c, m); + bool is_ok = mr_9832.arg0; + int nroute_attributes = mr_9832.arg1; + int nargs = mr_9832.arg2; if (!is_ok) { v__ast__FnDecl* f = ((v__ast__FnDecl*)(m.source_fn)); if (isnil(f)) { @@ -57483,34 +57619,35 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ } } c->inside_ct_attr = true; - node->ct_skip = v__checker__Checker_comptime_if_branch(c, node->ct_expr, node->pos); + node->ct_skip = (v__checker__Checker_comptime_if_branch(c, node->ct_expr, node->pos) == v__checker__ComptimeBranchSkipState__skip ? (true) : (false)); c->inside_ct_attr = false; node->ct_evaled = true; bool _t5 = node->ct_skip; return _t5; } -VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos) { +VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos) { if (cond._typ == 251 /* v.ast.BoolLiteral */) { - bool _t1 = !(*cond._v__ast__BoolLiteral).val; + v__checker__ComptimeBranchSkipState _t1 = ((*cond._v__ast__BoolLiteral).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t1; } else if (cond._typ == 282 /* v.ast.ParExpr */) { - bool _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); + v__checker__ComptimeBranchSkipState _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); return _t2; } else if (cond._typ == 284 /* v.ast.PrefixExpr */) { if ((*cond._v__ast__PrefixExpr).op != v__token__Kind__not) { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__PrefixExpr).pos); } - bool _t3 = !v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__PrefixExpr).right, (*cond._v__ast__PrefixExpr).pos); + v__checker__ComptimeBranchSkipState reversed = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__PrefixExpr).right, (*cond._v__ast__PrefixExpr).pos); + v__checker__ComptimeBranchSkipState _t3 = (reversed == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__skip) : reversed == v__checker__ComptimeBranchSkipState__skip ? (v__checker__ComptimeBranchSkipState__eval) : (reversed)); return _t3; } else if (cond._typ == 283 /* v.ast.PostfixExpr */) { if ((*cond._v__ast__PostfixExpr).op != v__token__Kind__question) { v__checker__Checker_error(c, _SLIT("invalid $if postfix operator"), (*cond._v__ast__PostfixExpr).pos); } else if (((*cond._v__ast__PostfixExpr).expr)._typ == 267 /* v.ast.Ident */) { - bool _t4 = !Array_string_contains(c->pref->compile_defines_all, (*(*cond._v__ast__PostfixExpr).expr._v__ast__Ident).name); + v__checker__ComptimeBranchSkipState _t4 = (Array_string_contains(c->pref->compile_defines_all, (*(*cond._v__ast__PostfixExpr).expr._v__ast__Ident).name) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t4; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__PostfixExpr).pos); @@ -57519,16 +57656,24 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* else if (cond._typ == 271 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and)) { - bool l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); - bool r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); - bool _t5 = l || r; - return _t5; + v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); + v__checker__ComptimeBranchSkipState r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); + if (l == v__checker__ComptimeBranchSkipState__unknown || r == v__checker__ComptimeBranchSkipState__unknown) { + v__checker__ComptimeBranchSkipState _t5 = v__checker__ComptimeBranchSkipState__unknown; + return _t5; + } + v__checker__ComptimeBranchSkipState _t6 = (l == v__checker__ComptimeBranchSkipState__eval && r == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t6; } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__logical_or)) { - bool l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); - bool r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); - bool _t6 = l && r; - return _t6; + v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); + v__checker__ComptimeBranchSkipState r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); + if (l == v__checker__ComptimeBranchSkipState__unknown || r == v__checker__ComptimeBranchSkipState__unknown) { + v__checker__ComptimeBranchSkipState _t7 = v__checker__ComptimeBranchSkipState__unknown; + return _t7; + } + v__checker__ComptimeBranchSkipState _t8 = (l == v__checker__ComptimeBranchSkipState__eval || r == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t8; } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__key_is) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__not_is)) { if (((*cond._v__ast__InfixExpr).left)._typ == 293 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 293 /* v.ast.TypeNode */) { @@ -57536,17 +57681,17 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* if (sym->kind != v__ast__Kind__interface_) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); } - bool _t7 = false; - return _t7; + v__checker__ComptimeBranchSkipState _t9 = v__checker__ComptimeBranchSkipState__unknown; + return _t9; } else if (((*cond._v__ast__InfixExpr).left)._typ == 293 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 260 /* v.ast.ComptimeType */) { v__ast__TypeNode left = /* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).left)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).left)._typ, 293) /*expected idx: 293, name: v.ast.TypeNode */ ; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, left.typ); - bool _t8 = v__ast__Table_is_comptime_type(c->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)); - return _t8; + v__checker__ComptimeBranchSkipState _t10 = (v__ast__Table_is_comptime_type(c->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t10; } else if (((*cond._v__ast__InfixExpr).left)._typ == 287 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 293 /* v.ast.TypeNode */) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); - bool _t9 = false; - return _t9; + v__checker__ComptimeBranchSkipState _t11 = v__checker__ComptimeBranchSkipState__unknown; + return _t11; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition: expected a type or a selector expression or an interface check"), v__ast__Expr_pos((*cond._v__ast__InfixExpr).left)); } @@ -57556,23 +57701,23 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* } else if (((*cond._v__ast__InfixExpr).left)._typ == 267 /* v.ast.Ident */) { v__ast__Type left_type = v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); v__ast__Type right_type = v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).right); - Option_v__ast__Expr _t10 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); - if (_t10.state != 0) { /*or block*/ - IError err = _t10.err; + Option_v__ast__Expr _t12 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); + if (_t12.state != 0) { /*or block*/ + IError err = _t12.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*(*cond._v__ast__InfixExpr).left._v__ast__Ident).pos); - bool _t11 = false; - return _t11; + v__checker__ComptimeBranchSkipState _t13 = v__checker__ComptimeBranchSkipState__unknown; + return _t13; } - v__ast__Expr expr = (*(v__ast__Expr*)_t10.data); + v__ast__Expr expr = (*(v__ast__Expr*)_t12.data); if (!v__checker__Checker_check_types(c, right_type, left_type)) { string left_name = v__ast__Table_type_to_str(c->table, left_type); string right_name = v__ast__Table_type_to_str(c->table, right_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*cond._v__ast__InfixExpr).pos); } bool different = !string__eq(v__ast__Expr_str(expr), v__ast__Expr_str((*cond._v__ast__InfixExpr).right)); - bool _t12 = ((*cond._v__ast__InfixExpr).op == v__token__Kind__eq ? (different) : (!different)); - return _t12; + v__checker__ComptimeBranchSkipState _t14 = ((*cond._v__ast__InfixExpr).op == v__token__Kind__eq ? ((different ? (v__checker__ComptimeBranchSkipState__skip) : (v__checker__ComptimeBranchSkipState__eval))) : ((different ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)))); + return _t14; } else { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid `$if` condition: "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( ((*cond._v__ast__InfixExpr).left)._typ ))}}, {_SLIT("1"), 0, { .d_c = 0 }}})), (*cond._v__ast__InfixExpr).pos); } @@ -57584,168 +57729,175 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* else if (cond._typ == 267 /* v.ast.Ident */) { string cname = (*cond._v__ast__Ident).name; if (Array_string_contains(_const_v__checker__valid_comptime_if_os, cname)) { - bool is_os_target_different = false; + bool is_os_target_equal = true; if (!c->pref->output_cross_c) { string target_os = string_to_lower(v__pref__OS_str(c->pref->os)); - is_os_target_different = !string__eq(cname, target_os); + is_os_target_equal = string__eq(cname, target_os); } - bool _t13 = is_os_target_different; - return _t13; + v__checker__ComptimeBranchSkipState _t15 = (is_os_target_equal ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t15; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_compilers, cname)) { - bool _t14 = v__pref__cc_from_string(cname) != c->pref->ccompiler_type; - return _t14; + v__checker__ComptimeBranchSkipState _t16 = (v__pref__cc_from_string(cname) == c->pref->ccompiler_type ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t16; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_platforms, cname)) { if (string__eq(cname, _SLIT("aarch64"))) { v__checker__Checker_note(c, _SLIT("use `arm64` instead of `aarch64`"), pos); } if (string__eq(cname, _SLIT("amd64"))) { - bool _t15 = c->pref->arch != v__pref__Arch__amd64; - return _t15; - } - else if (string__eq(cname, _SLIT("i386"))) { - bool _t16 = c->pref->arch != v__pref__Arch__i386; - return _t16; - } - else if (string__eq(cname, _SLIT("aarch64"))) { - bool _t17 = c->pref->arch != v__pref__Arch__arm64; + v__checker__ComptimeBranchSkipState _t17 = (c->pref->arch == v__pref__Arch__amd64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t17; } - else if (string__eq(cname, _SLIT("arm64"))) { - bool _t18 = c->pref->arch != v__pref__Arch__arm64; + else if (string__eq(cname, _SLIT("i386"))) { + v__checker__ComptimeBranchSkipState _t18 = (c->pref->arch == v__pref__Arch__i386 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t18; } - else if (string__eq(cname, _SLIT("arm32"))) { - bool _t19 = c->pref->arch != v__pref__Arch__arm32; + else if (string__eq(cname, _SLIT("aarch64"))) { + v__checker__ComptimeBranchSkipState _t19 = (c->pref->arch == v__pref__Arch__arm64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t19; } - else if (string__eq(cname, _SLIT("rv64"))) { - bool _t20 = c->pref->arch != v__pref__Arch__rv64; + else if (string__eq(cname, _SLIT("arm64"))) { + v__checker__ComptimeBranchSkipState _t20 = (c->pref->arch == v__pref__Arch__arm64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t20; } - else if (string__eq(cname, _SLIT("rv32"))) { - bool _t21 = c->pref->arch != v__pref__Arch__rv32; + else if (string__eq(cname, _SLIT("arm32"))) { + v__checker__ComptimeBranchSkipState _t21 = (c->pref->arch == v__pref__Arch__arm32 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t21; } - else { - bool _t22 = false; + else if (string__eq(cname, _SLIT("rv64"))) { + v__checker__ComptimeBranchSkipState _t22 = (c->pref->arch == v__pref__Arch__rv64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t22; + } + else if (string__eq(cname, _SLIT("rv32"))) { + v__checker__ComptimeBranchSkipState _t23 = (c->pref->arch == v__pref__Arch__rv32 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t23; + } + else { + v__checker__ComptimeBranchSkipState _t24 = v__checker__ComptimeBranchSkipState__unknown; + return _t24; }; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_cpu_features, cname)) { - bool _t23 = false; - return _t23; + v__checker__ComptimeBranchSkipState _t25 = v__checker__ComptimeBranchSkipState__unknown; + return _t25; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_other, cname)) { if (string__eq(cname, _SLIT("apk"))) { - bool _t24 = !c->pref->is_apk; - return _t24; - } - else if (string__eq(cname, _SLIT("js"))) { - bool _t25 = !v__pref__Backend_is_js(c->pref->backend); - return _t25; - } - else if (string__eq(cname, _SLIT("debug"))) { - bool _t26 = !c->pref->is_debug; + v__checker__ComptimeBranchSkipState _t26 = (c->pref->is_apk ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t26; } - else if (string__eq(cname, _SLIT("prod"))) { - bool _t27 = !c->pref->is_prod; + else if (string__eq(cname, _SLIT("js"))) { + v__checker__ComptimeBranchSkipState _t27 = (v__pref__Backend_is_js(c->pref->backend) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t27; } - else if (string__eq(cname, _SLIT("profile"))) { - bool _t28 = !c->pref->is_prof; + else if (string__eq(cname, _SLIT("debug"))) { + v__checker__ComptimeBranchSkipState _t28 = (c->pref->is_debug ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t28; } - else if (string__eq(cname, _SLIT("test"))) { - bool _t29 = !c->pref->is_test; + else if (string__eq(cname, _SLIT("prod"))) { + v__checker__ComptimeBranchSkipState _t29 = (c->pref->is_prod ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t29; } - else if (string__eq(cname, _SLIT("glibc"))) { - bool _t30 = false; + else if (string__eq(cname, _SLIT("profile"))) { + v__checker__ComptimeBranchSkipState _t30 = (c->pref->is_prof ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t30; } - else if (string__eq(cname, _SLIT("threads"))) { - bool _t31 = c->table->gostmts == 0; + else if (string__eq(cname, _SLIT("test"))) { + v__checker__ComptimeBranchSkipState _t31 = (c->pref->is_test ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t31; } - else if (string__eq(cname, _SLIT("prealloc"))) { - bool _t32 = !c->pref->prealloc; + else if (string__eq(cname, _SLIT("musl"))) { + v__checker__ComptimeBranchSkipState _t32 = v__checker__ComptimeBranchSkipState__unknown; return _t32; } - else if (string__eq(cname, _SLIT("no_bounds_checking"))) { - bool _t33 = !Array_string_contains(c->pref->compile_defines_all, cname); + else if (string__eq(cname, _SLIT("glibc"))) { + v__checker__ComptimeBranchSkipState _t33 = v__checker__ComptimeBranchSkipState__unknown; return _t33; } - else if (string__eq(cname, _SLIT("freestanding"))) { - bool _t34 = !c->pref->is_bare || c->pref->output_cross_c; + else if (string__eq(cname, _SLIT("threads"))) { + v__checker__ComptimeBranchSkipState _t34 = (c->table->gostmts > 0 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t34; } + else if (string__eq(cname, _SLIT("prealloc"))) { + v__checker__ComptimeBranchSkipState _t35 = (c->pref->prealloc ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t35; + } + else if (string__eq(cname, _SLIT("no_bounds_checking"))) { + v__checker__ComptimeBranchSkipState _t36 = (Array_string_contains(c->pref->compile_defines_all, cname) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t36; + } + else if (string__eq(cname, _SLIT("freestanding"))) { + v__checker__ComptimeBranchSkipState _t37 = (c->pref->is_bare && !c->pref->output_cross_c ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t37; + } else if (string__eq(cname, _SLIT("interpreter"))) { - c->pref->backend != v__pref__Backend__interpret; + v__checker__ComptimeBranchSkipState _t38 = (c->pref->backend == v__pref__Backend__interpret ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t38; } else { - bool _t35 = false; - return _t35; + v__checker__ComptimeBranchSkipState _t39 = v__checker__ComptimeBranchSkipState__unknown; + return _t39; }; } else if (!Array_string_contains(c->pref->compile_defines_all, cname)) { if (string__eq(cname, _SLIT("linux_or_macos"))) { v__checker__Checker_error(c, _SLIT("linux_or_macos is deprecated, use `$if linux || macos {` instead"), (*cond._v__ast__Ident).pos); - bool _t36 = false; - return _t36; + v__checker__ComptimeBranchSkipState _t40 = v__checker__ComptimeBranchSkipState__unknown; + return _t40; } v__ast__Type typ = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, cond)); if (((*cond._v__ast__Ident).obj)._typ != 325 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 323 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 324 /* v.ast.GlobalField */) { if (!c->inside_ct_attr) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown var: `"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - bool _t37 = false; - return _t37; + v__checker__ComptimeBranchSkipState _t41 = v__checker__ComptimeBranchSkipState__unknown; + return _t41; } - Option_v__ast__Expr _t38 = v__checker__Checker_find_obj_definition(c, (*cond._v__ast__Ident).obj); - if (_t38.state != 0) { /*or block*/ - IError err = _t38.err; + Option_v__ast__Expr _t42 = v__checker__Checker_find_obj_definition(c, (*cond._v__ast__Ident).obj); + if (_t42.state != 0) { /*or block*/ + IError err = _t42.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*cond._v__ast__Ident).pos); - bool _t39 = false; - return _t39; + v__checker__ComptimeBranchSkipState _t43 = v__checker__ComptimeBranchSkipState__unknown; + return _t43; } - v__ast__Expr expr = (*(v__ast__Expr*)_t38.data); + v__ast__Expr expr = (*(v__ast__Expr*)_t42.data); if (!v__checker__Checker_check_types(c, typ, _const_v__ast__bool_type)) { string type_name = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-bool type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` used as $if condition"), 0, { .d_c = 0 }}})), (*cond._v__ast__Ident).pos); } - bool _t40 = !(/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 251) /*expected idx: 251, name: v.ast.BoolLiteral */ ).val; - return _t40; + v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 251) /*expected idx: 251, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t44; } } else if (cond._typ == 258 /* v.ast.ComptimeCall */) { if ((*cond._v__ast__ComptimeCall).is_pkgconfig) { - Option_v__pkgconfig__Main_ptr _t41 = v__pkgconfig__main(new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){string_clone((*cond._v__ast__ComptimeCall).args_var)}))); - if (_t41.state != 0) { /*or block*/ - IError err = _t41.err; + Option_v__pkgconfig__Main_ptr _t45 = v__pkgconfig__main(new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){string_clone((*cond._v__ast__ComptimeCall).args_var)}))); + if (_t45.state != 0) { /*or block*/ + IError err = _t45.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*cond._v__ast__ComptimeCall).pos); - bool _t42 = true; - return _t42; + v__checker__ComptimeBranchSkipState _t46 = v__checker__ComptimeBranchSkipState__skip; + return _t46; } - v__pkgconfig__Main* m = (*(v__pkgconfig__Main**)_t41.data); - Option_string _t43 = v__pkgconfig__Main_run(m); - if (_t43.state != 0) { /*or block*/ - IError err = _t43.err; - bool _t44 = true; - return _t44; + v__pkgconfig__Main* m = (*(v__pkgconfig__Main**)_t45.data); + Option_string _t47 = v__pkgconfig__Main_run(m); + if (_t47.state != 0) { /*or block*/ + IError err = _t47.err; + v__checker__ComptimeBranchSkipState _t48 = v__checker__ComptimeBranchSkipState__skip; + return _t48; } - (*(string*)_t43.data); + (*(string*)_t47.data); } + v__checker__ComptimeBranchSkipState _t49 = v__checker__ComptimeBranchSkipState__eval; + return _t49; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), pos); } ; - bool _t45 = false; - return _t45; + v__checker__ComptimeBranchSkipState _t50 = v__checker__ComptimeBranchSkipState__unknown; + return _t50; } v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__ArrayInit* node) { @@ -57979,7 +58131,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } VV_LOCAL_SYMBOL void v__checker__Checker_check_array_init_para_type(v__checker__Checker* c, string para, v__ast__Expr expr, v__token__Pos pos) { - v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_expr(c, expr)); + v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, expr))); if (!(sym->kind == v__ast__Kind__int || sym->kind == v__ast__Kind__int_literal)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("array "), /*115 &string*/0xfe10, {.d_s = para}}, {_SLIT(" needs to be an int"), 0, { .d_c = 0 }}})), pos); } @@ -58635,7 +58787,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 == 245 /* v.ast.AnonFn */) { @@ -58655,7 +58807,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 == 270 /* v.ast.IndexExpr */) { @@ -58714,15 +58866,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Fn f = *(v__ast__Fn*)_t16.data; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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; } } @@ -58738,7 +58890,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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) { @@ -59271,7 +59423,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t19 = _const_v__ast__void_type; return _t19; } - v__ast__Fn method = ((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 _t20; @@ -59311,7 +59463,7 @@ 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*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__Fn_Array_v__ast__Type mr_42797 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); @@ -59796,7 +59948,7 @@ Option_void v__checker__Checker_check_expected_arg_count(v__checker__Checker* c, } bool is_params =_t1.len > 0; if (is_params) { - array_push((array*)&node->args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.is_mut = 0,.share = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.typ_str = (string){.str=(byteptr)"", .is_lit=1},.typ = last_typ,.update_expr = {0},.update_expr_type = 0,.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_update_embed = 0,.has_update_expr = 0,.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),})))),.typ = 0,.is_tmp_autofree = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}) })); + array_push((array*)&node->args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = (string){.str=(byteptr)"", .is_lit=1},.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = last_typ,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.share = 0,.is_mut = 0,.is_tmp_autofree = 0,}) })); return (Option_void){0}; } } @@ -59873,6 +60025,16 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, `"), /*115 &string*/0xfe10, {.d_s = (*arg_expr._v__ast__CallExpr).name}}, {_SLIT("` must return a bool"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__CallExpr).pos); } } + else if (arg_expr._typ == 291 /* v.ast.StringLiteral */) { + if (!is_map) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, should use e.g. `"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("(it > 2)`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__StringLiteral).pos); + } + } + else if (arg_expr._typ == 290 /* v.ast.StringInterLiteral */) { + if (!is_map) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, should use e.g. `"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("(it > 2)`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__StringInterLiteral).pos); + } + } else { } @@ -60070,12 +60232,12 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch } VV_LOCAL_SYMBOL void v__checker__scope_register_it(v__ast__Scope* s, v__token__Pos pos, v__ast__Type typ) { - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = typ,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = pos,.typ = typ,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__checker__scope_register_a_b(v__ast__Scope* s, v__token__Pos pos, v__ast__Type typ) { - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("a"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Type_ref(typ),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("b"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Type_ref(typ),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("a"),.expr = {0},.pos = pos,.typ = v__ast__Type_ref(typ),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("b"),.expr = {0},.pos = pos,.typ = v__ast__Type_ref(typ),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__ast__ForCStmt node) { @@ -60283,7 +60445,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; node->typ = _const_v__ast__void_type; int nbranches_with_return = 0; int nbranches_without_return = 0; - bool should_skip = false; + v__checker__ComptimeBranchSkipState skip_state = v__checker__ComptimeBranchSkipState__unknown; bool found_branch = false; bool is_comptime_type_is_expr = false; for (int i = 0; i < node->branches.len; ++i) { @@ -60293,8 +60455,8 @@ bool v__checker__Checker_if_expr_defer_0 = false; } if (!node->has_else || i < node->branches.len - 1) { if (node->is_comptime) { - should_skip = v__checker__Checker_comptime_if_branch(c, branch.cond, branch.pos); - (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)).pkg_exist = !should_skip; + skip_state = v__checker__Checker_comptime_if_branch(c, branch.cond, branch.pos); + (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)).pkg_exist = (skip_state == v__checker__ComptimeBranchSkipState__eval ? (true) : (false)); } else { c->expected_type = _const_v__ast__bool_type; v__ast__Type cond_typ = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, branch.cond)); @@ -60321,7 +60483,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; if (((*branch.cond._v__ast__InfixExpr).right)._typ == 260 /* v.ast.ComptimeType */ && (left)._typ == 293 /* v.ast.TypeNode */) { is_comptime_type_is_expr = true; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - should_skip = !v__ast__Table_is_comptime_type(c->table, checked_type, /* as */ *(v__ast__ComptimeType*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__ComptimeType,((*branch.cond._v__ast__InfixExpr).right)._typ, 260) /*expected idx: 260, name: v.ast.ComptimeType */ ); + skip_state = (v__ast__Table_is_comptime_type(c->table, checked_type, /* as */ *(v__ast__ComptimeType*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__ComptimeType,((*branch.cond._v__ast__InfixExpr).right)._typ, 260) /*expected idx: 260, name: v.ast.ComptimeType */ ) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } else { v__ast__Type got_type = v__checker__Checker_unwrap_generic(c, (/* as */ *(v__ast__TypeNode*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*branch.cond._v__ast__InfixExpr).right)._typ, 293) /*expected idx: 293, name: v.ast.TypeNode */ ).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got_type); @@ -60335,13 +60497,11 @@ bool v__checker__Checker_if_expr_defer_0 = false; } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 293 /* v.ast.TypeNode */ && (left)._typ == 293 /* v.ast.TypeNode */ && sym->kind == v__ast__Kind__interface_) { is_comptime_type_is_expr = true; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - should_skip = !v__ast__Table_does_type_implement_interface(c->table, checked_type, got_type); + skip_state = (v__ast__Table_does_type_implement_interface(c->table, checked_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } else if ((left)._typ == 293 /* v.ast.TypeNode */) { is_comptime_type_is_expr = true; v__ast__Type left_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - if (!v__ast__Type_alias_eq(left_type, got_type)) { - should_skip = true; - } + skip_state = (v__ast__Type_alias_eq(left_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } } } @@ -60349,10 +60509,10 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool cur_skip_flags = c->skip_flags; if (found_branch) { c->skip_flags = true; - } else if (should_skip) { + } else if (skip_state == v__checker__ComptimeBranchSkipState__skip) { c->skip_flags = true; - should_skip = false; - } else if (!is_comptime_type_is_expr) { + skip_state = v__checker__ComptimeBranchSkipState__unknown; + } else if (!is_comptime_type_is_expr && skip_state == v__checker__ComptimeBranchSkipState__eval) { found_branch = true; } if (c->fn_level == 0 && c->pref->output_cross_c) { @@ -60868,7 +61028,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch ; if (_t12.state != 0) { /*or block*/ IError err = _t12.err; - *(v__ast__Param*) _t12.data = ((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = 0,.typ = 0,}); + *(v__ast__Param*) _t12.data = ((v__ast__Param){.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,},.typ = 0,.is_mut = 0,.is_auto_rec = 0,.is_hidden = 0,}); } v__ast__Param param = *(v__ast__Param*)_t12.data; @@ -61216,7 +61376,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__ast__Type ti = it.typ; array_push((array*)&_t4, &ti); } - expr_type = v__ast__Table_register_sym(c->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Aggregate, (((v__ast__Aggregate){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sum_type = node->cond_type,.types =_t4,})))),.kind = v__ast__Kind__aggregate,.name = name,.cname = strings__Builder_str(&agg_cname),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = c->mod,.is_pub = 0,.language = 0,.idx = 0,})); + expr_type = v__ast__Table_register_sym(c->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Aggregate, (((v__ast__Aggregate){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sum_type = node->cond_type,.types =_t4,})))),.name = name,.cname = strings__Builder_str(&agg_cname),.mod = c->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__aggregate,.language = 0,.is_pub = 0,})); } } else { expr_type = (*(v__ast__TypeNode*)/*ee elem_sym */array_get(expr_types, 0)).typ; @@ -61354,45 +61514,45 @@ bool v__checker__Checker_sql_expr_defer_0 = false; v__checker__Checker_sql_expr(c, (voidptr)&/*qq*/n); c->inside_sql = tmp_inside_sql; n.where_expr = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = v__token__Kind__eq, - .pos = n.pos, - .is_stmt = 0, + .or_block = ((v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}), .left = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__v, - .tok_kind = v__token__Kind__eq, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = c->fn_scope, - .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = (string){.str=(byteptr)"", .is_lit=1},.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), + .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), .mod = _SLIT("main"), .name = _SLIT("id"), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = c->fn_scope, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = v__token__Kind__eq, + .language = v__ast__Language__v, .kind = v__ast__IdentKind__unresolved, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = false, })))), .right = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__c, - .tok_kind = v__token__Kind__eq, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = c->fn_scope, - .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = (string){.str=(byteptr)"", .is_lit=1},.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), + .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), .mod = _SLIT("main"), .name = (string){.str=(byteptr)"", .is_lit=1}, + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = _const_v__ast__int_type,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = c->fn_scope, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = v__token__Kind__eq, + .language = v__ast__Language__c, .kind = 0, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = _const_v__ast__int_type,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = false, })))), + .auto_locked = _SLIT(""), + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = n.pos, .left_type = _const_v__ast__int_type, .right_type = _const_v__ast__int_type, - .auto_locked = _SLIT(""), - .or_block = ((v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}), + .op = v__token__Kind__eq, + .is_stmt = 0, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), })))); (*(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; } @@ -62122,6 +62282,10 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } } + if ((*struct_sym->info._v__ast__Struct).is_minify) { + array_sort_with_compare(&node->fields, (voidptr)v__checker__minify_sort_fn); + array_sort_with_compare(&(*struct_sym->info._v__ast__Struct).fields, (voidptr)v__checker__minify_sort_fn); + } for (int _t2 = 0; _t2 < node->attrs.len; ++_t2) { v__ast__Attr attr = ((v__ast__Attr*)node->attrs.data)[_t2]; if (string__eq(attr.name, _SLIT("typedef")) && node->language != v__ast__Language__c) { @@ -62234,6 +62398,52 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } +VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b) { + if (v__ast__Type_alias_eq(a->typ, b->typ)) { + int _t1 = 0; + return _t1; + } + if (a->typ == _const_v__ast__bool_type_idx) { + if (b->typ == _const_v__ast__bool_type_idx) { + int _t2 = 0; + return _t2; + } + int _t3 = 1; + return _t3; + } else if (b->typ == _const_v__ast__bool_type_idx) { + int _t4 = -1; + return _t4; + } + v__ast__Table* t = global_table; + v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); + v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); + if ((a_sym->info)._typ == 446 /* v.ast.Enum */) { + if (!(*a_sym->info._v__ast__Enum).is_flag && !(*a_sym->info._v__ast__Enum).uses_exprs) { + if (b_sym->kind == v__ast__Kind__enum_) { + int a_nr_vals = ((*a_sym->info._v__ast__Enum)).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.Enum */ ).vals.len; + int _t5 = (a_nr_vals > b_nr_vals ? (-1) : a_nr_vals < b_nr_vals ? (1) : (0)); + return _t5; + } + int _t6 = 1; + return _t6; + } + } else if ((b_sym->info)._typ == 446 /* v.ast.Enum */) { + if (!(*b_sym->info._v__ast__Enum).is_flag && !(*b_sym->info._v__ast__Enum).uses_exprs) { + int _t7 = -1; + return _t7; + } + } + multi_return_int_int mr_5357 = v__ast__Table_type_size(t, a->typ); + int a_size = mr_5357.arg0; + int a_align = mr_5357.arg1; + multi_return_int_int mr_5396 = v__ast__Table_type_size(t, b->typ); + int b_size = mr_5396.arg0; + int b_align = mr_5396.arg1; + int _t8 = (a_align > b_align ? (-1) : a_align < b_align ? (1) : a_size > b_size ? (-1) : a_size < b_size ? (1) : (0)); + return _t8; +} + v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node) { if (v__ast__Type_alias_eq(node->typ, _const_v__ast__void_type)) { if (v__ast__Type_alias_eq(c->expected_type, _const_v__ast__void_type)) { @@ -62350,7 +62560,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t9; } else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { - v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}); + v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); @@ -62375,16 +62585,21 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str 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); } } + 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_2892273012681280244_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) { v__ast__StructInitField* field = ((v__ast__StructInitField*)node->fields.data) + i; - v__ast__StructField field_info = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); string field_name = _SLIT(""); if (node->is_short) { if (i >= info.fields.len) { break; } - field_info = (*(v__ast__StructField*)/*ee elem_sym */array_get(info.fields, i)); + field_info = (*(v__ast__StructField*)/*ee elem_sym */array_get(info_fields_sorted, i)); field_name = field_info.name; (*(v__ast__StructInitField*)/*ee elem_sym */array_get(node->fields, i)).name = field_name; } else { @@ -62394,7 +62609,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (_t11.state != 0) { /*or block*/ IError err = _t11.err; exists = false; - *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); } field_info = (*(v__ast__StructField*)_t11.data); @@ -63439,7 +63654,7 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* return _t7; } else if (node->op == (v__token__Kind__plus)) { - v__ast__Expr _t8 = (t->pref->backend == v__pref__Backend__c ? (v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = string__plus(v__util__smart_quote((*node->left._v__ast__StringLiteral).val, (*node->left._v__ast__StringLiteral).is_raw), v__util__smart_quote((*node->right._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).is_raw)),.is_raw = 0,.language = 0,.pos = pos,}))))) : (v__ast__InfixExpr_to_sumtype_v__ast__Expr(node))); + v__ast__Expr _t8 = (t->pref->backend == v__pref__Backend__c ? (v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = string__plus(v__util__smart_quote((*node->left._v__ast__StringLiteral).val, (*node->left._v__ast__StringLiteral).is_raw), v__util__smart_quote((*node->right._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).is_raw)),.pos = pos,.language = 0,.is_raw = 0,}))))) : (v__ast__InfixExpr_to_sumtype_v__ast__Expr(node))); return _t8; } else { @@ -64222,7 +64437,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -64345,7 +64560,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 184 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } else if (node._typ == 303 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -64358,7 +64573,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; for (int _t3 = 0; _t3 < (*node._v__ast__GlobalDecl).fields.len; ++_t3) { v__ast__GlobalField gfield = ((v__ast__GlobalField*)(*node._v__ast__GlobalDecl).fields.data)[_t3]; string gkey = gfield.name; - (*(v__ast__GlobalField*)map_get_and_set((map*)&all_globals, &(string[]){gkey}, &(v__ast__GlobalField[]){ (v__ast__GlobalField){.name = (string){.str=(byteptr)"", .is_lit=1},.has_expr = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_markused = 0,.is_volatile = 0,.typ = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),} })) = gfield; + (*(v__ast__GlobalField*)map_get_and_set((map*)&all_globals, &(string[]){gkey}, &(v__ast__GlobalField[]){ (v__ast__GlobalField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.has_expr = 0,.is_markused = 0,.is_volatile = 0,} })) = gfield; } } @@ -64448,7 +64663,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ println( str_intp(2, _MOV((StrIntpData[]){{_SLIT(">>>> "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT(" uses: "), 0, { .d_c = 0 }}}))); } #endif - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } } } @@ -65017,7 +65232,7 @@ void v__markused__Walker_or_block(v__markused__Walker* w, v__ast__OrExpr node) { } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, string var_name) { v__gen__c__Type array_type = v__gen__c__Gen_unwrap(g, node.typ); string array_styp = _SLIT(""); v__gen__c__Type elem_type = v__gen__c__Gen_unwrap(g, node.elem_type); @@ -65036,9 +65251,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } int len = node.exprs.len; if (array_type.unaliased_sym->kind == v__ast__Kind__array_fixed) { - v__gen__c__Gen_fixed_array_init(g, node, array_type); + v__gen__c__Gen_fixed_array_init(g, node, array_type, var_name); } else if (len == 0) { - v__gen__c__Gen_array_init_with_fields(g, node, elem_type, is_amp, shared_styp); + v__gen__c__Gen_array_init_with_fields(g, node, elem_type, is_amp, shared_styp, var_name); } else { string elem_styp = v__gen__c__Gen_typ(g, elem_type.typ); string noscan = v__gen__c__Gen_check_noscan(g, elem_type.typ); @@ -65080,17 +65295,24 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type, string var_name) { if (node.has_it) { g->inside_lambda = true; string tmp = v__gen__c__Gen_new_tmp_var(g); - string s = v__gen__c__Gen_go_before_stmt(g, 0); + string s = _SLIT(""); + if (var_name.len != 0) { + tmp = var_name; + } else { + s = v__gen__c__Gen_go_before_stmt(g, 0); + } bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); string ret_typ = v__gen__c__Gen_typ(g, node.typ); string elem_typ = v__gen__c__Gen_typ(g, node.elem_type); g->empty_line = true; - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + if (var_name.len == 0) { + v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + } v__gen__c__Gen_write(g, _SLIT("{")); if (node.has_val) { for (int i = 0; i < node.exprs.len; ++i) { @@ -65128,12 +65350,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_writeln(g, _SLIT("}")); g->indent--; v__gen__c__Gen_writeln(g, _SLIT("}")); - if (s_ends_with_ln) { - v__gen__c__Gen_writeln(g, s); - } else { - v__gen__c__Gen_write(g, s); + if (var_name.len == 0) { + if (s_ends_with_ln) { + v__gen__c__Gen_writeln(g, s); + } else { + v__gen__c__Gen_write(g, s); + } + v__gen__c__Gen_write(g, tmp); } - v__gen__c__Gen_write(g, tmp); g->inside_lambda = false; return; } @@ -65177,7 +65401,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp, string var_name) { string elem_styp = v__gen__c__Gen_typ(g, elem_type.typ); string noscan = v__gen__c__Gen_check_noscan(g, elem_type.typ); bool is_default_array = elem_type.unaliased_sym->kind == v__ast__Kind__array && node.has_default; @@ -65185,13 +65409,20 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v_ if (node.has_it) { g->inside_lambda = true; string tmp = v__gen__c__Gen_new_tmp_var(g); - string s = v__gen__c__Gen_go_before_stmt(g, 0); + string s = _SLIT(""); + if (var_name.len != 0) { + tmp = var_name; + } else { + s = v__gen__c__Gen_go_before_stmt(g, 0); + } bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); string ret_typ = v__gen__c__Gen_typ(g, node.typ); string elem_typ = v__gen__c__Gen_typ(g, node.elem_type); g->empty_line = true; - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + if (var_name.len == 0) { + v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + } if (is_default_array) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__new_array_with_array_default"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); } else if (is_default_map) { @@ -65249,12 +65480,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v_ v__gen__c__Gen_writeln(g, _SLIT("}")); g->indent--; v__gen__c__Gen_writeln(g, _SLIT("}")); - if (s_ends_with_ln) { - v__gen__c__Gen_writeln(g, s); - } else { - v__gen__c__Gen_write(g, s); + if (var_name.len == 0) { + if (s_ends_with_ln) { + v__gen__c__Gen_writeln(g, s); + } else { + v__gen__c__Gen_write(g, s); + } + v__gen__c__Gen_write(g, tmp); } - v__gen__c__Gen_write(g, tmp); g->inside_lambda = false; return; } @@ -65669,43 +65902,85 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g continue; } array_push((array*)&done, _MOV((v__ast__Type[]){ t })); + strings__Builder fn_builder = strings__new_builder(512); string left_type_str = v__gen__c__Gen_typ(g, t); string fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT("_contains"), 0, { .d_c = 0 }}})); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ; - string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); - v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, left_info.elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - left_type_str = _SLIT("Array_voidptr"); - elem_type_str = _SLIT("voidptr"); - } - strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); - strings__Builder fn_builder = strings__new_builder(512); - strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&fn_builder, _SLIT("\tfor (int i = 0; i < a.len; ++i) {")); - if (elem_sym->kind == v__ast__Kind__string) { - strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(((string*)a.data)[i], v)) {")); - } else if (elem_sym->kind == v__ast__Kind__array && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__function) { - strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (((voidptr*)a.data)[i] == v) {")); - } else if (elem_sym->kind == v__ast__Kind__map && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__struct_ && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__interface_ && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__sum_type && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__alias && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else { - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); + if (left_final_sym->kind == v__ast__Kind__array) { + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ).elem_type; + string elem_type_str = v__gen__c__Gen_typ(g, elem_type); + v__ast__Kind elem_kind = v__ast__Table_sym(g->table, elem_type)->kind; + bool elem_is_not_ptr = v__ast__Type_nr_muls(elem_type) == 0; + if (elem_kind == v__ast__Kind__function) { + left_type_str = _SLIT("Array_voidptr"); + elem_type_str = _SLIT("voidptr"); + } + strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, _SLIT("\tfor (int i = 0; i < a.len; ++i) {")); + if (elem_kind == v__ast__Kind__string) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(((string*)a.data)[i], v)) {")); + } else if (elem_kind == v__ast__Kind__array && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__function) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (((voidptr*)a.data)[i] == v) {")); + } else if (elem_kind == v__ast__Kind__map && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__struct_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__interface_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__sum_type && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__alias && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); + } + } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ; + int size = left_info.size; + v__ast__Type elem_type = left_info.elem_type; + string elem_type_str = v__gen__c__Gen_typ(g, elem_type); + v__ast__Kind elem_kind = v__ast__Table_sym(g->table, elem_type)->kind; + bool elem_is_not_ptr = v__ast__Type_nr_muls(elem_type) == 0; + if (elem_kind == v__ast__Kind__function) { + left_type_str = _SLIT("Array_voidptr"); + elem_type_str = _SLIT("voidptr"); + } + strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tfor (int i = 0; i < "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("; ++i) {"), 0, { .d_c = 0 }}}))); + if (elem_kind == v__ast__Kind__string) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(a[i], v)) {")); + } else if (elem_kind == v__ast__Kind__array && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__function) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (a[i] == v) {")); + } else if (elem_kind == v__ast__Kind__map && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__struct_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__interface_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__sum_type && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__alias && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (a[i] == v) {")); + } } strings__Builder_writeln(&fn_builder, _SLIT("\t\t\treturn true;")); strings__Builder_writeln(&fn_builder, _SLIT("\t\t}")); @@ -66275,7 +66550,7 @@ string sref_name; v__ast__Expr val = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, i)); bool is_call = false; bool blank_assign = false; - v__ast__Ident ident = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident ident = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, var_type)); if ((left)->_typ == 267 /* v.ast.Ident */) { ident = (*left->_v__ast__Ident); @@ -66511,7 +66786,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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); @@ -66629,7 +66904,7 @@ string sref_name; } else if (is_decl) { if (is_fixed_array_init && !has_val) { if ((val)._typ == 247 /* v.ast.ArrayInit */) { - v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit)); + v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); } else { v__gen__c__Gen_write(g, _SLIT("{0}")); } @@ -66640,7 +66915,11 @@ string sref_name; if (v__ast__Expr_is_auto_deref_var(val)) { v__gen__c__Gen_write(g, _SLIT("*")); } - v__gen__c__Gen_expr(g, val); + if ((val)._typ == 247 /* v.ast.ArrayInit */) { + v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); + } else { + v__gen__c__Gen_expr(g, val); + } if (is_auto_heap) { v__gen__c__Gen_write(g, _SLIT("))")); } @@ -66691,7 +66970,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v for (int i = 0; i < node->left.len; ++i) { v__ast__Expr lx = ((v__ast__Expr*)node->left.data)[i]; bool is_auto_heap = false; - v__ast__Ident ident = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident ident = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); if ((lx)._typ == 267 /* v.ast.Ident */) { ident = (*lx._v__ast__Ident); if ((*lx._v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { @@ -69011,7 +69290,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -69706,7 +69985,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -71304,7 +71583,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, Option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_67520 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); @@ -72125,7 +72404,7 @@ 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__ArrayDecompose).expr); } else if (node._typ == 247 /* v.ast.ArrayInit */) { - v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit)); + v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit), _SLIT("")); } else if (node._typ == 248 /* v.ast.AsCast */) { v__gen__c__Gen_as_cast(g, (*node._v__ast__AsCast)); @@ -72753,11 +73032,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_106764 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_106764.arg0; - string key_eq_fn = mr_106764.arg1; - string clone_fn = mr_106764.arg2; - string free_fn = mr_106764.arg3; + multi_return_string_string_string_string mr_106768 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_106768.arg0; + string key_eq_fn = mr_106768.arg1; + string clone_fn = mr_106768.arg2; + string free_fn = mr_106768.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -73598,7 +73877,7 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; } } if (v__ast__ConstField_is_simple_define_const(&field)) { - v__gen__c__Gen_const_decl_simple_define(g, name, v__gen__c__Gen_expr_string(g, field_expr)); + v__gen__c__Gen_const_decl_simple_define(g, 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); } @@ -73698,7 +73977,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* } VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val) { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("#define _const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); + 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__"))) { + x = string_substr(x, 6, (x).len); + } + } else { + x = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + 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); } @@ -74000,6 +74287,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ else { }; } + bool is_minify = (*sym->info._v__ast__Struct).is_minify; strings__Builder_writeln(&g->type_definitions, pre_pragma); if ((*sym->info._v__ast__Struct).is_union) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("union "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); @@ -74010,9 +74298,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_146119 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_146119.arg0; - string base = mr_146119.arg1; + multi_return_string_string mr_146502 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_146502.arg0; + string base = mr_146502.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -74029,7 +74317,27 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ string type_name = v__gen__c__Gen_typ(g, field.typ); string field_name = v__gen__c__c_name(field.name); string volatile_prefix = (field.is_volatile ? (_SLIT("volatile ")) : (_SLIT(""))); - strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = volatile_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + string size_suffix = _SLIT(""); + if (is_minify && !g->is_cc_msvc) { + if (field.typ == _const_v__ast__bool_type_idx) { + size_suffix = _SLIT(" : 1"); + } else { + v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); + if ((field_sym->info)._typ == 446 /* v.ast.Enum */) { + if (!(*field_sym->info._v__ast__Enum).is_flag && !(*field_sym->info._v__ast__Enum).uses_exprs) { + int bits_needed = 0; + int l = (*field_sym->info._v__ast__Enum).vals.len; + for (;;) { + if (!(l > 0)) break; + bits_needed++; + l >>= 1; + } + size_suffix = str_intp(2, _MOV((StrIntpData[]){{_SLIT(" : "), /*100 &int*/0xfe07, {.d_i32 = bits_needed}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + } + } + } + strings__Builder_writeln(&g->type_definitions, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = volatile_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = size_suffix}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else { strings__Builder_writeln(&g->type_definitions, _SLIT("\tEMPTY_STRUCT_DECLARATION;")); @@ -74289,11 +74597,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_155392 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_155392.arg0; - string pafile = mr_155392.arg1; - string pamod = mr_155392.arg2; - string pafn = mr_155392.arg3; + multi_return_int_string_string_string mr_156325 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_156325.arg0; + string pafile = mr_156325.arg1; + string pamod = mr_156325.arg2; + string pafn = mr_156325.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 }}}))); @@ -74316,11 +74624,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_156659 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_156659.arg0; - string pafile = mr_156659.arg1; - string pamod = mr_156659.arg2; - string pafn = mr_156659.arg3; + multi_return_int_string_string_string mr_157592 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_157592.arg0; + string pafile = mr_157592.arg1; + string pamod = mr_157592.arg2; + string pafn = mr_157592.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 }}}))); @@ -74430,11 +74738,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_159269 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_159269.arg0; - string key_eq_fn = mr_159269.arg1; - string clone_fn = mr_159269.arg2; - string free_fn = mr_159269.arg3; + multi_return_string_string_string_string mr_160202 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_160202.arg0; + string key_eq_fn = mr_160202.arg1; + string clone_fn = mr_160202.arg2; + string free_fn = mr_160202.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(""))); @@ -74964,9 +75272,9 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { strings__Builder_write_string(&methods_wrapper, str_intp(5, _MOV((StrIntpData[]){{_SLIT("static inline "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, method.return_type)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = iwpostfix}}, {_SLIT("("), 0, { .d_c = 0 }}}))); 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)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(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)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) }); - multi_return_Array_string_Array_string_Array_bool mr_173751 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_173751.arg0; + 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_174684 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_174684.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__")); @@ -74980,11 +75288,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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_174215 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_174215.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_175148 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_175148.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 }}})); @@ -75450,7 +75758,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 }}}))); @@ -75528,7 +75836,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast_ if ((node.field_expr)._typ == 287 /* v.ast.SelectorExpr */) { if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 267 /* v.ast.Ident */) { if (string__eq((*(*node.field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name, g->comptime_for_field_var) && string__eq((*node.field_expr._v__ast__SelectorExpr).field_name, _SLIT("name"))) { - v__gen__c__Gen_write(g, v__gen__c__c_name(g->comptime_for_field_value.name)); + string field_name = g->comptime_for_field_value.name; + v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.left_type)); + Option_v__ast__StructField _t1 = v__ast__Table_find_field_with_embeds(g->table, left_sym, field_name); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(node.left)}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node.left)); + VUNREACHABLE(); + ; + } + + (*(v__ast__StructField*)_t1.data); + v__gen__c__Gen_write(g, v__gen__c__c_name(field_name)); return; } } @@ -77059,8 +77378,19 @@ int ctmp; for (int _t15 = 0; _t15 < node->attrs.len; ++_t15) { v__ast__Attr attr = ((v__ast__Attr*)node->attrs.data)[_t15]; if (string__eq(attr.name, _SLIT("export"))) { + bool _t16 = false; + Array_v__ast__Attr _t16_orig = node->attrs; + int _t16_len = _t16_orig.len; + for (int _t17 = 0; _t17 < _t16_len; ++_t17) { + v__ast__Attr it = ((v__ast__Attr*) _t16_orig.data)[_t17]; + if (string__eq(it.name, _SLIT("weak"))) { + _t16 = true; + break; + } + } + string weak = (_t16 ? (_SLIT("VWEAK ")) : (_SLIT(""))); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("// export alias: "), /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}}))); - string export_alias = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fn_attrs}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = arg_str}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + string export_alias = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = weak}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fn_attrs}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = arg_str}}, {_SLIT(")"), 0, { .d_c = 0 }}})); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("VV_EXPORTED_SYMBOL "), /*115 &string*/0xfe10, {.d_s = export_alias}}, {_SLIT("; // exported fn "), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = export_alias}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -77139,9 +77469,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF v__gen__c__Gen_write(g, node->decl.name); return; } - multi_return_string_string mr_14615 = v__gen__c__closure_ctx(node->decl); - string ctx_struct = mr_14615.arg0; - string arg_struct = mr_14615.arg1; + multi_return_string_string mr_14693 = v__gen__c__closure_ctx(node->decl); + string ctx_struct = mr_14693.arg0; + string arg_struct = mr_14693.arg1; v__gen__c__Gen_write(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT("_wrapper, "), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT("_unwrapper, ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); g->indent++; for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { @@ -77151,7 +77481,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF g->indent--; int ps = g->table->pointer_size; int is_big_cutoff = (g->pref->os == v__pref__OS__windows || g->pref->arch == v__pref__Arch__arm32 ? (ps) : (ps * 2)); - bool is_big = v__ast__Table_type_size(g->table, node->decl.return_type) > is_big_cutoff; + multi_return_int_int mr_15314 = v__ast__Table_type_size(g->table, node->decl.return_type); + int rt_size = mr_15314.arg0; + bool is_big = rt_size > is_big_cutoff; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT(")))"), 0, { .d_c = 0 }}}))); strings__Builder sb = strings__new_builder(512); string ret_styp = v__gen__c__Gen_typ(g, node->decl.return_type); @@ -77207,9 +77539,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn_decl(v__gen__c__Gen* g, v__ast__ node->has_gen = true; strings__Builder builder = strings__new_builder(256); if (node->inherited_vars.len > 0) { - multi_return_string_string mr_17084 = v__gen__c__closure_ctx(node->decl); - string ctx_struct = mr_17084.arg0; - string arg_struct = mr_17084.arg1; + multi_return_string_string mr_17185 = v__gen__c__closure_ctx(node->decl); + string ctx_struct = mr_17185.arg0; + string arg_struct = mr_17185.arg1; strings__Builder_writeln(&builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { v__ast__Param var = ((v__ast__Param*)node->inherited_vars.data)[_t1]; @@ -78069,11 +78401,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_41672 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_41672.arg0; - string pafile = mr_41672.arg1; - string pamod = mr_41672.arg2; - string pafn = mr_41672.arg3; + multi_return_int_string_string_string mr_41773 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_41773.arg0; + string pafile = mr_41773.arg1; + string pamod = mr_41773.arg2; + string pafn = mr_41773.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(")")); @@ -78163,7 +78495,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a free_tmp_arg_vars = false; g->tmp_count_af++; v__ast__Scope* scope = v__ast__Scope_innermost(g->file->scope, node.pos.pos); - Array_v__ast__CallArg args = new_array_from_c_array(1, 1, sizeof(v__ast__CallArg), _MOV((v__ast__CallArg[1]){((v__ast__CallArg){.is_mut = 0,.share = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = node.left,.typ = node.receiver_type,.is_tmp_autofree = node.free_receiver,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})})); + Array_v__ast__CallArg args = new_array_from_c_array(1, 1, sizeof(v__ast__CallArg), _MOV((v__ast__CallArg[1]){((v__ast__CallArg){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = node.left,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = node.receiver_type,.share = 0,.is_mut = 0,.is_tmp_autofree = node.free_receiver,})})); _PUSH_MANY(&args, (node.args), _t1, Array_v__ast__CallArg); for (int i = 0; i < args.len; ++i) { v__ast__CallArg arg = ((v__ast__CallArg*)args.data)[i]; @@ -78192,7 +78524,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a } s = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = t}}, {_SLIT(" = "), 0, { .d_c = 0 }}})); } else { - v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = t,.share = 0,.is_mut = 0,.is_autofree_tmp = true,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__string_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = node.pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = t,.expr = {0},.pos = node.pos,.typ = _const_v__ast__string_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = true,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); s = str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = t}}, {_SLIT(" = "), 0, { .d_c = 0 }}})); } s = /*f*/string__plus(s, v__gen__c__Gen_expr_string(g, arg.expr)); @@ -78785,6 +79117,19 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_write_fn_attrs(v__gen__c__Gen* g, Array_v_ v__gen__c__Gen_write(g, _SLIT("__NOINLINE ")); } else if (string__eq(attr.name, _SLIT("weak"))) { + bool _t2 = false; + Array_v__ast__Attr _t2_orig = attrs; + int _t2_len = _t2_orig.len; + for (int _t3 = 0; _t3 < _t2_len; ++_t3) { + v__ast__Attr it = ((v__ast__Attr*) _t2_orig.data)[_t3]; + if (string__eq(it.name, _SLIT("export"))) { + _t2 = true; + break; + } + } + if (_t2) { + continue; + } v__gen__c__Gen_write(g, _SLIT("VWEAK ")); } else if (string__eq(attr.name, _SLIT("noreturn"))) { @@ -78832,8 +79177,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_write_fn_attrs(v__gen__c__Gen* g, Array_v_ else { }; } - string _t2 = fn_attrs; - return _t2; + string _t4 = fn_attrs; + return _t4; } VV_LOCAL_SYMBOL string v__gen__c__call_convention_attribute(string cconvention, bool is_cc_msvc) { @@ -80392,7 +80737,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { Array_v__ast__InfixExpr infix_exprs = __new_array_with_default(0, 0, sizeof(v__ast__InfixExpr), 0); for (int i = 0; i < (*node.right._v__ast__ArrayInit).exprs.len; ++i) { - array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.op = v__token__Kind__key_is,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_stmt = 0,.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),}) })); + array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.op = v__token__Kind__key_is,.is_stmt = 0,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,}) })); } v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_sumtype_interface_array(g, infix_exprs); @@ -80414,7 +80759,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { if (Array_v__ast__Type_contains(v__ast__TypeSymbol_sumtype_info(elem_type_.sym).variants, node.left_type)) { - v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.typ = elem_type,.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.expr_type = node.left_type,.has_arg = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = elem_type,.expr_type = node.left_type,.has_arg = 0,}); v__gen__c__Gen_gen_array_contains(g, node.right_type, node.right, v__ast__CastExpr_to_sumtype_v__ast__Expr(&new_node_left)); return; } @@ -80449,7 +80794,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { Array_v__ast__InfixExpr infix_exprs = __new_array_with_default(0, 0, sizeof(v__ast__InfixExpr), 0); for (int i = 0; i < (*node.right._v__ast__ArrayInit).exprs.len; ++i) { - array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.op = v__token__Kind__key_is,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_stmt = 0,.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),}) })); + array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.op = v__token__Kind__key_is,.is_stmt = 0,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,}) })); } v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_sumtype_interface_array(g, infix_exprs); @@ -80466,12 +80811,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 412 /* v.ast.Array */) { - v__ast__Type elem_type = (*right.sym->info._v__ast__Array).elem_type; + if ((right.sym->info)._typ == 440 /* v.ast.ArrayFixed */) { + v__ast__Type elem_type = (*right.sym->info._v__ast__ArrayFixed).elem_type; v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { if (Array_v__ast__Type_contains(v__ast__TypeSymbol_sumtype_info(elem_type_.sym).variants, node.left_type)) { - v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.typ = elem_type,.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.expr_type = node.left_type,.has_arg = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = elem_type,.expr_type = node.left_type,.has_arg = 0,}); v__gen__c__Gen_gen_array_contains(g, node.right_type, node.right, v__ast__CastExpr_to_sumtype_v__ast__Expr(&new_node_left)); return; } @@ -80890,7 +81235,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } if (skips > 0) { init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); - init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.typ_str = styp,.typ = utyp,.update_expr = {0},.update_expr_type = 0,.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_update_embed = 0,.has_update_expr = 0,.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),})))))); + init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); } } strings__Builder_writeln(&dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(" {\n "), /*115 &string*/0xfe10, {.d_s = init_styp}}, {_SLIT(";\n if (!root) {\n const char *error_ptr = cJSON_GetErrorPtr();\n if (error_ptr != NULL) {\n const int error_pos = (int)cJSON_GetErrorPos();\n int maxcontext_chars = 30;\n byte *buf = vcalloc_noscan(maxcontext_chars + 10);\n if(error_pos > 0) {\n int backlines = 1;\n int backchars = error_pos < maxcontext_chars-7 ? (int)error_pos : maxcontext_chars-7 ;\n char *prevline_ptr = (char*)error_ptr;\n while(backchars--){\n char prevc = *(prevline_ptr - 1);\n if(0==prevc){\n break;\n }\n if(10==prevc && !backlines--){\n break;\n }\n prevline_ptr--;\n if(123==prevc) {\n break; // stop at `{` too\n }\n }\n int maxchars = vstrlen_char(prevline_ptr);\n vmemcpy(buf, prevline_ptr, (maxchars < maxcontext_chars ? maxchars : maxcontext_chars));\n }\n return (Option_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){.state = 2,.err = _v_error(tos2(buf)),.data = {0}};\n }\n }\n"), 0, { .d_c = 0 }}}))); @@ -82731,18 +83076,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp r.name = tmp; where_expr.left = v__ast__Ident_to_sumtype_v__ast__Expr(&l); where_expr.right = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){ - .pos = r.pos, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = prim, - .is_mut = false, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .next_token = 0, .expr = v__ast__Ident_to_sumtype_v__ast__Expr(&r), + .scope = 0, + .pos = r.pos, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .expr_type = (/* as */ *(v__ast__IdentVar*)__as_cast((r.info)._v__ast__IdentVar,(r.info)._typ, 377) /*expected idx: 377, name: v.ast.IdentVar */ ).typ, .typ = _const_v__ast__int_type, .name_type = 0, + .next_token = 0, .gkind_field = 0, - .scope = 0, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = false, })))); v__ast__SqlExpr arr = ((v__ast__SqlExpr){ .typ = field.typ, @@ -82846,7 +83191,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_table_name(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL v__ast__StructField v__gen__c__Gen_get_struct_field(v__gen__c__Gen* g, string name) { v__ast__Struct info = v__ast__TypeSymbol_struct_info(v__ast__Table_sym(g->table, (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){g->sql_table_name}, &(int[]){ 0 })))); - v__ast__StructField f = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; if (string__eq(field.name, name)) { @@ -83385,7 +83730,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; array_push((array*)&_t11, &ti); } _PUSH_MANY(&used_embed_fields, (_t11), _t10, Array_string); - v__ast__StructInit default_init = ((v__ast__StructInit){node.pos,node.name_pos,node.is_short,node.is_short_syntax,node.unresolved,node.pre_comments,node.typ_str,.typ = embed,node.update_expr,node.update_expr_type,node.update_expr_comments,.is_update_embed = true,node.has_update_expr,.fields = init_fields_to_embed,node.embeds,node.generic_types,}); + v__ast__StructInit default_init = ((v__ast__StructInit){node.pre_comments,node.update_expr_comments,.fields = init_fields_to_embed,node.embeds,node.generic_types,node.typ_str,node.update_expr,node.pos,node.name_pos,.typ = embed,node.update_expr_type,node.is_short,node.is_short_syntax,node.unresolved,.is_update_embed = true,node.has_update_expr,}); int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); @@ -83485,7 +83830,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; Option_multi_return_v__ast__StructField_Array_v__ast__Type _t15 = v__ast__Table_find_field_from_embeds(g->table, update_sym, field->name); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_6986 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); @@ -83622,39 +83967,39 @@ Option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v_ } string raw_text = (*(string*)_t2.data); - v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.file_path = file_path, - .file_base = os__base(file_path), - .text = raw_text, - .pos = 0, - .line_nr = 0, - .last_nl_pos = -1, - .is_crlf = 0, - .is_inside_string = 0, - .is_inter_start = 0, - .is_inter_end = 0, - .is_enclosed_inter = 0, - .line_comment = (string){.str=(byteptr)"", .is_lit=1}, - .last_lt = -1, - .is_started = 0, - .is_print_line_on_error = true, - .is_print_colored_error = true, - .is_print_rel_paths_on_error = true, - .quote = 0, - .inter_quote = 0, - .nr_lines = 0, - .is_vh = 0, - .is_fmt = pref->is_fmt, - .comments_mode = comments_mode, - .is_inside_toplvl_statement = 0, - .all_tokens = __new_array(0, 0, sizeof(v__token__Token)), - .tidx = 0, - .eofs = 0, - .pref = pref, + v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.all_tokens = __new_array(0, 0, sizeof(v__token__Token)), .error_details = __new_array(0, 0, sizeof(string)), .errors = __new_array(0, 0, sizeof(v__errors__Error)), .warnings = __new_array(0, 0, sizeof(v__errors__Warning)), .notices = __new_array(0, 0, sizeof(v__errors__Notice)), .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .file_path = file_path, + .file_base = os__base(file_path), + .text = raw_text, + .line_comment = (string){.str=(byteptr)"", .is_lit=1}, + .pref = pref, + .pos = 0, + .line_nr = 0, + .last_nl_pos = -1, + .last_lt = -1, + .nr_lines = 0, + .tidx = 0, + .eofs = 0, + .quote = 0, + .inter_quote = 0, + .comments_mode = comments_mode, + .is_crlf = 0, + .is_inside_string = 0, + .is_inter_start = 0, + .is_inter_end = 0, + .is_enclosed_inter = 0, + .is_started = 0, + .is_print_line_on_error = true, + .is_print_colored_error = true, + .is_print_rel_paths_on_error = true, + .is_vh = 0, + .is_fmt = pref->is_fmt, + .is_inside_toplvl_statement = 0, .should_abort = 0, }, sizeof(v__scanner__Scanner))); v__scanner__Scanner_init_scanner(s); @@ -83664,39 +84009,39 @@ Option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v_ } v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref) { - v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.file_path = _SLIT("internal_memory"), - .file_base = _SLIT("internal_memory"), - .text = text, - .pos = 0, - .line_nr = 0, - .last_nl_pos = -1, - .is_crlf = 0, - .is_inside_string = 0, - .is_inter_start = 0, - .is_inter_end = 0, - .is_enclosed_inter = 0, - .line_comment = (string){.str=(byteptr)"", .is_lit=1}, - .last_lt = -1, - .is_started = 0, - .is_print_line_on_error = true, - .is_print_colored_error = true, - .is_print_rel_paths_on_error = true, - .quote = 0, - .inter_quote = 0, - .nr_lines = 0, - .is_vh = 0, - .is_fmt = pref->is_fmt, - .comments_mode = comments_mode, - .is_inside_toplvl_statement = 0, - .all_tokens = __new_array(0, 0, sizeof(v__token__Token)), - .tidx = 0, - .eofs = 0, - .pref = pref, + v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.all_tokens = __new_array(0, 0, sizeof(v__token__Token)), .error_details = __new_array(0, 0, sizeof(string)), .errors = __new_array(0, 0, sizeof(v__errors__Error)), .warnings = __new_array(0, 0, sizeof(v__errors__Warning)), .notices = __new_array(0, 0, sizeof(v__errors__Notice)), .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .file_path = _SLIT("internal_memory"), + .file_base = _SLIT("internal_memory"), + .text = text, + .line_comment = (string){.str=(byteptr)"", .is_lit=1}, + .pref = pref, + .pos = 0, + .line_nr = 0, + .last_nl_pos = -1, + .last_lt = -1, + .nr_lines = 0, + .tidx = 0, + .eofs = 0, + .quote = 0, + .inter_quote = 0, + .comments_mode = comments_mode, + .is_crlf = 0, + .is_inside_string = 0, + .is_inter_start = 0, + .is_inter_end = 0, + .is_enclosed_inter = 0, + .is_started = 0, + .is_print_line_on_error = true, + .is_print_colored_error = true, + .is_print_rel_paths_on_error = true, + .is_vh = 0, + .is_fmt = pref->is_fmt, + .is_inside_toplvl_statement = 0, .should_abort = 0, }, sizeof(v__scanner__Scanner))); v__scanner__Scanner_init_scanner(s); @@ -83735,13 +84080,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_token(v__scanner_ s->tidx++; int line_offset = (tok_kind == v__token__Kind__hash ? (0) : (1)); v__token__Token _t1 = ((v__token__Token){ - .kind = tok_kind, .lit = lit, .line_nr = s->line_nr + line_offset, .col = v__mathutil__max_T_int(1, v__scanner__Scanner_current_column(s) - len + 1), .pos = s->pos - len + 1, .len = len, .tidx = cidx, + .kind = tok_kind, }); return _t1; } @@ -83749,13 +84094,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_token(v__scanner_ // Attr: [inline] inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_eof_token(v__scanner__Scanner* s) { v__token__Token _t1 = ((v__token__Token){ - .kind = v__token__Kind__eof, .lit = _SLIT(""), .line_nr = s->line_nr + 1, .col = v__scanner__Scanner_current_column(s), .pos = s->pos, .len = 1, .tidx = s->tidx, + .kind = v__token__Kind__eof, }); return _t1; } @@ -83765,13 +84110,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_multiline_token(v int cidx = s->tidx; s->tidx++; v__token__Token _t1 = ((v__token__Token){ - .kind = tok_kind, .lit = lit, .line_nr = start_line + 1, .col = v__mathutil__max_T_int(1, v__scanner__Scanner_current_column(s) - len + 1), .pos = s->pos - len + 1, .len = len, .tidx = cidx, + .kind = tok_kind, }); return _t1; } @@ -85166,19 +85511,19 @@ void v__scanner__Scanner_error(v__scanner__Scanner* s, string msg) { s->should_abort = true; return; } - array_push((array*)&s->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = msg,.details = details,.file_path = s->file_path,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__scanner,}) })); + array_push((array*)&s->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = msg,.details = details,.file_path = s->file_path,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__scanner,}) })); } } VV_LOCAL_SYMBOL void v__scanner__Scanner_vet_error(v__scanner__Scanner* s, string msg, v__vet__FixKind fix) { v__vet__Error ve = ((v__vet__Error){ - .kind = v__vet__ErrorKind__error, .message = msg, .details = (string){.str=(byteptr)"", .is_lit=1}, .file_path = s->file_path, .pos = ((v__token__Pos){.len = 0,.line_nr = s->line_nr,.pos = 0,.col = v__scanner__Scanner_current_column(s) - 1,.last_line = 0,}), .fix = fix, .typ = v__vet__ErrorType__default, + .kind = v__vet__ErrorKind__error, }); array_push((array*)&s->vet_errors, _MOV((v__vet__Error[]){ ve })); } @@ -85705,18 +86050,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } v__ast__Expr r0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(right, 0)); v__ast__Var v = ((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = (*lx._v__ast__Ident).name, + .expr = (left.len == right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(right, i))) : (v__ast__empty_expr())), + .pos = (*lx._v__ast__Ident).pos, + .typ = 0, + .orig_type = 0, .share = share, .is_mut = (*lx._v__ast__Ident).is_mut || p->inside_for, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = 0, .is_inherited = 0, - .expr = (left.len == right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(right, i))) : (v__ast__empty_expr())), - .typ = 0, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = (*lx._v__ast__Ident).pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -85785,14 +86130,14 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__Stmt _t13 = v__ast__AssignStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssignStmt, (((v__ast__AssignStmt){ - .op = op, - .pos = pos, .comments = comments, .end_comments = end_comments, .right = right, .left = left, .left_types = __new_array(0, 0, sizeof(v__ast__Type)), .right_types = __new_array(0, 0, sizeof(v__ast__Type)), + .pos = pos, + .op = op, .is_static = is_static, .is_volatile = is_volatile, .is_simple = p->inside_for && p->tok.kind == v__token__Kind__lcbr, @@ -85870,7 +86215,7 @@ 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) { - v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); + v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = 0,.is_env = 0,.is_pkgconfig = 0,}))); v__parser__Parser_check(p, v__token__Kind__dollar); v__token__Pos start_pos = v__token__Token_pos(&p->prev_tok); string error_msg = _SLIT("only `$tmpl()`, `$env()`, `$embed_file()`, `$pkgconfig()` and `$vweb.html()` comptime functions are supported right now"); @@ -85898,24 +86243,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__parser__Parser_check(p, v__token__Kind__string); v__parser__Parser_check(p, v__token__Kind__rpar); v__ast__ComptimeCall _t3 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = s, - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = true, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = spos, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = true, + .is_pkgconfig = 0, }); return _t3; } @@ -85924,24 +86269,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__parser__Parser_check(p, v__token__Kind__string); v__parser__Parser_check(p, v__token__Kind__rpar); v__ast__ComptimeCall _t4 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = s, - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = spos, - .is_pkgconfig = true, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = true, }); return _t4; } @@ -85988,7 +86333,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } - v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); + v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = ((v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.len = 0,.is_compressed = 0,}),.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = true,.is_env = 0,.is_pkgconfig = 0,}); return _t8; } Array_string fn_path = string_split(p->cur_fn_name, _SLIT("_")); @@ -86013,7 +86358,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } if (!os__exists(path)) { if (p->pref->is_fmt) { - v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); + v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = method_name,.left = {0},.args_var = literal_string_param,.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = true,.is_embed = 0,.is_env = 0,.is_pkgconfig = 0,}); return _t9; } if (is_html) { @@ -86053,24 +86398,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__ast__File* file = v__parser__parse_comptime(tmpl_path, v_code, p->table, p->pref, p->scope); file->path = tmpl_path; v__ast__ComptimeCall _t11 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = *file, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = literal_string_param, - .is_vweb = true, - .vweb_tmpl = *file, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = true, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = 0, }); return _t11; } @@ -86090,12 +86435,12 @@ VV_LOCAL_SYMBOL v__ast__ComptimeFor v__parser__Parser_comptime_for(v__parser__Pa v__ast__ComptimeForKind kind = v__ast__ComptimeForKind__methods; v__parser__Parser_open_scope(p); if (string__eq(for_val, _SLIT("methods"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FunctionData")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FunctionData")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } else if (string__eq(for_val, _SLIT("fields"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FieldData")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FieldData")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); kind = v__ast__ComptimeForKind__fields; } else if (string__eq(for_val, _SLIT("attributes"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("StructAttribute")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("StructAttribute")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); kind = v__ast__ComptimeForKind__attributes; } else { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown kind `"), /*115 &string*/0xfe10, {.d_s = for_val}}, {_SLIT("`, available are: `methods`, `fields` or `attributes`"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->prev_tok)); @@ -86139,24 +86484,24 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars v__parser__Parser_check(p, v__token__Kind__lcbr); } v__ast__Expr _t1 = v__ast__ComptimeCall_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeCall, (((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = args, .method_name = method_name, - .method_pos = method_pos, - .scope = p->scope, .left = left, .args_var = _SLIT(""), - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = p->scope, + .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), + .method_pos = method_pos, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = args, - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = 0, })))); return _t1; } @@ -86171,7 +86516,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars if (has_parens) { v__parser__Parser_check(p, v__token__Kind__rpar); } - v__ast__Expr _t2 = v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeSelector, (((v__ast__ComptimeSelector){.has_parens = has_parens,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.left = left,.left_type = 0,.field_expr = expr,.typ = 0,})))); + v__ast__Expr _t2 = v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeSelector, (((v__ast__ComptimeSelector){.left = left,.field_expr = expr,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.left_type = 0,.typ = 0,.has_parens = has_parens,})))); return _t2; } @@ -86230,7 +86575,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser #endif last_pos = v__token__Token_pos(&p->tok); v__parser__Parser_check(p, v__token__Kind__rsbr); - if (exprs.len == 1 && (p->tok.kind == v__token__Kind__name || p->tok.kind == v__token__Kind__amp || p->tok.kind == v__token__Kind__lsbr) && p->tok.line_nr == line_nr) { + if (exprs.len == 1 && p->tok.line_nr == line_nr && ((p->tok.kind == v__token__Kind__name || p->tok.kind == v__token__Kind__amp) || (p->tok.kind == v__token__Kind__lsbr && v__parser__Parser_is_array_type(p)))) { elem_type = v__parser__Parser_parse_type(p); if (string__eq(v__ast__Table_sym(p->table, elem_type)->name, _SLIT("byte"))) { v__parser__Parser_error(p, _SLIT("`byte` has been deprecated in favor of `u8`: use `[10]u8{}` instead of `[10]byte{}`")); @@ -86244,7 +86589,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser string n = v__parser__Parser_check_name(p); if (!string__eq(n, _SLIT("init"))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected `init:`, not `"), /*115 &string*/0xfe10, {.d_s = n}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); - v__ast__ArrayInit _t4 = ((v__ast__ArrayInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.is_fixed = 0,.has_val = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.len_expr = {0},.cap_expr = {0},.default_expr = {0},.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.elem_type = 0,.default_type = 0,.typ = 0,}); + v__ast__ArrayInit _t4 = ((v__ast__ArrayInit){.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.len_expr = {0},.cap_expr = {0},.default_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type = 0,.default_type = 0,.typ = 0,.is_fixed = 0,.has_val = 0,.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,}); return _t4; } v__parser__Parser_check(p, v__token__Kind__colon); @@ -86332,7 +86677,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser } else { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("wrong field `"), /*115 &string*/0xfe10, {.d_s = key}}, {_SLIT("`, expecting `len`, `cap`, or `init`"), 0, { .d_c = 0 }}}))); - v__ast__ArrayInit _t9 = ((v__ast__ArrayInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.is_fixed = 0,.has_val = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.len_expr = {0},.cap_expr = {0},.default_expr = {0},.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.elem_type = 0,.default_type = 0,.typ = 0,}); + v__ast__ArrayInit _t9 = ((v__ast__ArrayInit){.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.len_expr = {0},.cap_expr = {0},.default_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type = 0,.default_type = 0,.typ = 0,.is_fixed = 0,.has_val = 0,.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,}); return _t9; }; if (p->tok.kind != v__token__Kind__rcbr) { @@ -86343,25 +86688,25 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser } v__token__Pos pos = v__token__Pos_extend_with_last_line(first_pos, last_pos, p->prev_tok.line_nr); v__ast__ArrayInit _t10 = ((v__ast__ArrayInit){ - .pos = pos, - .elem_type_pos = elem_type_pos, .ecmnts = ecmnts, .pre_cmnts = pre_cmnts, + .exprs = exprs, + .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), + .mod = p->mod, + .len_expr = len_expr, + .cap_expr = cap_expr, + .default_expr = default_expr, + .pos = pos, + .elem_type_pos = elem_type_pos, + .elem_type = elem_type, + .default_type = 0, + .typ = array_type, .is_fixed = is_fixed, .has_val = has_val, - .mod = p->mod, .has_len = has_len, .has_cap = has_cap, .has_default = has_default, .has_it = has_it, - .exprs = exprs, - .len_expr = len_expr, - .cap_expr = cap_expr, - .default_expr = default_expr, - .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), - .elem_type = elem_type, - .default_type = 0, - .typ = array_type, }); return _t10; } @@ -86384,12 +86729,12 @@ VV_LOCAL_SYMBOL v__ast__MapInit v__parser__Parser_map_init(v__parser__Parser* p) } array_push((array*)&comments, _MOV((Array_v__ast__Comment[]){ v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})) })); } - v__ast__MapInit _t4 = ((v__ast__MapInit){.pos = v__token__Pos_extend_with_last_line(first_pos, v__token__Token_pos(&p->tok), p->tok.line_nr),.comments = comments,.pre_cmnts = pre_cmnts,.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = 0,.key_type = 0,.value_type = 0,}); + v__ast__MapInit _t4 = ((v__ast__MapInit){.comments = comments,.pre_cmnts = pre_cmnts,.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Pos_extend_with_last_line(first_pos, v__token__Token_pos(&p->tok), p->tok.line_nr),.typ = 0,.key_type = 0,.value_type = 0,}); return _t4; } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_it_as_index(v__parser__Parser* p) { - map_set(&p->scope->objects, &(string[]){_SLIT("it")}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = false,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = false,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))) }); + map_set(&p->scope->objects, &(string[]){_SLIT("it")}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = false,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = false,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))) }); } v__ast__Expr v__parser__Parser_expr(v__parser__Parser* p, int precedence) { @@ -86632,7 +86977,7 @@ bool inside_array_lit; v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = typ,.expr = expr,.typname = typname,.expr_type = 0,.has_arg = 0,.pos = pos,})))); + node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = expr,.typname = typname,.pos = pos,.typ = typ,.expr_type = 0,.has_arg = 0,})))); } else { node = v__ast__ArrayInit_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayInit, (v__parser__Parser_array_init(p)))); } @@ -86688,7 +87033,7 @@ bool inside_array_lit; if (p->tok.kind != v__token__Kind__dot && p->tok.line_nr == p->prev_tok.line_nr) { v__parser__Parser_warn_with_pos(p, _SLIT("use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead"), spos); } - node = v__ast__TypeOf_to_sumtype_v__ast__Expr(ADDR(v__ast__TypeOf, (((v__ast__TypeOf){.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr = expr,.expr_type = 0,})))); + node = v__ast__TypeOf_to_sumtype_v__ast__Expr(ADDR(v__ast__TypeOf, (((v__ast__TypeOf){.expr = expr,.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; } case v__token__Kind__key_dump: @@ -86698,7 +87043,7 @@ bool inside_array_lit; v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr = expr,.expr_type = 0,.cname = (string){.str=(byteptr)"", .is_lit=1},})))); + node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.expr = expr,.cname = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; } case v__token__Kind__key_offsetof: @@ -86721,7 +87066,7 @@ bool inside_array_lit; string field = p->tok.lit; v__parser__Parser_next(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__OffsetOf_to_sumtype_v__ast__Expr(ADDR(v__ast__OffsetOf, (((v__ast__OffsetOf){.struct_type = st,.field = field,.pos = pos,})))); + node = v__ast__OffsetOf_to_sumtype_v__ast__Expr(ADDR(v__ast__OffsetOf, (((v__ast__OffsetOf){.field = field,.pos = pos,.struct_type = st,})))); break; } case v__token__Kind__key_likely: @@ -86762,7 +87107,7 @@ bool inside_array_lit; v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT("anon"),.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT("anon"),.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); } Option_v__ast__Expr _t11; opt_ok(&(v__ast__Expr[]) { node }, (Option*)(&_t11), sizeof(v__ast__Expr)); @@ -86916,7 +87261,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); p->is_stmt_ident = is_stmt_ident; } } else if (p->tok.kind == v__token__Kind__key_as) { @@ -86938,7 +87283,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((node)._typ == 270 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } - node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.op = tok.kind,.pos = pos,.is_stmt = true,.left = node,.right = right,.left_type = 0,.right_type = 0,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),})))); + node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.right = right,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = pos,.left_type = 0,.right_type = 0,.op = tok.kind,.is_stmt = true,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,})))); } else if (v__token__Kind_is_infix(p->tok.kind)) { if (v__token__Kind_is_prefix(p->tok.kind) && p->tok.line_nr != p->prev_tok.line_nr) { if (p->tok.kind == v__token__Kind__mul && v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__assign) { @@ -87013,7 +87358,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -87028,19 +87373,19 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__Expr _t2 = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = op, - .pos = pos, - .is_stmt = p->is_stmt_ident, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), .left = left, .right = right, + .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = pos, .left_type = 0, .right_type = 0, - .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .op = op, + .is_stmt = p->is_stmt_ident, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), })))); return _t2; } @@ -87099,7 +87444,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -87113,7 +87458,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) p->or_is_handled = false; } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__Expr _t4 = v__ast__PrefixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PrefixExpr, (((v__ast__PrefixExpr){.op = op,.pos = pos,.right_type = 0,.right = right,.or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.is_option = 0,})))); + v__ast__Expr _t4 = v__ast__PrefixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PrefixExpr, (((v__ast__PrefixExpr){.or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.right = right,.pos = pos,.right_type = 0,.op = op,.is_option = 0,})))); return _t4; } @@ -87158,7 +87503,7 @@ string old_expr_mod; p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -87179,33 +87524,33 @@ string old_expr_mod; Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__CallExpr _t1 = ((v__ast__CallExpr){ - .pos = pos, - .name_pos = first_pos, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .args = args, + .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), + .concrete_types = concrete_types, + .raw_concrete_types = concrete_types, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .comments = comments, .mod = p->mod, .name = fn_name, + .left = {0}, + .scope = p->scope, + .pos = pos, + .name_pos = first_pos, + .concrete_list_pos = concrete_list_pos, + .left_type = 0, + .receiver_type = 0, + .return_type = 0, + .fn_var_type = 0, + .language = language, .is_method = 0, .is_field = 0, .is_fn_var = 0, .is_keep_alive = 0, .is_noreturn = 0, .is_ctor_new = 0, - .args = args, - .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), - .language = language, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), - .left = {0}, - .left_type = 0, - .receiver_type = 0, - .return_type = 0, - .fn_var_type = 0, .should_be_skipped = 0, - .concrete_types = concrete_types, - .concrete_list_pos = concrete_list_pos, - .raw_concrete_types = concrete_types, .free_receiver = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), - .comments = comments, }); // Defer begin if (v__parser__Parser_call_expr_defer_0) { @@ -87253,7 +87598,7 @@ Array_v__ast__CallArg v__parser__Parser_call_args(v__parser__Parser* p) { } v__token__Pos pos = v__token__Pos_extend(arg_start_pos, v__token__Token_pos(&p->prev_tok)); _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t3, Array_v__ast__Comment); - array_push((array*)&args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.is_mut = is_mut,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.comments = comments,.expr = expr,.typ = 0,.is_tmp_autofree = 0,.pos = pos,}) })); + array_push((array*)&args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.comments = comments,.expr = expr,.pos = pos,.typ = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.is_mut = is_mut,.is_tmp_autofree = 0,}) })); if (p->tok.kind != v__token__Kind__rpar) { v__parser__Parser_check(p, v__token__Kind__comma); } @@ -87381,7 +87726,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { Option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t6; } @@ -87395,7 +87740,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); @@ -87408,14 +87753,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t9; } } @@ -87429,7 +87774,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8890 = v__parser__Parser_parse_generic_types(p); @@ -87469,23 +87814,23 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = param.name, + .expr = {0}, + .pos = param.pos, + .typ = param.typ, + .orig_type = 0, .share = 0, .is_mut = param.is_mut, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = param.is_mut || param.is_auto_rec, .is_inherited = 0, - .expr = {0}, - .typ = param.typ, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = param.pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -87520,12 +87865,26 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ - .is_variadic = is_variadic, + .params = params, + .generic_names = generic_names, + .attrs = p->attrs, + .mod = p->mod, + .file = p->file_name, + .name = name, + .pos = start_pos, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type = return_type, + .receiver_type = rec.typ, + .usages = 0, + .ctdefine_idx = conditional_ctdefine_idx, + .source_fn = 0, .language = language, + .file_mode = file_mode, + .is_variadic = is_variadic, .is_pub = is_pub, .is_ctor_new = 0, .is_deprecated = is_deprecated, @@ -87537,21 +87896,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_method = true, .no_body = no_body, - .mod = p->mod, - .file = p->file_name, - .file_mode = file_mode, - .pos = start_pos, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type = return_type, - .receiver_type = rec.typ, - .name = name, - .params = params, - .source_fn = 0, - .usages = 0, - .generic_names = generic_names, - .attrs = p->attrs, .is_conditional = conditional_ctdefine_idx != _const_v__ast__invalid_type_idx, - .ctdefine_idx = conditional_ctdefine_idx, })); } else { if (language == v__ast__Language__c) { @@ -87584,8 +87929,22 @@ 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){ - .is_variadic = is_variadic, + .params = params, + .generic_names = generic_names, + .attrs = p->attrs, + .mod = p->mod, + .file = p->file_name, + .name = name, + .pos = start_pos, + .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 = conditional_ctdefine_idx, + .source_fn = 0, .language = language, + .file_mode = file_mode, + .is_variadic = is_variadic, .is_pub = is_pub, .is_ctor_new = is_ctor_new, .is_deprecated = is_deprecated, @@ -87597,21 +87956,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_method = false, .no_body = no_body, - .mod = p->mod, - .file = p->file_name, - .file_mode = file_mode, - .pos = start_pos, - .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, - .name = name, - .params = params, - .source_fn = 0, - .usages = 0, - .generic_names = generic_names, - .attrs = p->attrs, .is_conditional = conditional_ctdefine_idx != _const_v__ast__invalid_type_idx, - .ctdefine_idx = conditional_ctdefine_idx, })); } p->cur_fn_name = name; @@ -87629,13 +87974,39 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ + .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}), + .generic_names = generic_names, + .attrs = p->attrs, + .params = params, + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = comments, + .end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, .name = name, .short_name = short_fn_name, .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = rec.pos, + .method_type_pos = rec.type_pos, + .body_pos = body_start_pos, + .return_type_pos = return_type_pos, + .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), + .method_idx = type_sym_method_idx, + .ctdefine_idx = conditional_ctdefine_idx, + .idx = 0, + .return_type = return_type, + .ninstances = 0, + .language = language, + .file_mode = 0, + .rec_share = 0, .is_deprecated = is_deprecated, .is_pub = is_pub, .is_variadic = is_variadic, @@ -87649,40 +88020,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_unsafe = is_unsafe, .is_markused = is_markused, - .receiver = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = rec.name,.typ = rec.typ,}), - .receiver_pos = rec.pos, .is_method = is_method, - .method_type_pos = rec.type_pos, - .method_idx = type_sym_method_idx, .rec_mut = rec.is_mut, - .rec_share = 0, - .language = language, - .file_mode = 0, .no_body = no_body, .is_builtin = p->builtin_mod || Array_string_contains(_const_v__util__builtin_module_parts, p->mod), - .body_pos = body_start_pos, - .file = p->file_name, - .generic_names = generic_names, .is_direct_arr = is_direct_arr, - .attrs = p->attrs, - .ctdefine_idx = conditional_ctdefine_idx, - .idx = 0, - .params = params, - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = return_type, - .return_type_pos = return_type_pos, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = comments, - .end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = p->label_names, - .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), }); if (generic_names.len > 0) { v__ast__Table_register_fn_generic_types(p->table, v__ast__FnDecl_fkey(&fn_decl)); @@ -87769,13 +88114,13 @@ bool v__parser__Parser_fn_receiver_defer_0 = false; rec->typ = v__ast__Type_deref(rec->typ); } array_push((array*)params, _MOV((v__ast__Param[]){ ((v__ast__Param){ - .pos = rec_start_pos, .name = rec->name, + .pos = rec_start_pos, + .type_pos = rec->type_pos, + .typ = rec->typ, .is_mut = rec->is_mut, .is_auto_rec = is_auto_rec, - .type_pos = rec->type_pos, .is_hidden = 0, - .typ = rec->typ, }) })); // Defer begin if (v__parser__Parser_fn_receiver_defer_0) { @@ -87791,7 +88136,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->pref->is_script && p->tok.kind == v__token__Kind__name) { v__parser__Parser_error_with_pos(p, _SLIT("function declarations in script mode should be before all script statements"), v__token__Token_pos(&p->tok)); - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } bool old_inside_defer = p->inside_defer; @@ -87810,18 +88155,18 @@ bool v__parser__Parser_anon_fn_defer_0 = false; } bool is_stack_obj = !v__ast__Type_has_flag(arg.typ, v__ast__TypeFlag__shared_f) && (arg.is_mut || v__ast__Type_is_ptr(arg.typ)); v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = arg.name, + .expr = {0}, + .pos = arg.pos, + .typ = arg.typ, + .orig_type = 0, .share = 0, .is_mut = arg.is_mut, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = 0, .is_inherited = 0, - .expr = {0}, - .typ = arg.typ, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = arg.pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -87848,7 +88193,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){.is_variadic = is_variadic,.language = 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 = false,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = args,.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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,}); 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; @@ -87865,9 +88210,35 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__ast__Type typ = v__ast__new_type(idx); p->inside_defer = old_inside_defer; v__ast__AnonFn _t3 = ((v__ast__AnonFn){.decl = ((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = args, + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = label_names, .name = name, .short_name = _SLIT(""), .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = return_type_pos, + .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = return_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = is_variadic, @@ -87881,40 +88252,14 @@ bool v__parser__Parser_anon_fn_defer_0 = false; .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = false, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = no_body, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = args, - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = return_type, - .return_type_pos = return_type_pos, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = label_names, - .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), }),.inherited_vars = inherited_vars,.typ = typ,.has_gen = 0,}); // Defer begin if (v__parser__Parser_anon_fn_defer_0) { @@ -87993,7 +88338,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_ if (alanguage != v__ast__Language__v) { v__parser__Parser_check_for_impure_v(p, alanguage, pos); } - array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = pos,.name = _SLIT(""),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = pos,.is_hidden = 0,.typ = arg_type,}) })); + array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = _SLIT(""),.pos = pos,.type_pos = pos,.typ = arg_type,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); arg_no++; if (arg_no > 1024) { v__parser__Parser_error_with_pos(p, _SLIT("too many args"), pos); @@ -88078,7 +88423,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_ if (alanguage != v__ast__Language__v) { v__parser__Parser_check_for_impure_v(p, alanguage, (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i))); } - array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i)),.name = arg_name,.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i)),.is_hidden = 0,.typ = typ,}) })); + array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = arg_name,.pos = (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i)),.type_pos = (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i)),.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); if (is_variadic && p->tok.kind == v__token__Kind__comma) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot use ...(variadic) with non-final parameter "), /*115 &string*/0xfe10, {.d_s = arg_name}}, {_SLIT0, 0, { .d_c = 0 }}})), (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i))); return (multi_return_Array_v__ast__Param_bool_bool){.arg0=__new_array_with_default(0, 0, sizeof(v__ast__Param), 0), .arg1=false, .arg2=false}; @@ -88106,13 +88451,13 @@ VV_LOCAL_SYMBOL v__ast__GoExpr v__parser__Parser_go_expr(v__parser__Parser* p) { _t1 = (*expr._v__ast__CallExpr); } else { v__parser__Parser_error_with_pos(p, _SLIT("expression in `go` must be a function call"), v__ast__Expr_pos(expr)); - _t1 = ((v__ast__CallExpr){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = {0},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + _t1 = ((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,}); } v__ast__CallExpr call_expr = _t1; v__token__Pos pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_register_auto_import(p, _SLIT("sync.threads")); p->table->gostmts++; - v__ast__GoExpr _t2 = ((v__ast__GoExpr){.pos = pos,.call_expr = call_expr,.is_expr = 0,}); + v__ast__GoExpr _t2 = ((v__ast__GoExpr){.call_expr = call_expr,.pos = pos,.is_expr = 0,}); return _t2; } @@ -88141,8 +88486,8 @@ VV_LOCAL_SYMBOL Array_v__ast__Param v__parser__Parser_closure_vars(v__parser__Pa if (is_mut) { var->is_changed = true; } - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){(*var).name,(*var).share,.is_mut = is_mut,(*var).is_autofree_tmp,(*var).is_arg,(*var).is_auto_deref,.is_inherited = true,(*var).expr,(*var).typ,(*var).orig_type,(*var).smartcasts,.pos = var_pos,.is_used = false,.is_changed = false,(*var).is_or,(*var).is_tmp,(*var).is_auto_heap,(*var).is_stack_obj,}))))); - array_push((array*)&vars, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = var_pos,.name = var_name,.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = 0,.typ = 0,}) })); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){(*var).smartcasts,(*var).name,(*var).expr,.pos = var_pos,(*var).typ,(*var).orig_type,(*var).share,.is_mut = is_mut,(*var).is_autofree_tmp,(*var).is_arg,(*var).is_auto_deref,.is_inherited = true,.is_used = false,.is_changed = false,(*var).is_or,(*var).is_tmp,(*var).is_auto_heap,(*var).is_stack_obj,}))))); + array_push((array*)&vars, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = var_name,.pos = var_pos,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); if (p->tok.kind != v__token__Kind__comma) { break; } @@ -88303,7 +88648,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { v__ast__Stmt _t8 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of value iteration variable `"), /*115 &string*/0xfe10, {.d_s = val_var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})))))); return _t8; } - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = key_var_name,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = key_var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = key_var_name,.expr = {0},.pos = key_var_pos,.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); } else if (v__ast__Scope_known_var(p->scope, val_var_name)) { v__ast__Stmt _t9 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of value iteration variable `"), /*115 &string*/0xfe10, {.d_s = val_var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})))))); return _t9; @@ -88320,7 +88665,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { is_range = true; v__parser__Parser_next(p); high_expr = v__parser__Parser_expr(p, 0); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var_name,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = val_var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var_name,.expr = {0},.pos = val_var_pos,.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); if (key_var_name.len > 0) { v__ast__Stmt _t11 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("cannot declare index variable with range `for`"), key_var_pos)))); return _t11; @@ -88331,18 +88676,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { } } else { v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = val_var_name, + .expr = {0}, + .pos = val_var_pos, + .typ = 0, + .orig_type = 0, .share = 0, .is_mut = val_is_mut, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = val_is_mut, .is_inherited = 0, - .expr = {0}, - .typ = 0, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = val_var_pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -88355,21 +88700,21 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { Array_v__ast__Stmt stmts = v__parser__Parser_parse_block_no_scope(p, false); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__ForInStmt for_in_stmt = ((v__ast__ForInStmt){ + .stmts = stmts, .key_var = key_var_name, .val_var = val_var_name, - .is_range = is_range, .high = high_expr, - .stmts = stmts, - .pos = pos, - .val_is_mut = val_is_mut, .cond = cond, + .label = (string){.str=(byteptr)"", .is_lit=1}, + .scope = p->scope, + .pos = pos, .key_type = 0, .val_type = 0, .cond_type = 0, .high_type = 0, .kind = 0, - .label = (string){.str=(byteptr)"", .is_lit=1}, - .scope = p->scope, + .is_range = is_range, + .val_is_mut = val_is_mut, }); v__parser__Parser_close_scope(p); v__ast__Stmt _t13 = v__ast__ForInStmt_to_sumtype_v__ast__Stmt(&for_in_stmt); @@ -88416,7 +88761,7 @@ bool was_inside_ct_if_expr; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t2, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__key_match) { v__parser__Parser_error(p, _SLIT("cannot use `match` with `if` statements")); - v__ast__IfExpr _t3 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t3 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -88432,7 +88777,7 @@ bool was_inside_ct_if_expr; v__token__Pos body_pos = v__token__Token_pos(&p->tok); v__parser__Parser_open_scope(p); if (prev_guard) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); } array_push((array*)&branches, _MOV((v__ast__IfBranch[]){ ((v__ast__IfBranch){.pos = v__token__Pos_extend(start_pos, end_pos),.body_pos = v__token__Pos_extend(body_pos, v__token__Token_pos(&p->tok)),.comments = comments,.cond = {0},.pkg_exist = 0,.stmts = v__parser__Parser_parse_block_no_scope(p, false),.scope = p->scope,}) })); v__parser__Parser_close_scope(p); @@ -88446,7 +88791,7 @@ bool was_inside_ct_if_expr; v__parser__Parser_check(p, v__token__Kind__key_if); if (p->tok.kind == v__token__Kind__key_match) { v__parser__Parser_error(p, _SLIT("cannot use `match` with `if` statements")); - v__ast__IfExpr _t5 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t5 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -88491,7 +88836,7 @@ bool was_inside_ct_if_expr; cond = v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IfGuardExpr, (((v__ast__IfGuardExpr){.vars = vars,.expr = expr,.expr_type = 0,})))); for (int _t10 = 0; _t10 < vars.len; ++_t10) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)vars.data)[_t10]; - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = var.name,.share = 0,.is_mut = var.is_mut,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = cond,.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var.pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = var.name,.expr = cond,.pos = var.pos,.typ = 0,.orig_type = 0,.share = 0,.is_mut = var.is_mut,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } prev_guard = true; } else { @@ -88529,7 +88874,7 @@ bool was_inside_ct_if_expr; if (is_comptime) { if (p->tok.kind == v__token__Kind__key_else) { v__parser__Parser_error(p, _SLIT("use `$else` instead of `else` in compile-time `if` branches")); - v__ast__IfExpr _t14 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t14 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -88551,14 +88896,14 @@ bool was_inside_ct_if_expr; pos.last_line = (*(v__ast__Comment*)array_last(comments)).pos.last_line; } v__ast__IfExpr _t15 = ((v__ast__IfExpr){ - .is_comptime = is_comptime, - .tok_kind = 0, - .pos = pos, .post_comments = comments, - .left = {0}, .branches = branches, - .is_expr = is_expr, + .left = {0}, + .pos = pos, .typ = 0, + .tok_kind = 0, + .is_comptime = is_comptime, + .is_expr = is_expr, .has_else = has_else, }); // Defer begin @@ -88644,12 +88989,12 @@ VV_LOCAL_SYMBOL v__ast__MatchExpr v__parser__Parser_match_expr(v__parser__Parser p->inside_match_case = false; if (p->tok.kind == v__token__Kind__dotdot) { v__parser__Parser_error_with_pos(p, _SLIT("match only supports inclusive (`...`) ranges, not exclusive (`..`)"), v__token__Token_pos(&p->tok)); - v__ast__MatchExpr _t5 = ((v__ast__MatchExpr){.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.cond = {0},.branches = __new_array(0, 0, sizeof(v__ast__MatchBranch)),.is_expr = 0,.return_type = 0,.cond_type = 0,.expected_type = 0,.is_sum_type = 0,}); + v__ast__MatchExpr _t5 = ((v__ast__MatchExpr){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__MatchBranch)),.cond = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.cond_type = 0,.expected_type = 0,.tok_kind = 0,.is_expr = 0,.is_sum_type = 0,}); return _t5; } else if (p->tok.kind == v__token__Kind__ellipsis) { v__parser__Parser_next(p); v__ast__Expr expr2 = v__parser__Parser_expr(p, 0); - array_push((array*)&exprs, _MOV((v__ast__Expr[]){ v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = true,.has_low = true,.pos = v__token__Token_pos(&p->tok),.is_gated = 0,.low = expr,.high = expr2,})))) })); + array_push((array*)&exprs, _MOV((v__ast__Expr[]){ v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = expr,.high = expr2,.pos = v__token__Token_pos(&p->tok),.has_high = true,.has_low = true,.is_gated = 0,})))) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); } @@ -88700,7 +89045,7 @@ VV_LOCAL_SYMBOL v__ast__MatchExpr v__parser__Parser_match_expr(v__parser__Parser v__parser__Parser_check(p, v__token__Kind__rcbr); } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__MatchExpr _t9 = ((v__ast__MatchExpr){.tok_kind = 0,.pos = pos,.comments = comments,.cond = cond,.branches = branches,.is_expr = 0,.return_type = 0,.cond_type = 0,.expected_type = 0,.is_sum_type = is_sum_type,}); + v__ast__MatchExpr _t9 = ((v__ast__MatchExpr){.comments = comments,.branches = branches,.cond = cond,.pos = pos,.return_type = 0,.cond_type = 0,.expected_type = 0,.tok_kind = 0,.is_expr = 0,.is_sum_type = is_sum_type,}); return _t9; } @@ -88831,13 +89176,13 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars pos.last_line = (*(v__ast__Comment*)array_last(post_comments)).pos.last_line; } array_push((array*)&branches, _MOV((v__ast__SelectBranch[]){ ((v__ast__SelectBranch){ - .pos = pos, .comment = comment, + .post_comments = post_comments, + .stmts = stmts, + .stmt = stmt, + .pos = pos, .is_else = is_else, .is_timeout = is_timeout, - .post_comments = post_comments, - .stmt = stmt, - .stmts = stmts, }) })); if (p->tok.kind == v__token__Kind__rcbr || ((is_else || is_timeout) && no_lcbr)) { break; @@ -88870,33 +89215,33 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_lockable(v__parser__Parser* p) { v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)); } v__ast__Expr expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__v, - .tok_kind = 0, - .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, 0)), - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = p->scope, .obj = {0}, .mod = p->mod, .name = (*(string*)/*ee elem_sym */array_get(names, 0)), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = p->scope, + .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, 0)), + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = 0, + .language = v__ast__Language__v, .kind = 0, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = true, })))); for (int i = 1; i < names.len; i++) { expr = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){ - .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, i)), + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = (*(string*)/*ee elem_sym */array_get(names, i)), - .is_mut = true, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .next_token = (i < names.len - 1 ? (v__token__Kind__dot) : (p->tok.kind)), .expr = expr, + .scope = p->scope, + .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, i)), + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .expr_type = 0, .typ = 0, .name_type = 0, + .next_token = (i < names.len - 1 ? (v__token__Kind__dot) : (p->tok.kind)), .gkind_field = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = true, })))); } v__ast__Expr _t3 = expr; @@ -89284,8 +89629,22 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) return_type_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->prev_tok)); } v__ast__Fn func = ((v__ast__Fn){ - .is_variadic = is_variadic, + .params = args, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = p->attrs, + .mod = (string){.str=(byteptr)"", .is_lit=1}, + .file = (string){.str=(byteptr)"", .is_lit=1}, + .name = name, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = return_type_pos, + .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, @@ -89297,21 +89656,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) .is_keep_alive = 0, .is_method = false, .no_body = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, - .file = (string){.str=(byteptr)"", .is_lit=1}, - .file_mode = 0, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type_pos = return_type_pos, - .return_type = return_type, - .receiver_type = 0, - .name = name, - .params = args, - .source_fn = 0, - .usages = 0, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = p->attrs, .is_conditional = 0, - .ctdefine_idx = 0, }); bool has_decl = p->builtin_mod && string_starts_with(name, _SLIT("Map")) && string_ends_with(name, _SLIT("Fn")); int idx = v__ast__Table_find_or_register_fn_type(p->table, p->mod, func, false, has_decl); @@ -89380,7 +89725,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) { v__ast__Type _t5 = v__ast__new_type(idx); return _t5; } - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = true,.is_generic = 0,.variants = variant_types,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))),.kind = v__ast__Kind__sum_type,.name = prepend_mod_name,.cname = v__util__no_dots(prepend_mod_name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = 0,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = variant_types,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = true,.is_generic = 0,})))),.name = prepend_mod_name,.cname = v__util__no_dots(prepend_mod_name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__sum_type,.language = 0,.is_pub = 0,})); v__ast__Type _t6 = v__ast__new_type(idx); return _t6; } else if (variants.len == 1) { @@ -89693,7 +90038,7 @@ v__ast__Type v__parser__Parser_parse_generic_type(v__parser__Parser* p, string n v__ast__Type _t1 = v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic); return _t1; } - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = true,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = true,})); v__ast__Type _t2 = v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic); return _t2; } @@ -89769,7 +90114,7 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str else { } ; - int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__GenericInst, (((v__ast__GenericInst){.parent_idx = parent_idx,.concrete_types = concrete_types,})))),.kind = v__ast__Kind__generic_inst,.name = bs_name,.cname = v__util__no_dots(bs_cname),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__GenericInst, (((v__ast__GenericInst){.parent_idx = parent_idx,.concrete_types = concrete_types,})))),.name = bs_name,.cname = v__util__no_dots(bs_cname),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__generic_inst,.language = 0,.is_pub = 0,})); v__ast__Type _t3 = v__ast__new_type(idx); return _t3; } @@ -89784,7 +90129,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){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))),.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},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.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,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.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)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.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)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + 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,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -89805,21 +90150,42 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T } #endif v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = tmpl_path, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, .unique_prefix = (string){.str=(byteptr)"", .is_lit=1}, - .file_backend_mode = 0, + .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 = pref, .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), - .comments_mode = v__scanner__CommentsMode__skip_comments, - .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,}, .table = table, + .scope = scope, + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = v__scanner__CommentsMode__skip_comments, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -89848,38 +90214,17 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = scope, - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__ast__File* res = v__parser__Parser_parse(&p); v__parser__Parser_free_scanner(&p); @@ -89894,21 +90239,42 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab } #endif v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = v__scanner__new_scanner(text, comments_mode, pref), - .comments_mode = comments_mode, - .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,}, .table = table, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = comments_mode, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -89937,38 +90303,17 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); v__ast__File* res = v__parser__Parser_parse(&p); @@ -90045,21 +90390,42 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne } v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = (*(v__scanner__Scanner**)_t1.data), - .comments_mode = comments_mode, - .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,}, .table = table, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = comments_mode, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -90088,38 +90454,17 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); v__ast__File* res = v__parser__Parser_parse(&p); @@ -90144,21 +90489,42 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri } v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = (*(v__scanner__Scanner**)_t1.data), - .comments_mode = v__scanner__CommentsMode__parse_comments, - .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,}, .table = table_, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = v__scanner__CommentsMode__parse_comments, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -90187,38 +90553,17 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); if (string_contains_any_substr(p.scanner->text, new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("\n "), _SLIT(" \n")})))) { @@ -90396,6 +90741,29 @@ v__token__Token v__parser__Parser_peek_token_after_var_list(v__parser__Parser* p return _t1; } +VV_LOCAL_SYMBOL bool v__parser__Parser_is_array_type(v__parser__Parser* p) { + int i = 1; + v__token__Token tok = p->tok; + int line_nr = p->tok.line_nr; + for (;;) { + tok = v__parser__Parser_peek_token(p, i); + if (tok.line_nr != line_nr) { + bool _t1 = false; + return _t1; + } + if (tok.kind == v__token__Kind__name || tok.kind == v__token__Kind__amp) { + bool _t2 = true; + return _t2; + } + i++; + if (tok.kind == v__token__Kind__lsbr || tok.kind != v__token__Kind__rsbr) { + continue; + } + } + bool _t3 = false; + return _t3; +} + void v__parser__Parser_open_scope(v__parser__Parser* p) { p->scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = p->scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = p->tok.pos,.end_pos = 0,}, sizeof(v__ast__Scope))); } @@ -90591,9 +90959,35 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { } v__parser__Parser_close_scope(p); v__ast__Stmt _t22 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, .name = _SLIT("main.main"), .short_name = _SLIT("main"), .mod = _SLIT("main"), + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = 0, @@ -90607,40 +91001,14 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = p->label_names, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, })))); return _t22; } else if (p->pref->is_fmt) { @@ -90735,7 +91103,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { v__token__Pos pos = v__token__Token_pos(&p->tok); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__Stmt _t2 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssertStmt, (((v__ast__AssertStmt){.pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)),.expr = expr,.is_used = p->inside_test_file || !p->pref->is_prod,})))); + v__ast__Stmt _t2 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssertStmt, (((v__ast__AssertStmt){.expr = expr,.pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)),.is_used = p->inside_test_file || !p->pref->is_prod,})))); return _t2; break; } @@ -90852,7 +91220,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { if (p->tok.line_nr == line && p->tok.kind == v__token__Kind__name) { label = v__parser__Parser_check_name(p); } - v__ast__Stmt _t22 = v__ast__BranchStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__BranchStmt, (((v__ast__BranchStmt){.kind = tok.kind,.label = label,.pos = v__token__Token_pos(&tok),})))); + v__ast__Stmt _t22 = v__ast__BranchStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__BranchStmt, (((v__ast__BranchStmt){.label = label,.pos = v__token__Token_pos(&tok),.kind = tok.kind,})))); return _t22; break; } @@ -90880,7 +91248,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { p->defer_vars = __new_array_with_default(0, 0, sizeof(v__ast__Ident), 0); Array_v__ast__Stmt stmts = v__parser__Parser_parse_block(p); p->inside_defer = false; - v__ast__Stmt _t26 = v__ast__DeferStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__DeferStmt, (((v__ast__DeferStmt){.stmts = stmts,.pos = v__token__Pos_extend_with_last_line(spos, v__token__Token_pos(&p->tok), p->prev_tok.line_nr),.defer_vars = array_clone_to_depth(&p->defer_vars, 0),.ifdef = (string){.str=(byteptr)"", .is_lit=1},.idx_in_fn = -1,})))); + v__ast__Stmt _t26 = v__ast__DeferStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__DeferStmt, (((v__ast__DeferStmt){.stmts = stmts,.defer_vars = array_clone_to_depth(&p->defer_vars, 0),.ifdef = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend_with_last_line(spos, v__token__Token_pos(&p->tok), p->prev_tok.line_nr),.idx_in_fn = -1,})))); return _t26; } break; @@ -91201,12 +91569,12 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } } array_push((array*)&templates, _MOV((v__ast__AsmTemplate[]){ ((v__ast__AsmTemplate){ - .name = name, - .is_label = is_label, - .is_directive = is_directive, .args = args, .comments = comments, + .name = name, .pos = v__token__Pos_extend(template_pos, v__token__Token_pos(&p->tok)), + .is_label = is_label, + .is_directive = is_directive, }) })); } v__ast__Scope* scope = p->scope; @@ -91260,18 +91628,18 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } scope->end_pos = p->prev_tok.pos; v__ast__AsmStmt _t18 = ((v__ast__AsmStmt){ - .arch = arch, - .is_basic = is_top_level || output.len + input.len + clobbered.len == 0, - .is_volatile = is_volatile, - .is_goto = is_goto, .clobbered = clobbered, - .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), .templates = templates, - .scope = scope, .output = output, .input = input, .global_labels = global_labels, .local_labels = local_labels, + .scope = scope, + .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), + .arch = arch, + .is_basic = is_top_level || output.len + input.len + clobbered.len == 0, + .is_volatile = is_volatile, + .is_goto = is_goto, }); // Defer begin if (v__parser__Parser_asm_stmt_defer_0) { @@ -91586,7 +91954,7 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) v__token__Pos apos = v__token__Token_pos(&p->prev_tok); if (p->tok.kind == v__token__Kind__key_unsafe) { v__parser__Parser_next(p); - v__ast__Attr _t1 = ((v__ast__Attr){.name = _SLIT("unsafe"),.has_arg = 0,.arg = (string){.str=(byteptr)"", .is_lit=1},.kind = kind,.ct_expr = {0},.ct_opt = 0,.pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)),.ct_evaled = 0,.ct_skip = 0,}); + v__ast__Attr _t1 = ((v__ast__Attr){.name = _SLIT("unsafe"),.arg = (string){.str=(byteptr)"", .is_lit=1},.ct_expr = {0},.pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)),.kind = kind,.has_arg = 0,.ct_opt = 0,.ct_evaled = 0,.ct_skip = 0,}); return _t1; } string name = _SLIT(""); @@ -91644,12 +92012,12 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) } v__ast__Attr _t2 = ((v__ast__Attr){ .name = name, - .has_arg = has_arg, .arg = arg, - .kind = kind, .ct_expr = comptime_cond, - .ct_opt = comptime_cond_opt, .pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)), + .kind = kind, + .has_arg = has_arg, + .ct_opt = comptime_cond_opt, .ct_evaled = 0, .ct_skip = 0, }); @@ -91726,7 +92094,7 @@ v__ast__NodeError v__parser__Parser_error_with_pos(v__parser__Parser* p, string _v_exit(1); VUNREACHABLE(); } else { - array_push((array*)&p->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = p->file_name,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,}) })); + array_push((array*)&p->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = p->file_name,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__parser,}) })); if (p->pref->check_only) { v__parser__Parser_next(p); } @@ -91803,13 +92171,13 @@ void v__parser__Parser_note_with_pos(v__parser__Parser* p, string s, v__token__P void v__parser__Parser_vet_error(v__parser__Parser* p, string msg, int line, v__vet__FixKind fix, v__vet__ErrorType typ) { v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = line + 1,.pos = 0,.col = 0,.last_line = 0,}); array_push((array*)&p->vet_errors, _MOV((v__vet__Error[]){ ((v__vet__Error){ - .kind = v__vet__ErrorKind__error, .message = msg, .details = (string){.str=(byteptr)"", .is_lit=1}, .file_path = p->scanner->file_path, .pos = pos, .fix = fix, .typ = typ, + .kind = v__vet__ErrorKind__error, }) })); } @@ -91818,9 +92186,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_47746 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_47746.arg0; - Array_v__ast__Comment left_comments = mr_47746.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48071 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_48071.arg0; + Array_v__ast__Comment left_comments = mr_48071.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); } @@ -91880,24 +92248,24 @@ v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Langua } else { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected token `"), /*115 &string*/0xfe10, {.d_s = p->tok.lit}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); } - v__ast__Ident _t1 = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = p->scope,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident _t1 = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); return _t1; } v__token__Pos pos = v__token__Token_pos(&p->tok); string name = v__parser__Parser_check_name(p); if (string__eq(name, _SLIT("_"))) { v__ast__Ident _t2 = ((v__ast__Ident){ - .language = 0, - .tok_kind = p->tok.kind, - .pos = pos, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = p->comptime_if_cond, - .scope = p->scope, .obj = {0}, .mod = (string){.str=(byteptr)"", .is_lit=1}, .name = _SLIT("_"), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = false,.is_static = false,.is_volatile = false,.is_optional = 0,})))), + .scope = p->scope, + .pos = pos, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = p->tok.kind, + .language = 0, .kind = v__ast__IdentKind__blank_ident, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = false,.is_static = false,.is_volatile = false,.is_optional = 0,.share = 0,})))), + .comptime = p->comptime_if_cond, .is_mut = 0, }); return _t2; @@ -91908,17 +92276,17 @@ v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Langua name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = p->expr_mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})); } v__ast__Ident _t3 = ((v__ast__Ident){ - .language = language, - .tok_kind = p->tok.kind, - .pos = pos, - .mut_pos = mut_pos, - .comptime = p->comptime_if_cond, - .scope = p->scope, .obj = {0}, .mod = p->mod, .name = name, + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.is_mut = is_mut,.is_static = is_static,.is_volatile = is_volatile,.is_optional = 0,})))), + .scope = p->scope, + .pos = pos, + .mut_pos = mut_pos, + .tok_kind = p->tok.kind, + .language = language, .kind = v__ast__IdentKind__unresolved, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = is_mut,.is_static = is_static,.is_volatile = is_volatile,.is_optional = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),})))), + .comptime = p->comptime_if_cond, .is_mut = is_mut, }); return _t3; @@ -92063,7 +92431,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__parser__Parser_error(p, _SLIT("`}` expected; explicit `map` initialization does not support parameters")); } } - v__ast__Expr _t4 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.pos = pos,.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = __new_array(0, 0, sizeof(v__ast__Expr)),.vals = __new_array(0, 0, sizeof(v__ast__Expr)),.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = map_type,.key_type = 0,.value_type = 0,})))); + v__ast__Expr _t4 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = __new_array(0, 0, sizeof(v__ast__Expr)),.vals = __new_array(0, 0, sizeof(v__ast__Expr)),.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.typ = map_type,.key_type = 0,.value_type = 0,})))); return _t4; } if (string__eq(p->tok.lit, _SLIT("chan"))) { @@ -92199,12 +92567,12 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){ .arg = arg, - .typ = to_typ, .expr = expr, .typname = v__ast__Table_sym(p->table, to_typ)->name, + .pos = v__token__Pos_extend(start_pos, end_pos), + .typ = to_typ, .expr_type = 0, .has_arg = has_arg, - .pos = v__token__Pos_extend(start_pos, end_pos), })))); p->expr_mod = _SLIT(""); v__ast__Expr _t18 = node; @@ -92219,7 +92587,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); } } } 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) { @@ -92236,7 +92604,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { string field = v__parser__Parser_check_name(p); v__ast__GenericKindField fkind = ((string__eq(field, _SLIT("name"))) ? (v__ast__GenericKindField__name) : (string__eq(field, _SLIT("typ"))) ? (v__ast__GenericKindField__typ) : (v__ast__GenericKindField__unknown)); v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)); - v__ast__Expr _t21 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){.pos = pos,.field_name = field,.is_mut = 0,.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.next_token = 0,.expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = p->scope,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = name,.kind = 0,.info = {0},.is_mut = 0,})))),.expr_type = 0,.typ = 0,.name_type = 0,.gkind_field = fkind,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),})))); + v__ast__Expr _t21 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.field_name = field,.expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = name,.info = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,})))),.scope = p->scope,.pos = pos,.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.expr_type = 0,.typ = 0,.name_type = 0,.next_token = 0,.gkind_field = fkind,.is_mut = 0,})))); return _t21; } if (v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__name && v__parser__Parser_peek_token(p, 3).kind == v__token__Kind__lpar && !known_var) { @@ -92328,7 +92696,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos_high = v__token__Pos_extend(or_pos_high, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t1 = ((v__ast__IndexExpr){.pos = pos_high,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = has_high,.has_low = 0,.pos = pos_high,.is_gated = is_gated,.low = v__ast__empty_expr(),.high = high,})))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = v__ast__OrKind__block,.pos = or_pos_high,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t1 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = v__ast__OrKind__block,.pos = or_pos_high,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = v__ast__empty_expr(),.high = high,.pos = pos_high,.has_high = has_high,.has_low = 0,.is_gated = is_gated,})))),.left = left,.pos = pos_high,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t1; } if (p->tok.kind == v__token__Kind__question) { @@ -92337,7 +92705,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t2 = ((v__ast__IndexExpr){.pos = pos_high,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = has_high,.has_low = 0,.pos = pos_high,.is_gated = is_gated,.low = v__ast__empty_expr(),.high = high,})))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = or_kind_high,.pos = or_pos_high,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t2 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = or_kind_high,.pos = or_pos_high,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = v__ast__empty_expr(),.high = high,.pos = pos_high,.has_high = has_high,.has_low = 0,.is_gated = is_gated,})))),.left = left,.pos = pos_high,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t2; } v__ast__Expr expr = v__parser__Parser_expr(p, 0); @@ -92365,14 +92733,14 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos_low = v__token__Pos_extend(or_pos_low, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t3 = ((v__ast__IndexExpr){.pos = pos_low,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ - .has_high = has_high, - .has_low = has_low, - .pos = pos_low, - .is_gated = is_gated, + v__ast__IndexExpr _t3 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = v__ast__OrKind__block,.pos = or_pos_low,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ .low = expr, .high = high, - })))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = v__ast__OrKind__block,.pos = or_pos_low,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + .pos = pos_low, + .has_high = has_high, + .has_low = has_low, + .is_gated = is_gated, + })))),.left = left,.pos = pos_low,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t3; } if (p->tok.kind == v__token__Kind__question) { @@ -92381,14 +92749,14 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t4 = ((v__ast__IndexExpr){.pos = pos_low,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ - .has_high = has_high, - .has_low = has_low, - .pos = pos_low, - .is_gated = is_gated, + v__ast__IndexExpr _t4 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = or_kind_low,.pos = or_pos_low,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ .low = expr, .high = high, - })))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = or_kind_low,.pos = or_pos_low,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + .pos = pos_low, + .has_high = has_high, + .has_low = has_low, + .is_gated = is_gated, + })))),.left = left,.pos = pos_low,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t4; } v__token__Pos pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->tok)); @@ -92407,7 +92775,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t5 = ((v__ast__IndexExpr){.pos = pos,.index = expr,.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = v__ast__OrKind__block,.pos = or_pos,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t5 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = v__ast__OrKind__block,.pos = or_pos,}),.index = expr,.left = left,.pos = pos,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t5; } if (p->tok.kind == v__token__Kind__question) { @@ -92416,17 +92784,17 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t6 = ((v__ast__IndexExpr){.pos = pos,.index = expr,.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t6 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.index = expr,.left = left,.pos = pos,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t6; } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_it(v__parser__Parser* p) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_ab(v__parser__Parser* p) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("a"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("b"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("a"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("b"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v__ast__Expr left) { @@ -92482,7 +92850,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -92501,33 +92869,33 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ v__token__Pos pos = v__token__Pos_extend(name_pos, end_pos); Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); v__ast__CallExpr mcall_expr = ((v__ast__CallExpr){ - .pos = pos, - .name_pos = name_pos, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .args = args, + .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), + .concrete_types = concrete_types, + .raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .comments = comments, .mod = (string){.str=(byteptr)"", .is_lit=1}, .name = field_name, + .left = left, + .scope = p->scope, + .pos = pos, + .name_pos = name_pos, + .concrete_list_pos = concrete_list_pos, + .left_type = 0, + .receiver_type = 0, + .return_type = 0, + .fn_var_type = 0, + .language = 0, .is_method = true, .is_field = 0, .is_fn_var = 0, .is_keep_alive = 0, .is_noreturn = 0, .is_ctor_new = 0, - .args = args, - .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), - .language = 0, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), - .left = left, - .left_type = 0, - .receiver_type = 0, - .return_type = 0, - .fn_var_type = 0, .should_be_skipped = 0, - .concrete_types = concrete_types, - .concrete_list_pos = concrete_list_pos, - .raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), .free_receiver = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), - .comments = comments, }); if (is_filter || string__eq(field_name, _SLIT("sort"))) { v__parser__Parser_close_scope(p); @@ -92553,18 +92921,18 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ } v__token__Pos pos = (p->name_error ? (v__token__Pos_extend(v__ast__Expr_pos(left), name_pos)) : (name_pos)); v__ast__SelectorExpr sel_expr = ((v__ast__SelectorExpr){ - .pos = pos, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = field_name, - .is_mut = is_mut, - .mut_pos = mut_pos, - .next_token = p->tok.kind, .expr = left, + .scope = p->scope, + .pos = pos, + .mut_pos = mut_pos, .expr_type = 0, .typ = 0, .name_type = 0, + .next_token = p->tok.kind, .gkind_field = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = is_mut, }); if (is_filter) { v__parser__Parser_close_scope(p); @@ -92607,7 +92975,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Type_Array_string v__parser__Parser_p array_push((array*)¶m_names, _MOV((string[]){ string_clone(name) })); int idx = v__ast__Table_find_type_idx(p->table, name); if (idx == 0) { - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = true,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = true,})); } array_push((array*)&types, _MOV((v__ast__Type[]){ v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic) })); first_done = true; @@ -92682,7 +93050,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_string_expr(v__parser__Parser* p) if (p->peek_tok.kind != v__token__Kind__str_dollar) { v__parser__Parser_next(p); v__parser__Parser_filter_string_vet_errors(p, pos); - node = v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = val,.is_raw = is_raw,.language = (is_cstr ? (v__ast__Language__c) : (v__ast__Language__v)),.pos = pos,})))); + node = v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = val,.pos = pos,.language = (is_cstr ? (v__ast__Language__c) : (v__ast__Language__v)),.is_raw = is_raw,})))); v__ast__Expr _t1 = node; return _t1; } @@ -93028,7 +93396,7 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (is_block && p->tok.kind == v__token__Kind__eof) { v__parser__Parser_error(p, _SLIT("unexpected eof, expecting \302\264)\302\264")); - v__ast__ConstDecl _t2 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t2 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t2; } if (p->tok.kind == v__token__Kind__rpar) { @@ -93045,12 +93413,12 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser _PUSH_MANY(&end_comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t4, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__key_fn) { v__parser__Parser_error(p, _SLIT("const initializer fn literal is not a constant")); - v__ast__ConstDecl _t5 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t5 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t5; } if (p->tok.kind == v__token__Kind__eof) { v__parser__Parser_error(p, _SLIT("unexpected eof, expecting an expression")); - v__ast__ConstDecl _t6 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t6 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t6; } v__ast__Expr expr = v__parser__Parser_expr(p, 0); @@ -93080,11 +93448,11 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,}))), _t8, Array_v__ast__Comment); } v__ast__ConstDecl _t9 = ((v__ast__ConstDecl){ - .is_pub = is_pub, - .pos = v__token__Pos_extend_with_last_line(start_pos, const_pos, p->prev_tok.line_nr), .attrs = attrs, .fields = fields, .end_comments = comments, + .pos = v__token__Pos_extend_with_last_line(start_pos, const_pos, p->prev_tok.line_nr), + .is_pub = is_pub, .is_block = is_block, }); return _t9; @@ -93098,9 +93466,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_84411 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_84411.arg0; - Array_v__ast__Comment comments2 = mr_84411.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_84736 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_84736.arg0; + Array_v__ast__Comment comments2 = mr_84736.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)),}); @@ -93204,15 +93572,15 @@ VV_LOCAL_SYMBOL v__ast__GlobalDecl v__parser__Parser_global_decl(v__parser__Pars typ = v__parser__Parser_parse_type(p); } v__ast__GlobalField field = ((v__ast__GlobalField){ + .comments = comments, .name = name, - .has_expr = has_expr, + .expr = expr, .pos = pos, .typ_pos = typ_pos, + .typ = typ, + .has_expr = has_expr, .is_markused = is_markused, .is_volatile = is_volatile, - .expr = expr, - .typ = typ, - .comments = comments, }); array_push((array*)&fields, _MOV((v__ast__GlobalField[]){ field })); v__ast__Scope_register(p->table->global_scope, v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(&field)); @@ -93247,12 +93615,12 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* string enum_name = v__parser__Parser_check_name(p); if (enum_name.len == 1) { v__parser__Parser_error_with_pos(p, _SLIT("single letter capital names are reserved for generic template types."), end_pos); - v__ast__EnumDecl _t1 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t1 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t1; } if (_IN_MAP(ADDR(string, enum_name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register enum `"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), end_pos); - v__ast__EnumDecl _t2 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t2 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t2; } string name = v__parser__Parser_prepend_mod(p, enum_name); @@ -93260,6 +93628,7 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* Array_v__ast__Comment enum_decl_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); Array_string vals = __new_array_with_default(0, 0, sizeof(string), 0); Array_v__ast__EnumField fields = __new_array_with_default(0, 0, sizeof(v__ast__EnumField), 0); + bool uses_exprs = false; for (;;) { if (!(p->tok.kind != v__token__Kind__eof && p->tok.kind != v__token__Kind__rcbr)) break; v__token__Pos pos = v__token__Token_pos(&p->tok); @@ -93271,6 +93640,7 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* v__parser__Parser_next(p); expr = v__parser__Parser_expr(p, 0); has_expr = true; + uses_exprs = true; } array_push((array*)&fields, _MOV((v__ast__EnumField[]){ ((v__ast__EnumField){ .name = val, @@ -93288,14 +93658,14 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* if (is_flag) { if (fields.len > 32) { v__parser__Parser_error(p, _SLIT("when an enum is used as bit field, it must have a max of 32 fields")); - v__ast__EnumDecl _t5 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t5 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t5; } for (int _t6 = 0; _t6 < fields.len; ++_t6) { v__ast__EnumField f = ((v__ast__EnumField*)fields.data)[_t6]; if (f.has_expr) { v__parser__Parser_error_with_pos(p, _SLIT("when an enum is used as a bit field, you can not assign custom values"), f.pos); - v__ast__EnumDecl _t7 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t7 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t7; } } @@ -93303,29 +93673,31 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* v__parser__Parser_codegen(p, str_intp(21, _MOV((StrIntpData[]){{_SLIT("\n//\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") is_empty() bool { return int(*e) == 0 }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") has(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") bool { return (int(*e) & (int(flag))) != 0 }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") all(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") bool { return (int(*e) & (int(flag))) == int(flag) }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") set(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) | (int(flag))) } }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") clear(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) & ~(int(flag))) } }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") toggle(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) ^ (int(flag))) } }\n//\n"), 0, { .d_c = 0 }}}))); } int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__Enum_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Enum, (((v__ast__Enum){.vals = vals,.is_flag = is_flag,.is_multi_allowed = is_multi_allowed,})))), - .kind = v__ast__Kind__enum_, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__Enum_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Enum, (((v__ast__Enum){.vals = vals,.is_flag = is_flag,.is_multi_allowed = is_multi_allowed,.uses_exprs = uses_exprs,})))), .name = name, .cname = v__util__no_dots(name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__enum_, + .language = 0, + .is_pub = is_pub, })); if (idx == -1) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register enum `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), end_pos); } v__ast__EnumDecl enum_decl = ((v__ast__EnumDecl){ - .name = name, - .is_pub = is_pub, - .is_flag = is_flag, - .is_multi_allowed = is_multi_allowed, .comments = enum_decl_comments, .fields = fields, .attrs = p->attrs, + .name = name, .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), + .is_pub = is_pub, + .is_flag = is_flag, + .is_multi_allowed = is_multi_allowed, }); v__ast__Table_register_enum_decl(p->table, enum_decl); v__ast__EnumDecl _t8 = enum_decl; @@ -93354,8 +93726,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t2; } 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_90608 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_90608.arg0; + multi_return_Array_v__ast__Type_Array_string mr_91005 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_91005.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); @@ -93403,16 +93775,18 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* Array_v__ast__Type variant_types =_t7; string prepend_mod_name = v__parser__Parser_prepend_mod(p, name); int typ = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = 0,.is_generic = generic_types.len > 0,.variants = variant_types,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))), - .kind = v__ast__Kind__sum_type, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = variant_types,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = 0,.is_generic = generic_types.len > 0,})))), .name = prepend_mod_name, .cname = v__util__no_dots(prepend_mod_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__sum_type, + .language = 0, + .is_pub = is_pub, })); if (typ == _const_v__ast__invalid_type_idx) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register sum type `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); @@ -93443,16 +93817,18 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* v__parser__Parser_check_for_impure_v(p, parent_sym->language, decl_pos); string prepend_mod_name = v__parser__Parser_prepend_mod(p, name); int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = pidx, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = v__ast__Alias_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Alias, (((v__ast__Alias){.parent_type = parent_type,.language = parent_sym->language,.is_import = 0,})))), - .kind = v__ast__Kind__alias, .name = prepend_mod_name, .cname = v__util__no_dots(prepend_mod_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = pidx, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__alias, + .language = 0, + .is_pub = is_pub, })); v__token__Pos type_end_pos = v__token__Token_pos(&p->prev_tok); if (idx == _const_v__ast__invalid_type_idx) { @@ -93485,7 +93861,7 @@ VV_LOCAL_SYMBOL v__ast__Assoc v__parser__Parser_assoc(v__parser__Parser* p) { if (_t1.state != 0) { /*or block*/ IError err = _t1.err; v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown variable `"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); - v__ast__Assoc _t2 = ((v__ast__Assoc){.var_name = (string){.str=(byteptr)"", .is_lit=1},.fields = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.typ = 0,.scope = 0,}); + v__ast__Assoc _t2 = ((v__ast__Assoc){.fields = __new_array(0, 0, sizeof(string)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.var_name = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,}); return _t2; } @@ -93507,7 +93883,7 @@ VV_LOCAL_SYMBOL v__ast__Assoc v__parser__Parser_assoc(v__parser__Parser* p) { break; } } - v__ast__Assoc _t5 = ((v__ast__Assoc){.var_name = var_name,.fields = fields,.pos = pos,.exprs = vals,.typ = 0,.scope = p->scope,}); + v__ast__Assoc _t5 = ((v__ast__Assoc){.fields = fields,.exprs = vals,.var_name = var_name,.scope = p->scope,.pos = pos,.typ = 0,}); return _t5; } @@ -93550,7 +93926,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_top_level_statement_end(v__parser__Parser VV_LOCAL_SYMBOL void v__parser__Parser_rewind_scanner_to_current_token_in_new_mode(v__parser__Parser* p) { int tidx = p->tok.tidx; v__scanner__Scanner_set_current_tidx(p->scanner, tidx - 5); - v__token__Token no_token = ((v__token__Token){.kind = 0,.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,}); + v__token__Token no_token = ((v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,.kind = 0,}); p->prev_tok = no_token; p->tok = no_token; p->peek_tok = no_token; @@ -93946,7 +94322,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; string name = v__parser__Parser_check_name(p); if (name.len == 1 && u8_is_capital(string_at(name, 0))) { v__parser__Parser_error_with_pos(p, _SLIT("single letter capital names are reserved for generic template types."), name_pos); - v__ast__StructDecl _t1 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t1 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); return _t1; } if (string__eq(name, _SLIT("IError")) && !string__eq(p->mod, _SLIT("builtin"))) { @@ -93959,7 +94335,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; bool no_body = p->tok.kind != v__token__Kind__lcbr; if (language == v__ast__Language__v && no_body) { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = p->tok.lit}}, {_SLIT("` lacks body"), 0, { .d_c = 0 }}}))); - v__ast__StructDecl _t2 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t2 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -93969,7 +94345,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (language == v__ast__Language__v && !p->builtin_mod && !p->is_translated && name.len > 0 && !u8_is_capital(string_at(name, 0)) && !p->pref->translated && !p->is_translated) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct name `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` must begin with capital letter"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t3 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t3 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -93979,7 +94355,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (name.len == 1) { v__parser__Parser_error_with_pos(p, _SLIT("struct names must have more than one character"), name_pos); - v__ast__StructDecl _t4 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t4 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -93989,7 +94365,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t5 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t5 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94024,6 +94400,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; Array_v__ast__Comment end_comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); if (!no_body) { v__parser__Parser_check(p, v__token__Kind__lcbr); + int i = 0; for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr)) break; Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); @@ -94043,7 +94420,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; if (p->tok.kind == v__token__Kind__key_mut) { if (pub_mut_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `pub mut` section")); - v__ast__StructDecl _t7 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t7 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94059,7 +94436,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else { if (pub_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `pub` section")); - v__ast__StructDecl _t8 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t8 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94076,7 +94453,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_mut) { if (mut_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `mut` section")); - v__ast__StructDecl _t9 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t9 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94093,7 +94470,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_global) { if (global_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `global` section")); - v__ast__StructDecl _t10 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t10 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94110,7 +94487,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_module) { if (module_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `module` section")); - v__ast__StructDecl _t11 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t11 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94151,7 +94528,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; type_pos = v__token__Pos_extend(type_pos, v__token__Token_pos(&p->prev_tok)); if (!is_on_top) { v__parser__Parser_error_with_pos(p, _SLIT("struct embedding must be declared at the beginning of the struct body"), type_pos); - v__ast__StructDecl _t14 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t14 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94162,7 +94539,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); if (Array_v__ast__Type_contains(embed_types, typ)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot embed `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` more than once"), 0, { .d_c = 0 }}})), type_pos); - v__ast__StructDecl _t15 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t15 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94173,7 +94550,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; field_name = v__ast__TypeSymbol_embed_name(sym); if (Array_string_contains(embed_field_names, field_name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), type_pos); - v__ast__StructDecl _t16 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t16 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94197,7 +94574,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; typ = v__parser__Parser_parse_type(p); p->inside_struct_field_decl = false; if (v__ast__Type_idx(typ) == 0) { - v__ast__StructDecl _t21 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t21 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94229,70 +94606,77 @@ bool v__parser__Parser_struct_decl_defer_0 = false; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t23, Array_v__ast__Comment); } array_push((array*)&ast_fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = p->attrs, + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = default_expr, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = i, + .default_expr_typ = 0, + .typ = typ, .has_default_expr = has_default_expr, - .attrs = p->attrs, .is_pub = is_embed || is_field_pub, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, - .default_expr = default_expr, - .default_expr_typ = 0, - .name = field_name, - .typ = typ, }) })); } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = p->attrs, + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = default_expr, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = i, + .default_expr_typ = 0, + .typ = typ, .has_default_expr = has_default_expr, - .attrs = p->attrs, .is_pub = is_embed || is_field_pub, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, - .default_expr = default_expr, - .default_expr_typ = 0, - .name = field_name, - .typ = typ, }) })); p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); + i++; } v__parser__Parser_top_level_statement_end(p); last_line = p->tok.line_nr; v__parser__Parser_check(p, v__token__Kind__rcbr); } + bool is_minify = Array_v__ast__Attr_contains(attrs, _SLIT("minify")); v__ast__TypeSymbol t = ((v__ast__TypeSymbol){ - .parent_idx = 0, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){ .attrs = attrs, .embeds = embed_types, .fields = fields, - .is_typedef = Array_v__ast__Attr_contains(attrs, _SLIT("typedef")), - .is_union = is_union, - .is_heap = Array_v__ast__Attr_contains(attrs, _SLIT("heap")), - .is_generic = generic_types.len > 0, .generic_types = generic_types, .concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), .parent_type = 0, + .is_typedef = Array_v__ast__Attr_contains(attrs, _SLIT("typedef")), + .is_union = is_union, + .is_heap = Array_v__ast__Attr_contains(attrs, _SLIT("heap")), + .is_minify = is_minify, + .is_generic = generic_types.len > 0, })))), - .kind = v__ast__Kind__struct_, .name = name, .cname = v__util__no_dots(name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = language, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__struct_, + .language = language, + .is_pub = is_pub, }); if (v__ast__Table_has_deep_child_no_ref(p->table, &t, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid recursive struct `"), /*115 &string*/0xfe10, {.d_s = orig_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t26 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t26 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94304,7 +94688,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; ret = v__ast__Table_register_sym(p->table, t); if (ret == -1 && language != v__ast__Language__c) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t27 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t27 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -94314,21 +94698,21 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } p->expr_mod = _SLIT(""); v__ast__StructDecl _t28 = ((v__ast__StructDecl){ - .pos = v__token__Pos_extend_with_last_line(start_pos, name_pos, last_line), - .name = name, .generic_types = generic_types, - .is_pub = is_pub, + .attrs = attrs, + .end_comments = end_comments, + .embeds = embeds, + .fields = ast_fields, + .name = name, + .pos = v__token__Pos_extend_with_last_line(start_pos, name_pos, last_line), .mut_pos = mut_pos, .pub_pos = pub_pos, .pub_mut_pos = pub_mut_pos, .global_pos = global_pos, .module_pos = module_pos, .language = language, + .is_pub = is_pub, .is_union = is_union, - .attrs = attrs, - .end_comments = end_comments, - .embeds = embeds, - .fields = ast_fields, }); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { @@ -94409,22 +94793,22 @@ VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Pars } p->is_amp = saved_is_amp; v__ast__StructInit _t5 = ((v__ast__StructInit){ - .pos = v__token__Pos_extend(first_pos, (short_syntax ? (v__token__Token_pos(&p->tok)) : (v__token__Token_pos(&p->prev_tok)))), - .name_pos = first_pos, - .is_short = no_keys, - .is_short_syntax = short_syntax, - .unresolved = v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic), .pre_comments = pre_comments, - .typ_str = typ_str, - .typ = typ, - .update_expr = update_expr, - .update_expr_type = 0, .update_expr_comments = update_expr_comments, - .is_update_embed = 0, - .has_update_expr = has_update_expr, .fields = fields, .embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)), .generic_types = p->struct_init_generic_types, + .typ_str = typ_str, + .update_expr = update_expr, + .pos = v__token__Pos_extend(first_pos, (short_syntax ? (v__token__Token_pos(&p->tok)) : (v__token__Token_pos(&p->prev_tok)))), + .name_pos = first_pos, + .typ = typ, + .update_expr_type = 0, + .is_short = no_keys, + .is_short_syntax = short_syntax, + .unresolved = v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic), + .is_update_embed = 0, + .has_update_expr = has_update_expr, }); return _t5; } @@ -94455,30 +94839,32 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13010 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13010.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13116 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13116.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register interface `"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), name_pos); - v__ast__InterfaceDecl _t1 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t1 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t1; } int reg_idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){.types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.conversions = new_map(sizeof(int), sizeof(Array_v__ast__Type), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.is_generic = generic_types.len > 0,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))), - .kind = v__ast__Kind__interface_, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){.conversions = new_map(sizeof(int), sizeof(Array_v__ast__Type), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_generic = generic_types.len > 0,})))), .name = interface_name, .cname = v__util__no_dots(interface_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = language, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__interface_, + .language = language, + .is_pub = is_pub, })); if (reg_idx == -1) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register interface `"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); - v__ast__InterfaceDecl _t2 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t2 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t2; } v__ast__Type typ = v__ast__new_type(reg_idx); @@ -94487,9 +94873,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser ts->methods = __new_array_with_default(0, 20, sizeof(v__ast__Fn), 0); Array_v__ast__StructField fields = __new_array_with_default(0, 20, sizeof(v__ast__StructField), 0); Array_v__ast__FnDecl methods = __new_array_with_default(0, 20, sizeof(v__ast__FnDecl), 0); + Array_v__ast__InterfaceEmbedding embeds = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); bool is_mut = false; int mut_pos = -1; - Array_v__ast__InterfaceEmbedding ifaces = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr && p->tok.kind != v__token__Kind__eof)) break; if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.line_nr != p->tok.line_nr || !(p->peek_tok.kind == v__token__Kind__name || p->peek_tok.kind == v__token__Kind__amp || p->peek_tok.kind == v__token__Kind__lsbr || p->peek_tok.kind == v__token__Kind__lpar))) { @@ -94500,7 +94886,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser iface_name = v__ast__Table_sym(p->table, iface_type)->name; } Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); - array_push((array*)&ifaces, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = iface_name,.typ = iface_type,.pos = iface_pos,.comments = comments,}) })); + array_push((array*)&embeds, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = iface_name,.typ = iface_type,.pos = iface_pos,.comments = comments,}) })); if (p->tok.kind == v__token__Kind__rcbr) { break; } @@ -94519,7 +94905,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser break; } Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); - array_push((array*)&ifaces, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = from_mod_name,.typ = from_mod_typ,.pos = v__token__Token_pos(&p->prev_tok),.comments = comments,}) })); + array_push((array*)&embeds, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = from_mod_name,.typ = from_mod_typ,.pos = v__token__Token_pos(&p->prev_tok),.comments = comments,}) })); if (p->tok.kind == v__token__Kind__rcbr) { break; } @@ -94527,7 +94913,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser if (p->tok.kind == v__token__Kind__key_mut) { if (is_mut) { v__parser__Parser_error_with_pos(p, _SLIT("redefinition of `mut` section"), v__token__Token_pos(&p->tok)); - v__ast__InterfaceDecl _t5 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t5 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t5; } v__parser__Parser_next(p); @@ -94541,23 +94927,49 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser string name = v__parser__Parser_check_name(p); if (string__eq(name, _SLIT("type_name")) || string__eq(name, _SLIT("type_idx"))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot override built-in method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), method_start_pos); - v__ast__InterfaceDecl _t6 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t6 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t6; } if (v__ast__TypeSymbol_has_method(ts, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), method_start_pos); - v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t7; } - multi_return_Array_v__ast__Param_bool_bool mr_16146 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16146.arg0; - bool is_variadic = mr_16146.arg2; - Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = _SLIT("x"),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = true,.typ = typ,})})); + multi_return_Array_v__ast__Param_bool_bool mr_16252 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16252.arg0; + bool is_variadic = mr_16252.arg2; + Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t8, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = args, + .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = __new_array(0, 0, sizeof(string)), .name = name, .short_name = name, .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = v__token__Pos_extend(method_start_pos, v__token__Token_pos(&p->prev_tok)), + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = true, .is_variadic = is_variadic, @@ -94571,40 +94983,14 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = args, - .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = __new_array(0, 0, sizeof(string)), - .pos = v__token__Pos_extend(method_start_pos, v__token__Token_pos(&p->prev_tok)), }); if (v__token__Kind_is_start_of_type(p->tok.kind) && p->tok.line_nr == line_nr) { method.return_type_pos = v__token__Token_pos(&p->tok); @@ -94618,8 +95004,22 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser method.next_comments = mnext_comments; array_push((array*)&methods, _MOV((v__ast__FnDecl[]){ method })); v__ast__Fn tmethod = ((v__ast__Fn){ - .is_variadic = is_variadic, + .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 = name, + .pos = method.pos, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type = method.return_type, + .receiver_type = typ, + .usages = 0, + .ctdefine_idx = 0, + .source_fn = 0, .language = 0, + .file_mode = 0, + .is_variadic = is_variadic, .is_pub = true, .is_ctor_new = 0, .is_deprecated = 0, @@ -94631,21 +95031,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_keep_alive = 0, .is_method = true, .no_body = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, - .file = (string){.str=(byteptr)"", .is_lit=1}, - .file_mode = 0, - .pos = method.pos, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type = method.return_type, - .receiver_type = typ, - .name = name, - .params = args, - .source_fn = 0, - .usages = 0, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .is_conditional = 0, - .ctdefine_idx = 0, }); v__ast__TypeSymbol_register_method(ts, tmethod); array_push((array*)&info.methods, _MOV((v__ast__Fn[]){ tmethod })); @@ -94664,26 +95050,27 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = {0}, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = 0, + .default_expr_typ = 0, + .typ = field_typ, .has_default_expr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .is_pub = true, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = 0, .is_global = 0, .is_volatile = 0, - .default_expr = {0}, - .default_expr_typ = 0, - .name = field_name, - .typ = field_typ, }) })); - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = true,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = field_name,.typ = field_typ,}) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,}) })); } } Array_v__ast__Type _t14 = {0}; - Array_v__ast__InterfaceEmbedding _t14_orig = ifaces; + Array_v__ast__InterfaceEmbedding _t14_orig = embeds; int _t14_len = _t14_orig.len; _t14 = __new_array(0, _t14_len, sizeof(v__ast__Type)); @@ -94698,20 +95085,20 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__parser__Parser_check(p, v__token__Kind__rcbr); pos = v__token__Pos_extend_with_last_line(pos, v__token__Token_pos(&p->prev_tok), p->prev_tok.line_nr); v__ast__InterfaceDecl res = ((v__ast__InterfaceDecl){ - .name = interface_name, - .typ = typ, - .name_pos = name_pos, - .language = language, .field_names = __new_array(0, 0, sizeof(string)), - .is_pub = is_pub, - .mut_pos = mut_pos, - .pos = pos, .pre_comments = pre_comments, .generic_types = generic_types, .attrs = attrs, .methods = methods, .fields = fields, - .embeds = ifaces, + .embeds = embeds, + .name = interface_name, + .name_pos = name_pos, + .pos = pos, + .typ = typ, + .mut_pos = mut_pos, + .language = language, + .is_pub = is_pub, .are_embeds_expanded = 0, }); v__ast__Table_register_interface(p->table, res); @@ -94836,7 +95223,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t3.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@footer"))) { @@ -94847,7 +95234,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t4.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@include "))) { @@ -94878,7 +95265,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t6.data) + 9; - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), /*115 &string*/0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), /*115 &string*/0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); *(string*) _t5.data = _SLIT(""); } @@ -95664,7 +96051,7 @@ v__errors__Error v__builder__Builder_error_with_pos(v__builder__Builder* b, stri _v_exit(1); VUNREACHABLE(); } - v__errors__Error _t1 = ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = fpath,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__builder,}); + v__errors__Error _t1 = ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = fpath,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__builder,}); return _t1; } @@ -96303,12 +96690,6 @@ void v__builder__Builder_cc(v__builder__Builder* v) { break; } if (v->pref->compress) { - #if defined(_WIN32) - { - println(_SLIT("-compress does not work on Windows for now")); - return; - } - #endif int ret = os__system( str_intp(2, _MOV((StrIntpData[]){{_SLIT("strip "), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (ret != 0) { println(_SLIT("strip failed")); @@ -96330,6 +96711,11 @@ void v__builder__Builder_cc(v__builder__Builder* v) { println(string__plus(_SLIT("install upx\n"), _SLIT("for example, on Debian/Ubuntu run `sudo apt install upx`"))); } #endif + #if defined(_WIN32) + { + println(_SLIT("install upx")); + } + #endif } } } @@ -96384,10 +96770,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_22763 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_22763.arg0; - Array_string others = mr_22763.arg1; - Array_string libs = mr_22763.arg2; + multi_return_Array_string_Array_string_Array_string mr_22693 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_22693.arg0; + Array_string others = mr_22693.arg1; + Array_string libs = mr_22693.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")) })); @@ -98866,16 +99252,18 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__riscv_no_number_register_list = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("zero"), _SLIT("ra"), _SLIT("sp"), _SLIT("gp"), _SLIT("tp")})); _const_v__ast__riscv_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), _MOV((string[4]){_SLIT("x#"), _SLIT("t#"), _SLIT("s#"), _SLIT("a#"), }), _MOV((int[4]){32, 3, 12, 8, })); _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__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.parent_idx = _const_v__ast__invalid_type_idx, + _const_v__ast__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0}, - .kind = v__ast__Kind__placeholder, .name = _SLIT("InvalidType"), .cname = _SLIT("InvalidType"), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = _SLIT("builtin"), - .is_pub = 0, - .language = v__ast__Language__v, + .parent_idx = _const_v__ast__invalid_type_idx, .idx = _const_v__ast__invalid_type_idx, + .size = -1, + .align = -1, + .kind = v__ast__Kind__placeholder, + .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"), @@ -98971,8 +99359,8 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), _SLIT("Option"), 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#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 #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); - _const_v__gen__c__c_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#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_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_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 : diff --git a/v_win.c b/v_win.c index 997d8ed..827c729 100644 --- a/v_win.c +++ b/v_win.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "3baf1741b" +#define V_COMMIT_HASH "41857b0ac" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "91a9137b3" + #define V_COMMIT_HASH "3baf1741b" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "3baf174" + #define V_CURRENT_COMMIT_HASH "41857b0" #endif // V comptime_definitions: @@ -677,6 +677,10 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in #undef VWEAK #define VWEAK #endif + #if defined(__MINGW32__) || defined(__MINGW64__) + #undef VWEAK + #define VWEAK + #endif #endif #if !defined(VNORETURN) @@ -734,11 +738,6 @@ typedef int (*qsort_callback_func)(const void*, const void*); #if defined __has_include #if __has_include () #include - #else - // Most probably musl OR __ANDROID__ ... - int backtrace (void **__array, int __size) { return 0; } - char **backtrace_symbols (void *const *__array, int __size){ return 0; } - void backtrace_symbols_fd (void *const *__array, int __size, int __fd){} #endif #endif #endif @@ -2172,6 +2171,12 @@ typedef enum { v__ast__Kind__thread, // +38 } v__ast__Kind; +typedef enum { + v__checker__ComptimeBranchSkipState__eval, // + v__checker__ComptimeBranchSkipState__skip, // +1 + v__checker__ComptimeBranchSkipState__unknown, // +2 +} v__checker__ComptimeBranchSkipState; + typedef enum { v__gen__c__StrIntpType__si_no_str = 0, // 0 v__gen__c__StrIntpType__si_c, // 0+1 @@ -3449,37 +3454,37 @@ struct v__builder__MsvcResult { struct v__ast__Table { - string parsing_type; - Array_v__ast__TypeSymbol_ptr type_symbols; Map_string_int type_idxs; Map_string_v__ast__Fn fns; Map_string_Array_v__ast__Type iface_types; Map_int_string dumps; - Array_string imports; - Array_string modules; - v__ast__Scope* global_scope; - Array_v__cflag__CFlag cflags; - Array_string redefined_fns; Map_string_Array_Array_v__ast__Type fn_generic_types; Map_int_v__ast__InterfaceDecl interfaces; - string cmod_prefix; - bool is_fmt; Map_string_bool used_fns; Map_string_bool used_consts; Map_string_bool used_globals; - Array_v__ast__Type used_vweb_types; - int used_maps; - v__ast__FnPanicHandler panic_handler; - voidptr panic_userdata; - int panic_npanics; - v__ast__FnDecl* cur_fn; - Array_v__ast__Type cur_concrete_types; - int gostmts; Map_string_v__ast__EnumDecl enum_decls; Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + Array_v__ast__TypeSymbol_ptr type_symbols; + Array_string imports; + Array_string modules; + Array_v__cflag__CFlag cflags; + Array_string redefined_fns; + Array_v__ast__Type used_vweb_types; + Array_v__ast__Type cur_concrete_types; + string parsing_type; + string cmod_prefix; + v__ast__Scope* global_scope; + v__ast__FnDecl* cur_fn; + int used_maps; + int panic_npanics; + int gostmts; int pointer_size; + v__ast__FnPanicHandler panic_handler; + voidptr panic_userdata; + bool is_fmt; }; @@ -3560,13 +3565,13 @@ struct v__token__WIndex { typedef Array_v__token__WIndex Array_fixed_Array_v__token__WIndex_20 [20]; struct v__token__Token { - v__token__Kind kind; string lit; int line_nr; int col; int pos; int len; int tidx; + v__token__Kind kind; }; @@ -3699,12 +3704,12 @@ struct v__ast__Scope { struct v__ast__EmbeddedFile { + Array_u8 bytes; string rpath; string apath; string compression_type; - bool is_compressed; - Array_u8 bytes; int len; + bool is_compressed; }; @@ -3717,11 +3722,11 @@ struct v__ast__IdentFn { struct v__ast__IdentVar { v__ast__Type typ; + v__ast__ShareType share; bool is_mut; bool is_static; bool is_volatile; bool is_optional; - v__ast__ShareType share; }; @@ -3744,28 +3749,31 @@ struct v__ast__Struct { Array_v__ast__Attr attrs; Array_v__ast__Type embeds; Array_v__ast__StructField fields; - bool is_typedef; - bool is_union; - bool is_heap; - bool is_generic; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool is_typedef; + bool is_union; + bool is_heap; + bool is_minify; + bool is_generic; }; struct v__ast__TypeSymbol { - int parent_idx; + Array_v__ast__Fn methods; v__ast__TypeInfo info; - v__ast__Kind kind; string name; string cname; - Array_v__ast__Fn methods; string mod; - bool is_pub; - v__ast__Language language; + int parent_idx; int idx; + int size; + int align; + v__ast__Kind kind; + v__ast__Language language; + bool is_pub; }; @@ -3793,35 +3801,35 @@ struct v__ast__Alias { struct v__ast__Interface { + Map_int_Array_v__ast__Type conversions; Array_v__ast__Type types; Array_v__ast__StructField fields; Array_v__ast__Fn methods; Array_v__ast__Type embeds; - Map_int_Array_v__ast__Type conversions; - bool is_generic; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool is_generic; }; struct v__ast__SumType { Array_v__ast__StructField fields; - bool found_fields; - bool is_anon; - bool is_generic; Array_v__ast__Type variants; Array_v__ast__Type generic_types; Array_v__ast__Type concrete_types; v__ast__Type parent_type; + bool found_fields; + bool is_anon; + bool is_generic; }; struct v__ast__ArrayFixed { - int size; v__ast__Expr size_expr; + int size; v__ast__Type elem_type; }; @@ -3857,6 +3865,7 @@ struct v__ast__Enum { Array_string vals; bool is_flag; bool is_multi_allowed; + bool uses_exprs; }; @@ -3886,39 +3895,39 @@ struct v__transformer__IndexState { struct v__scanner__Scanner { - string file_path; - string file_base; - string text; - int pos; - int line_nr; - int last_nl_pos; - bool is_crlf; - bool is_inside_string; - bool is_inter_start; - bool is_inter_end; - bool is_enclosed_inter; - string line_comment; - int last_lt; - bool is_started; - bool is_print_line_on_error; - bool is_print_colored_error; - bool is_print_rel_paths_on_error; - u8 quote; - u8 inter_quote; - int nr_lines; - bool is_vh; - bool is_fmt; - v__scanner__CommentsMode comments_mode; - bool is_inside_toplvl_statement; Array_v__token__Token all_tokens; - int tidx; - int eofs; - v__pref__Preferences* pref; Array_string error_details; Array_v__errors__Error errors; Array_v__errors__Warning warnings; Array_v__errors__Notice notices; Array_v__vet__Error vet_errors; + string file_path; + string file_base; + string text; + string line_comment; + v__pref__Preferences* pref; + int pos; + int line_nr; + int last_nl_pos; + int last_lt; + int nr_lines; + int tidx; + int eofs; + u8 quote; + u8 inter_quote; + v__scanner__CommentsMode comments_mode; + bool is_crlf; + bool is_inside_string; + bool is_inter_start; + bool is_inter_end; + bool is_enclosed_inter; + bool is_started; + bool is_print_line_on_error; + bool is_print_colored_error; + bool is_print_rel_paths_on_error; + bool is_vh; + bool is_fmt; + bool is_inside_toplvl_statement; bool should_abort; }; @@ -4283,12 +4292,43 @@ struct os__WProcess { struct v__pref__Preferences { + v__vcache__CacheManager cache_manager; + Array_string profile_fns; + Array_string lookup_path; + Array_string run_only; + Array_string compile_defines; + Array_string compile_defines_all; + Array_string run_args; + Array_string printfn_list; + Array_string cleanup_files; + Array_string build_options; + string test_runner; + string profile_file; + string dump_c_flags; + string cflags; + string ccompiler; + string third_party_option; + string bare_builtin_dir; + string custom_prelude; + string vroot; + string out_name_c; + string out_name; + string path; + int message_limit; + int checker_match_exhaustive_cutoff_limit; + int thread_stack_size; v__pref__OS os; - v__pref__Backend backend; - v__pref__BuildMode build_mode; v__pref__Arch arch; + v__pref__Backend backend; + v__pref__CompilerType ccompiler_type; + v__pref__GarbageCollectionMode gc_mode; + v__pref__ColorOutput use_color; + v__pref__AssertFailureMode assert_failure_mode; + v__pref__BuildMode build_mode; v__pref__OutputMode output_mode; bool is_verbose; + bool is_glibc; + bool is_musl; bool is_test; bool is_script; bool is_vsh; @@ -4297,17 +4337,22 @@ struct v__pref__Preferences { bool is_shared; bool is_o; bool is_prof; - string test_runner; - string profile_file; - bool profile_no_inline; - Array_string profile_fns; - bool translated; bool is_prod; - bool obfuscate; bool is_repl; bool is_run; bool is_debug; bool is_vlines; + bool is_stats; + bool is_fmt; + bool is_vet; + bool is_vweb; + bool is_ios_simulator; + bool is_apk; + bool is_help; + bool is_cstrict; + bool profile_no_inline; + bool translated; + bool obfuscate; bool sanitize; bool sourcemap; bool sourcemap_inline; @@ -4316,39 +4361,19 @@ struct v__pref__Preferences { bool show_c_output; bool show_callgraph; bool show_depgraph; - string dump_c_flags; bool use_cache; bool retry_compilation; - bool is_stats; - string cflags; bool m64; - string ccompiler; - v__pref__CompilerType ccompiler_type; - string third_party_option; bool building_v; bool autofree; bool compress; bool no_builtin; bool enable_globals; - bool is_fmt; - bool is_vet; bool is_bare; - string bare_builtin_dir; bool no_preludes; - string custom_prelude; - Array_string lookup_path; bool output_cross_c; bool output_es5; bool prealloc; - string vroot; - string out_name_c; - string out_name; - string path; - Array_string run_only; - Array_string compile_defines; - Array_string compile_defines_all; - Array_string run_args; - Array_string printfn_list; bool print_v_files; bool skip_running; bool skip_warnings; @@ -4358,27 +4383,13 @@ struct v__pref__Preferences { bool reuse_tmpc; bool no_rsp; bool no_std; - v__pref__ColorOutput use_color; bool no_parallel; - bool is_vweb; bool only_check_syntax; bool check_only; bool experimental; bool skip_unused; bool show_timings; - bool is_ios_simulator; - bool is_apk; - Array_string cleanup_files; - Array_string build_options; - v__vcache__CacheManager cache_manager; - bool is_help; - v__pref__GarbageCollectionMode gc_mode; - bool is_cstrict; - v__pref__AssertFailureMode assert_failure_mode; - int message_limit; bool nofloat; - int checker_match_exhaustive_cutoff_limit; - int thread_stack_size; }; @@ -4412,8 +4423,8 @@ struct v__errors__Error { string message; string details; string file_path; - v__token__Pos pos; string backtrace; + v__token__Pos pos; v__errors__Reporter reporter; }; @@ -4500,25 +4511,25 @@ struct v__ast__ArrayDecompose { struct v__ast__ArrayInit { - v__token__Pos pos; - v__token__Pos elem_type_pos; Array_Array_v__ast__Comment ecmnts; Array_v__ast__Comment pre_cmnts; + Array_v__ast__Expr exprs; + Array_v__ast__Type expr_types; + string mod; + v__ast__Expr len_expr; + v__ast__Expr cap_expr; + v__ast__Expr default_expr; + v__token__Pos pos; + v__token__Pos elem_type_pos; + v__ast__Type elem_type; + v__ast__Type default_type; + v__ast__Type typ; bool is_fixed; bool has_val; - string mod; bool has_len; bool has_cap; bool has_default; bool has_it; - Array_v__ast__Expr exprs; - v__ast__Expr len_expr; - v__ast__Expr cap_expr; - v__ast__Expr default_expr; - Array_v__ast__Type expr_types; - v__ast__Type elem_type; - v__ast__Type default_type; - v__ast__Type typ; }; @@ -4533,12 +4544,12 @@ struct v__ast__AsCast { struct v__ast__Assoc { - string var_name; Array_string fields; - v__token__Pos pos; Array_v__ast__Expr exprs; - v__ast__Type typ; + string var_name; v__ast__Scope* scope; + v__token__Pos pos; + v__ast__Type typ; }; @@ -4561,12 +4572,12 @@ struct v__ast__BoolLiteral { struct v__ast__CastExpr { v__ast__Expr arg; - v__ast__Type typ; v__ast__Expr expr; string typname; + v__token__Pos pos; + v__ast__Type typ; v__ast__Type expr_type; bool has_arg; - v__token__Pos pos; }; @@ -4598,12 +4609,12 @@ struct v__ast__Comment { struct v__ast__ComptimeSelector { - bool has_parens; - v__token__Pos pos; v__ast__Expr left; - v__ast__Type left_type; v__ast__Expr field_expr; + v__token__Pos pos; + v__ast__Type left_type; v__ast__Type typ; + bool has_parens; }; @@ -4624,10 +4635,10 @@ struct v__ast__ConcatExpr { struct v__ast__DumpExpr { - v__token__Pos pos; v__ast__Expr expr; - v__ast__Type expr_type; string cname; + v__token__Pos pos; + v__ast__Type expr_type; }; @@ -4650,31 +4661,31 @@ struct v__ast__FloatLiteral { struct v__ast__Ident { - v__ast__Language language; - v__token__Kind tok_kind; - v__token__Pos pos; - v__token__Pos mut_pos; - bool comptime; - v__ast__Scope* scope; v__ast__ScopeObject obj; string mod; string name; - v__ast__IdentKind kind; v__ast__IdentInfo info; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos mut_pos; + v__token__Kind tok_kind; + v__ast__Language language; + v__ast__IdentKind kind; + bool comptime; bool is_mut; }; struct v__ast__IfExpr { - bool is_comptime; - v__token__Kind tok_kind; - v__token__Pos pos; Array_v__ast__Comment post_comments; - v__ast__Expr left; Array_v__ast__IfBranch branches; - bool is_expr; + v__ast__Expr left; + v__token__Pos pos; v__ast__Type typ; + v__token__Kind tok_kind; + bool is_comptime; + bool is_expr; bool has_else; }; @@ -4718,12 +4729,12 @@ struct v__ast__LockExpr { struct v__ast__MapInit { - v__token__Pos pos; Array_Array_v__ast__Comment comments; Array_v__ast__Comment pre_cmnts; Array_v__ast__Expr keys; Array_v__ast__Expr vals; Array_v__ast__Type val_types; + v__token__Pos pos; v__ast__Type typ; v__ast__Type key_type; v__ast__Type value_type; @@ -4732,15 +4743,15 @@ struct v__ast__MapInit { struct v__ast__MatchExpr { - v__token__Kind tok_kind; - v__token__Pos pos; Array_v__ast__Comment comments; - v__ast__Expr cond; Array_v__ast__MatchBranch branches; - bool is_expr; + v__ast__Expr cond; + v__token__Pos pos; v__ast__Type return_type; v__ast__Type cond_type; v__ast__Type expected_type; + v__token__Kind tok_kind; + bool is_expr; bool is_sum_type; }; @@ -4760,9 +4771,9 @@ struct v__ast__None { struct v__ast__OffsetOf { - v__ast__Type struct_type; string field; v__token__Pos pos; + v__ast__Type struct_type; }; @@ -4792,12 +4803,12 @@ struct v__ast__PostfixExpr { struct v__ast__RangeExpr { - bool has_high; - bool has_low; - v__token__Pos pos; - bool is_gated; v__ast__Expr low; v__ast__Expr high; + v__token__Pos pos; + bool has_high; + bool has_low; + bool is_gated; }; @@ -4813,18 +4824,18 @@ struct v__ast__SelectExpr { struct v__ast__SelectorExpr { - v__token__Pos pos; + Array_v__ast__Type from_embed_types; string field_name; - bool is_mut; - v__token__Pos mut_pos; - v__token__Kind next_token; v__ast__Expr expr; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos mut_pos; v__ast__Type expr_type; v__ast__Type typ; v__ast__Type name_type; + v__token__Kind next_token; v__ast__GenericKindField gkind_field; - v__ast__Scope* scope; - Array_v__ast__Type from_embed_types; + bool is_mut; }; @@ -4856,30 +4867,30 @@ struct v__ast__StringInterLiteral { struct v__ast__StringLiteral { string val; - bool is_raw; - v__ast__Language language; v__token__Pos pos; + v__ast__Language language; + bool is_raw; }; struct v__ast__StructInit { - v__token__Pos pos; - v__token__Pos name_pos; - bool is_short; - bool is_short_syntax; - bool unresolved; Array_v__ast__Comment pre_comments; - string typ_str; - v__ast__Type typ; - v__ast__Expr update_expr; - v__ast__Type update_expr_type; Array_v__ast__Comment update_expr_comments; - bool is_update_embed; - bool has_update_expr; Array_v__ast__StructInitField fields; Array_v__ast__StructInitEmbed embeds; Array_v__ast__Type generic_types; + string typ_str; + v__ast__Expr update_expr; + v__token__Pos pos; + v__token__Pos name_pos; + v__ast__Type typ; + v__ast__Type update_expr_type; + bool is_short; + bool is_short_syntax; + bool unresolved; + bool is_update_embed; + bool has_update_expr; }; @@ -4892,8 +4903,8 @@ struct v__ast__TypeNode { struct v__ast__TypeOf { - v__token__Pos pos; v__ast__Expr expr; + v__token__Pos pos; v__ast__Type expr_type; }; @@ -4907,39 +4918,39 @@ struct v__ast__UnsafeExpr { struct v__ast__AsmStmt { - v__pref__Arch arch; - bool is_basic; - bool is_volatile; - bool is_goto; Array_v__ast__AsmClobbered clobbered; - v__token__Pos pos; Array_v__ast__AsmTemplate templates; - v__ast__Scope* scope; Array_v__ast__AsmIO output; Array_v__ast__AsmIO input; Array_string global_labels; Array_string local_labels; + v__ast__Scope* scope; + v__token__Pos pos; + v__pref__Arch arch; + bool is_basic; + bool is_volatile; + bool is_goto; }; struct v__ast__AssertStmt { - v__token__Pos pos; v__ast__Expr expr; + v__token__Pos pos; bool is_used; }; struct v__ast__AssignStmt { - v__token__Kind op; - v__token__Pos pos; Array_v__ast__Comment comments; Array_v__ast__Comment end_comments; Array_v__ast__Expr right; Array_v__ast__Expr left; Array_v__ast__Type left_types; Array_v__ast__Type right_types; + v__token__Pos pos; + v__token__Kind op; bool is_static; bool is_volatile; bool is_simple; @@ -4957,9 +4968,9 @@ struct v__ast__Block { struct v__ast__BranchStmt { - v__token__Kind kind; string label; v__token__Pos pos; + v__token__Kind kind; }; @@ -4976,11 +4987,11 @@ struct v__ast__ComptimeFor { struct v__ast__ConstDecl { - bool is_pub; - v__token__Pos pos; Array_v__ast__Attr attrs; Array_v__ast__ConstField fields; Array_v__ast__Comment end_comments; + v__token__Pos pos; + bool is_pub; bool is_block; }; @@ -4988,9 +4999,9 @@ struct v__ast__ConstDecl { struct v__ast__DeferStmt { Array_v__ast__Stmt stmts; - v__token__Pos pos; Array_v__ast__Ident defer_vars; string ifdef; + v__token__Pos pos; int idx_in_fn; }; @@ -5003,14 +5014,14 @@ struct v__ast__EmptyStmt { struct v__ast__EnumDecl { - string name; - bool is_pub; - bool is_flag; - bool is_multi_allowed; Array_v__ast__Comment comments; Array_v__ast__EnumField fields; Array_v__ast__Attr attrs; + string name; v__token__Pos pos; + bool is_pub; + bool is_flag; + bool is_multi_allowed; }; @@ -5042,21 +5053,21 @@ struct v__ast__ForCStmt { struct v__ast__ForInStmt { + Array_v__ast__Stmt stmts; string key_var; string val_var; - bool is_range; v__ast__Expr high; - Array_v__ast__Stmt stmts; - v__token__Pos pos; - bool val_is_mut; v__ast__Expr cond; + string label; + v__ast__Scope* scope; + v__token__Pos pos; v__ast__Type key_type; v__ast__Type val_type; v__ast__Type cond_type; v__ast__Type high_type; v__ast__Kind kind; - string label; - v__ast__Scope* scope; + bool is_range; + bool val_is_mut; }; @@ -5125,20 +5136,20 @@ struct v__ast__Import { struct v__ast__InterfaceDecl { - string name; - v__ast__Type typ; - v__token__Pos name_pos; - v__ast__Language language; Array_string field_names; - bool is_pub; - int mut_pos; - v__token__Pos pos; Array_v__ast__Comment pre_comments; Array_v__ast__Type generic_types; Array_v__ast__Attr attrs; Array_v__ast__FnDecl methods; Array_v__ast__StructField fields; Array_v__ast__InterfaceEmbedding embeds; + string name; + v__token__Pos name_pos; + v__token__Pos pos; + v__ast__Type typ; + int mut_pos; + v__ast__Language language; + bool is_pub; bool are_embeds_expanded; }; @@ -5173,21 +5184,21 @@ struct v__ast__SqlStmt { struct v__ast__StructDecl { - v__token__Pos pos; - string name; Array_v__ast__Type generic_types; - bool is_pub; + Array_v__ast__Attr attrs; + Array_v__ast__Comment end_comments; + Array_v__ast__Embed embeds; + Array_v__ast__StructField fields; + string name; + v__token__Pos pos; int mut_pos; int pub_pos; int pub_mut_pos; int global_pos; int module_pos; v__ast__Language language; + bool is_pub; bool is_union; - Array_v__ast__Attr attrs; - Array_v__ast__Comment end_comments; - Array_v__ast__Embed embeds; - Array_v__ast__StructField fields; }; @@ -5208,32 +5219,32 @@ struct v__ast__ConstField { struct v__ast__GlobalField { + Array_v__ast__Comment comments; string name; - bool has_expr; + v__ast__Expr expr; v__token__Pos pos; v__token__Pos typ_pos; + v__ast__Type typ; + bool has_expr; bool is_markused; bool is_volatile; - v__ast__Expr expr; - v__ast__Type typ; - Array_v__ast__Comment comments; }; struct v__ast__Var { + Array_v__ast__Type smartcasts; string name; + v__ast__Expr expr; + v__token__Pos pos; + v__ast__Type typ; + v__ast__Type orig_type; v__ast__ShareType share; bool is_mut; bool is_autofree_tmp; bool is_arg; bool is_auto_deref; bool is_inherited; - v__ast__Expr expr; - v__ast__Type typ; - v__ast__Type orig_type; - Array_v__ast__Type smartcasts; - v__token__Pos pos; bool is_used; bool is_changed; bool is_or; @@ -5245,13 +5256,13 @@ struct v__ast__Var { struct v__ast__CallArg { - bool is_mut; - v__ast__ShareType share; Array_v__ast__Comment comments; v__ast__Expr expr; - v__ast__Type typ; - bool is_tmp_autofree; v__token__Pos pos; + v__ast__Type typ; + v__ast__ShareType share; + bool is_mut; + bool is_tmp_autofree; }; @@ -5293,32 +5304,33 @@ struct v__ast__MatchBranch { struct v__ast__Param { - v__token__Pos pos; string name; + v__token__Pos pos; + v__token__Pos type_pos; + v__ast__Type typ; bool is_mut; bool is_auto_rec; - v__token__Pos type_pos; bool is_hidden; - v__ast__Type typ; }; struct v__ast__StructField { + Array_v__ast__Comment comments; + Array_v__ast__Attr attrs; + string default_val; + v__ast__Expr default_expr; + string name; v__token__Pos pos; v__token__Pos type_pos; - Array_v__ast__Comment comments; + int i; + v__ast__Type default_expr_typ; + v__ast__Type typ; bool has_default_expr; - Array_v__ast__Attr attrs; bool is_pub; - string default_val; bool is_mut; bool is_global; bool is_volatile; - v__ast__Expr default_expr; - v__ast__Type default_expr_typ; - string name; - v__ast__Type typ; }; @@ -5339,12 +5351,12 @@ struct v__ast__StructInitField { struct v__ast__Attr { string name; - bool has_arg; string arg; - v__ast__AttrKind kind; v__ast__Expr ct_expr; - bool ct_opt; v__token__Pos pos; + v__ast__AttrKind kind; + bool has_arg; + bool ct_opt; bool ct_evaled; bool ct_skip; }; @@ -5388,11 +5400,11 @@ struct v__ast__ImportSymbol { struct v__ast__ScopeStructField { - v__ast__Type struct_type; + Array_v__ast__Type smartcasts; string name; v__token__Pos pos; + v__ast__Type struct_type; v__ast__Type typ; - Array_v__ast__Type smartcasts; v__ast__Type orig_type; }; @@ -5406,12 +5418,12 @@ struct v__ast__AsmClobbered { struct v__ast__AsmTemplate { - string name; - bool is_label; - bool is_directive; Array_v__ast__AsmArg args; Array_v__ast__Comment comments; + string name; v__token__Pos pos; + bool is_label; + bool is_directive; }; @@ -5462,8 +5474,22 @@ struct v__ast__IfGuardVar { struct v__ast__Fn { - bool is_variadic; + Array_v__ast__Param params; + Array_string generic_names; + Array_v__ast__Attr attrs; + string mod; + string file; + string name; + v__token__Pos pos; + v__token__Pos return_type_pos; + v__ast__Type return_type; + v__ast__Type receiver_type; + int usages; + int ctdefine_idx; + voidptr source_fn; v__ast__Language language; + v__ast__Language file_mode; + bool is_variadic; bool is_pub; bool is_ctor_new; bool is_deprecated; @@ -5475,41 +5501,48 @@ struct v__ast__Fn { bool is_keep_alive; bool is_method; bool no_body; - string mod; - string file; - v__ast__Language file_mode; - v__token__Pos pos; - v__token__Pos return_type_pos; - v__ast__Type return_type; - v__ast__Type receiver_type; - string name; - Array_v__ast__Param params; - voidptr source_fn; - int usages; - Array_string generic_names; - Array_v__ast__Attr attrs; bool is_conditional; - int ctdefine_idx; }; struct v__parser__Parser { - v__pref__Preferences* pref; + Map_string_string imports; + Map_string_string imported_symbols; + v__token__Token tok; + v__token__Token prev_tok; + v__token__Token peek_tok; + Array_v__ast__Attr attrs; + Array_v__ast__Import ast_imports; + Array_string used_imports; + Array_string auto_imports; + Array_v__errors__Error errors; + Array_v__errors__Warning warnings; + Array_v__errors__Notice notices; + Array_v__vet__Error vet_errors; + Array_string label_names; + Array_string global_labels; + Array_v__ast__Ident defer_vars; + Array_v__ast__Type struct_init_generic_types; + Array_v__ast__Comment if_cond_comments; string file_base; string file_name; string file_name_dir; string unique_prefix; - v__ast__Language file_backend_mode; + string mod; + string expr_mod; + string cur_fn_name; + string codegen_text; + v__pref__Preferences* pref; v__scanner__Scanner* scanner; - v__scanner__CommentsMode comments_mode; - v__token__Token tok; - v__token__Token prev_tok; - v__token__Token peek_tok; v__ast__Table* table; + v__ast__Scope* scope; + int expr_level; + int n_asm; + v__ast__Language file_backend_mode; v__ast__Language language; v__ast__Language fn_language; - int expr_level; + v__scanner__CommentsMode comments_mode; bool inside_vlib_file; bool inside_test_file; bool inside_if; @@ -5538,38 +5571,17 @@ struct v__parser__Parser { bool inside_struct_field_decl; bool or_is_handled; bool builtin_mod; - string mod; bool is_manualfree; bool has_globals; bool is_generated; bool is_translated; - Array_v__ast__Attr attrs; - string expr_mod; - v__ast__Scope* scope; - Map_string_string imports; - Array_v__ast__Import ast_imports; - Array_string used_imports; - Array_string auto_imports; - Map_string_string imported_symbols; bool is_amp; bool returns; bool is_stmt_ident; bool expecting_type; - Array_v__errors__Error errors; - Array_v__errors__Warning warnings; - Array_v__errors__Notice notices; - Array_v__vet__Error vet_errors; - string cur_fn_name; - Array_string label_names; bool name_error; - int n_asm; - Array_string global_labels; bool comptime_if_cond; - Array_v__ast__Ident defer_vars; bool should_abort; - string codegen_text; - Array_v__ast__Type struct_init_generic_types; - Array_v__ast__Comment if_cond_comments; }; @@ -5586,13 +5598,13 @@ struct v__parser__ReceiverParsingInfo { struct v__vet__Error { - v__vet__ErrorKind kind; string message; string details; string file_path; v__token__Pos pos; v__vet__FixKind fix; v__vet__ErrorType typ; + v__vet__ErrorKind kind; }; @@ -5727,9 +5739,35 @@ struct v__ast__File { struct v__ast__FnDecl { + v__ast__StructField receiver; + Array_string generic_names; + Array_v__ast__Attr attrs; + Array_v__ast__Param params; + Array_v__ast__Stmt stmts; + Array_v__ast__DeferStmt defer_stmts; + Array_v__ast__Comment comments; + Array_v__ast__Comment end_comments; + Array_v__ast__Comment next_comments; + Array_string label_names; string name; string short_name; string mod; + string file; + v__ast__File* source_file; + v__ast__Scope* scope; + v__token__Pos receiver_pos; + v__token__Pos method_type_pos; + v__token__Pos body_pos; + v__token__Pos return_type_pos; + v__token__Pos pos; + int method_idx; + int ctdefine_idx; + int idx; + v__ast__Type return_type; + int ninstances; + v__ast__Language language; + v__ast__Language file_mode; + v__ast__ShareType rec_share; bool is_deprecated; bool is_pub; bool is_variadic; @@ -5743,81 +5781,55 @@ struct v__ast__FnDecl { bool is_keep_alive; bool is_unsafe; bool is_markused; - v__ast__StructField receiver; - v__token__Pos receiver_pos; bool is_method; - v__token__Pos method_type_pos; - int method_idx; bool rec_mut; - v__ast__ShareType rec_share; - v__ast__Language language; - v__ast__Language file_mode; bool no_body; bool is_builtin; - v__token__Pos body_pos; - string file; - Array_string generic_names; bool is_direct_arr; - Array_v__ast__Attr attrs; - int ctdefine_idx; - int idx; - Array_v__ast__Param params; - Array_v__ast__Stmt stmts; - Array_v__ast__DeferStmt defer_stmts; - v__ast__Type return_type; - v__token__Pos return_type_pos; bool has_return; bool should_be_skipped; - int ninstances; bool has_await; - Array_v__ast__Comment comments; - Array_v__ast__Comment end_comments; - Array_v__ast__Comment next_comments; - v__ast__File* source_file; - v__ast__Scope* scope; - Array_string label_names; - v__token__Pos pos; }; struct v__ast__CallExpr { - v__token__Pos pos; - v__token__Pos name_pos; + v__ast__OrExpr or_block; + Array_v__ast__CallArg args; + Array_v__ast__Type expected_arg_types; + Array_v__ast__Type concrete_types; + Array_v__ast__Type raw_concrete_types; + Array_v__ast__Type from_embed_types; + Array_v__ast__Comment comments; string mod; string name; + v__ast__Expr left; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos name_pos; + v__token__Pos concrete_list_pos; + v__ast__Type left_type; + v__ast__Type receiver_type; + v__ast__Type return_type; + v__ast__Type fn_var_type; + v__ast__Language language; bool is_method; bool is_field; bool is_fn_var; bool is_keep_alive; bool is_noreturn; bool is_ctor_new; - Array_v__ast__CallArg args; - Array_v__ast__Type expected_arg_types; - v__ast__Language language; - v__ast__OrExpr or_block; - v__ast__Expr left; - v__ast__Type left_type; - v__ast__Type receiver_type; - v__ast__Type return_type; - v__ast__Type fn_var_type; bool should_be_skipped; - Array_v__ast__Type concrete_types; - v__token__Pos concrete_list_pos; - Array_v__ast__Type raw_concrete_types; bool free_receiver; - v__ast__Scope* scope; - Array_v__ast__Type from_embed_types; - Array_v__ast__Comment comments; }; struct v__ast__IndexExpr { - v__token__Pos pos; - v__ast__Expr index; v__ast__OrExpr or_expr; + v__ast__Expr index; v__ast__Expr left; + v__token__Pos pos; v__ast__Type left_type; bool is_setter; bool is_map; @@ -5831,29 +5843,29 @@ struct v__ast__IndexExpr { struct v__ast__InfixExpr { - v__token__Kind op; - v__token__Pos pos; - bool is_stmt; + v__ast__OrExpr or_block; v__ast__Expr left; v__ast__Expr right; + string auto_locked; + v__ast__ComptTimeConstValue ct_left_value; + v__ast__ComptTimeConstValue ct_right_value; + v__token__Pos pos; v__ast__Type left_type; v__ast__Type right_type; - string auto_locked; - v__ast__OrExpr or_block; + v__token__Kind op; + bool is_stmt; bool ct_left_value_evaled; - v__ast__ComptTimeConstValue ct_left_value; bool ct_right_value_evaled; - v__ast__ComptTimeConstValue ct_right_value; }; struct v__ast__PrefixExpr { - v__token__Kind op; + v__ast__OrExpr or_block; + v__ast__Expr right; v__token__Pos pos; v__ast__Type right_type; - v__ast__Expr right; - v__ast__OrExpr or_block; + v__token__Kind op; bool is_option; }; @@ -5882,13 +5894,13 @@ struct v__ast__SqlExpr { struct v__ast__SelectBranch { - v__token__Pos pos; v__ast__Comment comment; + Array_v__ast__Comment post_comments; + Array_v__ast__Stmt stmts; + v__ast__Stmt stmt; + v__token__Pos pos; bool is_else; bool is_timeout; - Array_v__ast__Comment post_comments; - v__ast__Stmt stmt; - Array_v__ast__Stmt stmts; }; @@ -6089,27 +6101,46 @@ struct sync__pool__PoolProcessor { struct v__checker__Checker { - v__pref__Preferences* pref; - v__ast__Table* table; - v__ast__File* file; - int nr_errors; - int nr_warnings; - int nr_notices; + v__ast__FnDecl main_fn_decl_node; + v__ast__TypeSymbol cur_orm_ts; + Map_string_v__ast__Type comptime_fields_type; Array_v__errors__Error errors; Array_v__errors__Warning warnings; Array_v__errors__Notice notices; Array_int error_lines; - v__ast__Type expected_type; - v__ast__Type expected_or_type; - v__ast__Type expected_expr_type; - string mod; - string const_decl; Array_string const_deps; Array_string const_names; Array_string global_names; Array_string locked_names; Array_string rlocked_names; + Array_v__ast__Expr ct_cond_stack; + Array_v__ast__File files; + Array_string error_details; + Array_v__ast__Type vweb_gen_types; + string mod; + string const_decl; + string vmod_file_content; + string loop_label; + v__pref__Preferences* pref; + v__ast__Table* table; + v__ast__File* file; + v__util__Timers* timers; + v__ast__Scope* fn_scope; + v__token__Pos smartcast_mut_pos; + v__token__Pos smartcast_cond_pos; + int nr_errors; + int nr_warnings; + int nr_notices; + v__ast__Type expected_type; + v__ast__Type expected_or_type; + v__ast__Type expected_expr_type; int in_for_count; + int fn_level; + int stmt_level; + int expr_level; + v__ast__Type comptime_fields_default_type; + int match_exhaustive_cutoff_limit; + int comptime_call_pos; bool should_abort; bool returns; bool scope_returns; @@ -6125,24 +6156,6 @@ struct v__checker__Checker { bool inside_ct_attr; bool inside_comptime_for_field; bool skip_flags; - int fn_level; - v__token__Pos smartcast_mut_pos; - v__token__Pos smartcast_cond_pos; - Array_v__ast__Expr ct_cond_stack; - int stmt_level; - Array_v__ast__File files; - int expr_level; - v__ast__TypeSymbol cur_orm_ts; - Array_string error_details; - string vmod_file_content; - string loop_label; - Array_v__ast__Type vweb_gen_types; - v__util__Timers* timers; - v__ast__Type comptime_fields_default_type; - Map_string_v__ast__Type comptime_fields_type; - v__ast__Scope* fn_scope; - v__ast__FnDecl main_fn_decl_node; - int match_exhaustive_cutoff_limit; bool is_last_stmt; bool prevent_sum_type_unwrapping_once; bool using_new_err_struct; @@ -6152,7 +6165,6 @@ struct v__checker__Checker { bool inside_println_arg; bool inside_decl_rhs; bool inside_if_guard; - int comptime_call_pos; }; @@ -6176,31 +6188,31 @@ struct v__ast__AnonFn { struct v__ast__ComptimeCall { - v__token__Pos pos; - bool has_parens; + v__ast__File vweb_tmpl; + v__ast__EmbeddedFile embed_file; + Array_v__ast__CallArg args; string method_name; - v__token__Pos method_pos; - v__ast__Scope* scope; v__ast__Expr left; string args_var; - bool is_vweb; - v__ast__File vweb_tmpl; - bool is_embed; - bool is_env; + string env_value; + v__ast__Scope* scope; + v__token__Pos pos; + v__token__Pos method_pos; v__token__Pos env_pos; - bool is_pkgconfig; v__ast__Type left_type; v__ast__Type result_type; - string env_value; - Array_v__ast__CallArg args; - v__ast__EmbeddedFile embed_file; + bool has_parens; + bool is_vweb; + bool is_embed; + bool is_env; + bool is_pkgconfig; }; struct v__ast__GoExpr { - v__token__Pos pos; v__ast__CallExpr call_expr; + v__token__Pos pos; bool is_expr; }; @@ -7112,6 +7124,7 @@ void _v_exit(int code); VV_LOCAL_SYMBOL string vcommithash(void); VV_LOCAL_SYMBOL void panic_debug(int line_no, string file, string mod, string fn_name, string s); void panic_optional_not_set(string s); +void panic_result_not_set(string s); void _v_panic(string s); string c_error_number_str(int errnum); void panic_error_number(string basestr, int errnum); @@ -9317,7 +9330,7 @@ bool v__ast__TypeSymbol_is_string(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_number(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_primitive(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t); -int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); +multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple); string v__ast__Kind_str(v__ast__Kind k); string Array_v__ast__Kind_str(Array_v__ast__Kind kinds); @@ -9453,7 +9466,7 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp VV_LOCAL_SYMBOL multi_return_bool_int_int v__checker__Checker_verify_vweb_params_for_method(v__checker__Checker* c, v__ast__Fn node); VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Checker* c); VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__checker__Checker* c, v__ast__Attr* node); -VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos); +VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos); v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__ArrayInit* node); VV_LOCAL_SYMBOL void v__checker__Checker_check_array_init_para_type(v__checker__Checker* c, string para, v__ast__Expr expr, v__token__Pos pos); void v__checker__Checker_ensure_sumtype_array_has_default_value(v__checker__Checker* c, v__ast__ArrayInit node); @@ -9500,7 +9513,13 @@ string _const_v__checker__unicode_lit_overflow_message; // a string literal, ini 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_2892273012681280244_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { + if (a->i < b->i) return -1; + else return 1; +} + VV_LOCAL_SYMBOL bool v__transformer__IndexState_safe_access(v__transformer__IndexState* i, string key, int _v_new); VV_LOCAL_SYMBOL int v__transformer__IndexState_safe_offset(v__transformer__IndexState* i, string key); VV_LOCAL_SYMBOL void v__transformer__IndexState_indent(v__transformer__IndexState* i, bool is_function); @@ -9548,9 +9567,9 @@ void v__markused__Walker_fn_by_name(v__markused__Walker* w, string fn_name); void v__markused__Walker_struct_fields(v__markused__Walker* w, Array_v__ast__StructField sfields); void v__markused__Walker_const_fields(v__markused__Walker* w, Array_v__ast__ConstField cfields); void v__markused__Walker_or_block(v__markused__Walker* w, v__ast__OrExpr node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node); -VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type); -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp); +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, string var_name); +VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type, string var_name); +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp, string var_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort_call(v__gen__c__Gen* g, v__ast__CallExpr node, string compare_fn); @@ -10044,6 +10063,7 @@ void v__parser__Parser_init_parse_fns(v__parser__Parser* p); void v__parser__Parser_read_first_token(v__parser__Parser* p); v__token__Token v__parser__Parser_peek_token(v__parser__Parser* p, int n); v__token__Token v__parser__Parser_peek_token_after_var_list(v__parser__Parser* p); +VV_LOCAL_SYMBOL bool v__parser__Parser_is_array_type(v__parser__Parser* p); void v__parser__Parser_open_scope(v__parser__Parser* p); void v__parser__Parser_close_scope(v__parser__Parser* p); Array_v__ast__Stmt v__parser__Parser_parse_block(v__parser__Parser* p); @@ -10233,12 +10253,12 @@ static string indent_Array_rune_str(Array_rune a, int indent_count); // auto static string v__errors__Reporter_str(v__errors__Reporter it); // auto static string Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a); // auto static string indent_Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a, int indent_count); // auto +static string v__ast__OrExpr_str(v__ast__OrExpr it); // auto +static string indent_v__ast__OrExpr_str(v__ast__OrExpr it, int indent_count); // auto static string Array_v__ast__CallArg_str(Array_v__ast__CallArg a); // auto static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int indent_count); // auto static string Array_v__ast__Type_str(Array_v__ast__Type a); // auto static string indent_Array_v__ast__Type_str(Array_v__ast__Type a, int indent_count); // auto -static string v__ast__OrExpr_str(v__ast__OrExpr it); // auto -static string indent_v__ast__OrExpr_str(v__ast__OrExpr it, int indent_count); // auto static string Array_v__ast__Comment_str(Array_v__ast__Comment a); // auto static string indent_Array_v__ast__Comment_str(Array_v__ast__Comment a, int indent_count); // auto static string v__ast__Aggregate_str(v__ast__Aggregate it); // auto @@ -10278,10 +10298,10 @@ static string v__ast__Comment_str(v__ast__Comment it); // auto static string indent_v__ast__Comment_str(v__ast__Comment it, int indent_count); // auto static string Array_v__ast__StructField_str(Array_v__ast__StructField a); // auto static string indent_Array_v__ast__StructField_str(Array_v__ast__StructField a, int indent_count); // auto -static string Array_v__ast__Fn_str(Array_v__ast__Fn a); // auto -static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count); // auto static string Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m); // auto static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m, int indent_count); // auto +static string Array_v__ast__Fn_str(Array_v__ast__Fn a); // auto +static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count); // auto static string v__ast__Param_str(v__ast__Param it); // auto static string indent_v__ast__Param_str(v__ast__Param it, int indent_count); // auto static string v__ast__StructField_str(v__ast__StructField it); // auto @@ -10814,7 +10834,7 @@ void vinit_string_literals(void){ _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#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_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"); @@ -11002,6 +11022,7 @@ static string indent_Array_v__cflag__CFlag_str(Array_v__cflag__CFlag a, int inde strings__Builder_free(&sb); return res; } +static string v__ast__OrExpr_str(v__ast__OrExpr it) { return indent_v__ast__OrExpr_str(it, 0);} static string Array_v__ast__CallArg_str(Array_v__ast__CallArg a) { return indent_Array_v__ast__CallArg_str(a, 0);} static string indent_Array_v__ast__CallArg_str(Array_v__ast__CallArg a, int indent_count) { strings__Builder sb = strings__new_builder(a.len * 10); @@ -11038,7 +11059,6 @@ static string indent_Array_v__ast__Type_str(Array_v__ast__Type a, int indent_cou strings__Builder_free(&sb); return res; } -static string v__ast__OrExpr_str(v__ast__OrExpr it) { return indent_v__ast__OrExpr_str(it, 0);} static string Array_v__ast__Comment_str(Array_v__ast__Comment a) { return indent_Array_v__ast__Comment_str(a, 0);} static string indent_Array_v__ast__Comment_str(Array_v__ast__Comment a, int indent_count) { strings__Builder sb = strings__new_builder(a.len * 10); @@ -11132,23 +11152,6 @@ static string indent_Array_v__ast__StructField_str(Array_v__ast__StructField a, strings__Builder_free(&sb); return res; } -static string Array_v__ast__Fn_str(Array_v__ast__Fn a) { return indent_Array_v__ast__Fn_str(a, 0);} -static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count) { - strings__Builder sb = strings__new_builder(a.len * 10); - strings__Builder_write_string(&sb, _SLIT("[")); - for (int i = 0; i < a.len; ++i) { - v__ast__Fn it = *(v__ast__Fn*)array_get(a, i); - string x = indent_v__ast__Fn_str(it, indent_count); - strings__Builder_write_string(&sb, x); - if (i < a.len-1) { - strings__Builder_write_string(&sb, _SLIT(", ")); - } - } - strings__Builder_write_string(&sb, _SLIT("]")); - string res = strings__Builder_str(&sb); - strings__Builder_free(&sb); - return res; -} static string Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m) { return indent_Map_int_Array_v__ast__Type_str(m, 0);} static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m, int indent_count) { /* gen_str_for_map */ strings__Builder sb = strings__new_builder(m.key_values.len*10); @@ -11168,6 +11171,23 @@ static string indent_Map_int_Array_v__ast__Type_str(Map_int_Array_v__ast__Type m strings__Builder_free(&sb); return res; } +static string Array_v__ast__Fn_str(Array_v__ast__Fn a) { return indent_Array_v__ast__Fn_str(a, 0);} +static string indent_Array_v__ast__Fn_str(Array_v__ast__Fn a, int indent_count) { + strings__Builder sb = strings__new_builder(a.len * 10); + strings__Builder_write_string(&sb, _SLIT("[")); + for (int i = 0; i < a.len; ++i) { + v__ast__Fn it = *(v__ast__Fn*)array_get(a, i); + string x = indent_v__ast__Fn_str(it, indent_count); + strings__Builder_write_string(&sb, x); + if (i < a.len-1) { + strings__Builder_write_string(&sb, _SLIT(", ")); + } + } + strings__Builder_write_string(&sb, _SLIT("]")); + string res = strings__Builder_str(&sb); + strings__Builder_free(&sb); + return res; +} static string v__ast__Param_str(v__ast__Param it) { return indent_v__ast__Param_str(it, 0);} static string v__ast__StructField_str(v__ast__StructField it) { return indent_v__ast__StructField_str(it, 0);} @@ -11175,52 +11195,52 @@ static string v__ast__StructField_str(v__ast__StructField it) { return indent_v_ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t1 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t2 = indent_v__token__Pos_str(it.name_pos, indent_count + 1); - string _t3 = indent_Array_v__ast__CallArg_str(it.args, indent_count + 1); - string _t4 = indent_Array_v__ast__Type_str(it.expected_arg_types, indent_count + 1); - string _t5 = v__ast__Language_str(it.language); - string _t6 = indent_v__ast__OrExpr_str(it.or_block, indent_count + 1); - string _t7 = v__ast__Expr_str(it.left); - string _t8 = v__ast__Type_str(it.left_type); - string _t9 = v__ast__Type_str(it.receiver_type); - string _t10 = v__ast__Type_str(it.return_type); - string _t11 = v__ast__Type_str(it.fn_var_type); - string _t12 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); - string _t13 = indent_v__token__Pos_str(it.concrete_list_pos, indent_count + 1); - string _t14 = indent_Array_v__ast__Type_str(it.raw_concrete_types, indent_count + 1); - string _t15 = isnil(it.scope) ? _SLIT("nil") : (indent_count > 25) ? _SLIT("") : v__ast__Scope_str(*it.scope); - string _t16 = indent_Array_v__ast__Type_str(it.from_embed_types, indent_count + 1); - string _t17 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t1 = indent_v__ast__OrExpr_str(it.or_block, indent_count + 1); + string _t2 = indent_Array_v__ast__CallArg_str(it.args, indent_count + 1); + string _t3 = indent_Array_v__ast__Type_str(it.expected_arg_types, indent_count + 1); + string _t4 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); + string _t5 = indent_Array_v__ast__Type_str(it.raw_concrete_types, indent_count + 1); + string _t6 = indent_Array_v__ast__Type_str(it.from_embed_types, indent_count + 1); + string _t7 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t8 = v__ast__Expr_str(it.left); + string _t9 = isnil(it.scope) ? _SLIT("nil") : (indent_count > 25) ? _SLIT("") : v__ast__Scope_str(*it.scope); + string _t10 = indent_v__token__Pos_str(it.pos, indent_count + 1); + string _t11 = indent_v__token__Pos_str(it.name_pos, indent_count + 1); + string _t12 = indent_v__token__Pos_str(it.concrete_list_pos, indent_count + 1); + string _t13 = v__ast__Type_str(it.left_type); + string _t14 = v__ast__Type_str(it.receiver_type); + string _t15 = v__ast__Type_str(it.return_type); + string _t16 = v__ast__Type_str(it.fn_var_type); + string _t17 = v__ast__Language_str(it.language); string res = str_intp( 111, _MOV((StrIntpData[]){ {_SLIT("v.ast.CallExpr{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t1}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t2}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" or_block: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t1}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t2}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" expected_arg_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t3}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t4}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" raw_concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t5}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" from_embed_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t6}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t7}}, {_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(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t8}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" scope: &"), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t9}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t10}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t11}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_list_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t12}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t13}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t14}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t15}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fn_var_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t16}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t17}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_method: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_method ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_field: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_field ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_fn_var: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_fn_var ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_keep_alive: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_keep_alive ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_noreturn: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_noreturn ? _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}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" args: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t3}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" expected_arg_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t4}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t5}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" or_block: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t6}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t7}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" left_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t8}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t9}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t10}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fn_var_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t11}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" should_be_skipped: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.should_be_skipped ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t12}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_list_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t13}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" raw_concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t14}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" free_receiver: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.free_receiver ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" scope: &"), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t15}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" from_embed_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t16}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t17}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t17); @@ -11308,19 +11328,33 @@ static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t18 = v__ast__Language_str(it.language); - string _t19 = v__ast__Language_str(it.file_mode); - string _t20 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t21 = indent_v__token__Pos_str(it.return_type_pos, indent_count + 1); - string _t22 = v__ast__Type_str(it.return_type); - string _t23 = v__ast__Type_str(it.receiver_type); - string _t24 = indent_Array_v__ast__Param_str(it.params, indent_count + 1); - string _t25 = Array_string_str(it.generic_names); - string _t26 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + 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[]){ {_SLIT("v.ast.Fn{\n"), 0, {.d_c=0}}, - {_SLIT0, 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(" language: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t18}}, {_SLIT(""), 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(" 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(" 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(" 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}}, {_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}}, @@ -11332,21 +11366,7 @@ static string indent_v__ast__Fn_str(v__ast__Fn it, int indent_count) { {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_keep_alive: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_keep_alive ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_method: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_method ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" no_body: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.no_body ? _SLIT("true") : _SLIT("false")}}, {_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(" file_mode: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t19}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t20}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t21}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" return_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t22}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" receiver_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t23}}, {_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(" params: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t24}}, {_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(" usages: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.usages}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_names: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t25}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t26}}, {_SLIT(""), 0, {.d_c=0}}, {_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(" 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("}"), 0, {.d_c=0}}, })); string_free(&_t26); @@ -11471,8 +11491,8 @@ static string indent_v__ast__ArrayFixed_str(v__ast__ArrayFixed it, int indent_co string _t39 = 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: "), 0, {.d_c=0}}, {_SLIT(""), 7, {.d_i32=it.size}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" size_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t38}}, {_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=_t39}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); @@ -11499,11 +11519,12 @@ static string indent_v__ast__Chan_str(v__ast__Chan 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 _t41 = Array_string_str(it.vals); - string res = str_intp( 15, _MOV((StrIntpData[]){ + 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=_t41}}, {_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(&_t41); @@ -11542,25 +11563,25 @@ static string indent_v__ast__GenericInst_str(v__ast__GenericInst it, int indent_ static string indent_v__ast__Interface_str(v__ast__Interface it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - 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_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t44 = indent_Map_int_Array_v__ast__Type_str(it.conversions, indent_count + 1); + string _t45 = indent_Array_v__ast__Type_str(it.types, indent_count + 1); + string _t46 = indent_Array_v__ast__StructField_str(it.fields, indent_count + 1); + string _t47 = indent_Array_v__ast__Fn_str(it.methods, indent_count + 1); + string _t48 = indent_Array_v__ast__Type_str(it.embeds, indent_count + 1); string _t49 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); string _t50 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); string _t51 = 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(" 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(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_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}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" conversions: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t44}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t45}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t46}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" methods: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t47}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t48}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t49}}, {_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(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t51}}, {_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(&_t51); @@ -11612,18 +11633,19 @@ static string indent_v__ast__Struct_str(v__ast__Struct it, int indent_count) { string _t58 = indent_Array_v__ast__Type_str(it.generic_types, indent_count + 1); string _t59 = indent_Array_v__ast__Type_str(it.concrete_types, indent_count + 1); string _t60 = v__ast__Type_str(it.parent_type); - string res = str_intp( 43, _MOV((StrIntpData[]){ + 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=_t55}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" embeds: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t56}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" fields: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t57}}, {_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}}, - {_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(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t58}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t59}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t60}}, {_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}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_minify: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_minify ? _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(&_t60); @@ -11646,13 +11668,13 @@ static string indent_v__ast__SumType_str(v__ast__SumType it, int indent_count) { 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=_t61}}, {_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(" variants: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t62}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" generic_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t63}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" concrete_types: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t64}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" parent_type: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t65}}, {_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(&_t65); @@ -11700,13 +11722,13 @@ static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { string _t70 = 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(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t68}}, {_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}}, + {_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=_t68}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t69}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_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(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t69}}, {_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(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t70}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t70); @@ -11718,29 +11740,30 @@ static string indent_v__ast__Param_str(v__ast__Param it, int indent_count) { static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_count) { string indents = string_repeat(_SLIT(" "), indent_count); - string _t71 = indent_v__token__Pos_str(it.pos, indent_count + 1); - string _t72 = indent_v__token__Pos_str(it.type_pos, indent_count + 1); - string _t73 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); - string _t74 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); - string _t75 = v__ast__Expr_str(it.default_expr); + string _t71 = indent_Array_v__ast__Comment_str(it.comments, indent_count + 1); + string _t72 = indent_Array_v__ast__Attr_str(it.attrs, indent_count + 1); + string _t73 = v__ast__Expr_str(it.default_expr); + 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.default_expr_typ); string _t77 = v__ast__Type_str(it.typ); - string res = str_intp( 59, _MOV((StrIntpData[]){ + string res = str_intp( 63, _MOV((StrIntpData[]){ {_SLIT("v.ast.StructField{\n"), 0, {.d_c=0}}, - {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" type_pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_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(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t74}}, {_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}}, + {_SLIT0, 0xfe10, {.d_s=indents}}, {_SLIT(" comments: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t71}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" attrs: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t72}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_val: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.default_val}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t73}}, {_SLIT(""), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" name: "), 0, {.d_c=0}}, {_SLIT("'"), 16, {.d_s=it.name}}, {_SLIT("'"), 0, {.d_c=0}}, + {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" pos: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t74}}, {_SLIT(""), 0, {.d_c=0}}, + {_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(" 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=_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(" 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}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_global: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_global ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" is_volatile: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=it.is_volatile ? _SLIT("true") : _SLIT("false")}}, {_SLIT(""), 0, {.d_c=0}}, - {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT(" default_expr: "), 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=_t76}}, {_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(" typ: "), 0, {.d_c=0}}, {_SLIT(""), 16, {.d_s=_t77}}, {_SLIT(""), 0, {.d_c=0}}, {_SLIT("\n"), 0xfe10, {.d_s=indents}}, {_SLIT("}"), 0, {.d_c=0}}, })); string_free(&_t77); @@ -12616,17 +12639,17 @@ static bool Array_u8_arr_eq(Array_u8 a, Array_u8 b) { } static bool v__ast__EmbeddedFile_struct_eq(v__ast__EmbeddedFile a, v__ast__EmbeddedFile b) { - return string__eq(a.rpath, b.rpath) + return Array_u8_arr_eq(a.bytes, b.bytes) + && string__eq(a.rpath, b.rpath) && string__eq(a.apath, b.apath) && string__eq(a.compression_type, b.compression_type) - && a.is_compressed == b.is_compressed - && Array_u8_arr_eq(a.bytes, b.bytes) - && a.len == b.len; + && a.len == b.len + && a.is_compressed == b.is_compressed; } void v__ast__Param_free(v__ast__Param* it) { - v__token__Pos_free(&(it->pos)); string_free(&(it->name)); + v__token__Pos_free(&(it->pos)); v__token__Pos_free(&(it->type_pos)); } @@ -12651,14 +12674,14 @@ void Array_v__ast__Attr_free(Array_v__ast__Attr* it) { } void v__ast__Fn_free(v__ast__Fn* it) { - string_free(&(it->mod)); - string_free(&(it->file)); - v__token__Pos_free(&(it->pos)); - v__token__Pos_free(&(it->return_type_pos)); - string_free(&(it->name)); Array_v__ast__Param_free(&(it->params)); Array_string_free(&(it->generic_names)); Array_v__ast__Attr_free(&(it->attrs)); + string_free(&(it->mod)); + string_free(&(it->file)); + string_free(&(it->name)); + v__token__Pos_free(&(it->pos)); + v__token__Pos_free(&(it->return_type_pos)); } void Array_v__ast__Fn_free(Array_v__ast__Fn* it) { @@ -12669,9 +12692,9 @@ void Array_v__ast__Fn_free(Array_v__ast__Fn* it) { } void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) { + Array_v__ast__Fn_free(&(it->methods)); string_free(&(it->name)); string_free(&(it->cname)); - Array_v__ast__Fn_free(&(it->methods)); string_free(&(it->mod)); } @@ -12705,16 +12728,16 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return 65620; if (sidx == _IError_Error_index) return 85; if (sidx == _IError_MessageError_index) return 86; - if (sidx == _IError_flag__UnkownFlagError_index) return 66134; - if (sidx == _IError_flag__ArgsCountError_index) return 66135; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66145; - if (sidx == _IError_semver__EmptyInputError_index) return 66147; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66148; + if (sidx == _IError_flag__UnkownFlagError_index) return 66135; + if (sidx == _IError_flag__ArgsCountError_index) return 66136; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66146; + if (sidx == _IError_semver__EmptyInputError_index) return 66148; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66149; if (sidx == _IError_os__FileNotOpenedError_index) return 65658; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65659; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65673; if (sidx == _IError_time__TimeParseError_index) return 256; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 538; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 539; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -13126,21 +13149,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 533; + return 534; } 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 534; + return 535; } 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 535; + return 536; } 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"; @@ -13149,9 +13172,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 66062; - return 571; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 574; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66063; + return 572; } // << typeof() support for sum types @@ -17440,6 +17463,13 @@ VNORETURN void panic_optional_not_set(string s) { while(1); } +// Attr: [noreturn] +VNORETURN void panic_result_not_set(string s) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("result not set ("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + while(1); +} + // Attr: [noreturn] VNORETURN void _v_panic(string s) { #if defined(_VFREESTANDING) @@ -36241,7 +36271,7 @@ string rand__ascii(int len) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -36309,7 +36339,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("91a9137b3"); + string vhash = _SLIT("3baf1741b"); 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; @@ -36737,7 +36767,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + ; #if defined(TARGET_IS_64BIT) { res->m64 = true; @@ -36947,6 +36978,16 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-no-retry-compilation"))) { res->retry_compilation = false; } + else if (string__eq(arg, _SLIT("-musl"))) { + res->is_musl = true; + res->is_glibc = false; + array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); + } + else if (string__eq(arg, _SLIT("-glibc"))) { + res->is_musl = false; + res->is_glibc = true; + array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); + } else if (string__eq(arg, _SLIT("-no-builtin"))) { res->no_builtin = true; array_push((array*)&res->build_options, _MOV((string[]){ string_clone(arg) })); @@ -36964,7 +37005,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-profile-fns"))) { Array_string profile_fns = string_split(os__cmdline__option(current_args, arg, _SLIT("")), _SLIT(",")); if (profile_fns.len > 0) { - _PUSH_MANY(&res->profile_fns, (profile_fns), _t15, Array_string); + _PUSH_MANY(&res->profile_fns, (profile_fns), _t17, Array_string); } i++; } @@ -37074,9 +37115,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-os"))) { string target_os = os__cmdline__option(current_args, _SLIT("-os"), _SLIT("")); i++; - Option_v__pref__OS _t20 = v__pref__os_from_string(target_os); - if (_t20.state != 0) { /*or block*/ - IError err = _t20.err; + Option_v__pref__OS _t22 = v__pref__os_from_string(target_os); + if (_t22.state != 0) { /*or block*/ + IError err = _t22.err; if (string__eq(target_os, _SLIT("cross"))) { res->output_cross_c = true; continue; @@ -37087,7 +37128,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors ; } - v__pref__OS target_os_kind = (*(v__pref__OS*)_t20.data); + v__pref__OS target_os_kind = (*(v__pref__OS*)_t22.data); if (target_os_kind == v__pref__OS__wasm32) { res->is_bare = true; } @@ -37095,7 +37136,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors 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 = target_os}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } else if (string__eq(arg, _SLIT("-printfn"))) { - _PUSH_MANY(&res->printfn_list, (string_split(os__cmdline__option(current_args, _SLIT("-printfn"), _SLIT("")), _SLIT(","))), _t22, Array_string); + _PUSH_MANY(&res->printfn_list, (string_split(os__cmdline__option(current_args, _SLIT("-printfn"), _SLIT("")), _SLIT(","))), _t24, Array_string); i++; } else if (string__eq(arg, _SLIT("-cflags"))) { @@ -37121,6 +37162,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-cc"))) { res->ccompiler = os__cmdline__option(current_args, _SLIT("-cc"), _SLIT("cc")); 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 = res->ccompiler}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + if (string__eq(res->ccompiler, _SLIT("musl-gcc"))) { + res->is_musl = true; + res->is_glibc = false; + } i++; } else if (string__eq(arg, _SLIT("-checker-match-exhaustive-cutoff-limit"))) { @@ -37143,13 +37188,13 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors 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 }}}))) })); - Option_v__pref__Backend _t26 = v__pref__backend_from_string(sbackend); - if (_t26.state != 0) { /*or block*/ - IError err = _t26.err; + Option_v__pref__Backend _t28 = v__pref__backend_from_string(sbackend); + if (_t28.state != 0) { /*or block*/ + IError err = _t28.err; continue; } - v__pref__Backend b = (*(v__pref__Backend*)_t26.data); + v__pref__Backend b = (*(v__pref__Backend*)_t28.data); if (v__pref__Backend_is_js(b)) { res->output_cross_c = true; } @@ -37174,16 +37219,16 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors else if (string__eq(arg, _SLIT("-custom-prelude"))) { string path = os__cmdline__option(current_args, _SLIT("-custom-prelude"), _SLIT("")); 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 = path}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - Option_string _t30 = os__read_file(path); - if (_t30.state != 0) { /*or block*/ - IError err = _t30.err; + Option_string _t32 = os__read_file(path); + if (_t32.state != 0) { /*or block*/ + IError err = _t32.err; eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot open custom prelude file: "), /*115 &IError*/0xfe10, {.d_s = IError_str(err)}}, {_SLIT0, 0, { .d_c = 0 }}}))); _v_exit(1); VUNREACHABLE(); ; } - string prelude = (*(string*)_t30.data); + string prelude = (*(string*)_t32.data); res->custom_prelude = prelude; i++; } @@ -37246,8 +37291,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); } res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); - Array_string _t31; - res->run_args = (_t31 = args, array_slice(_t31, command_pos + 2, _t31.len)); + Array_string _t33; + res->run_args = (_t33 = args, array_slice(_t33, command_pos + 2, _t33.len)); if (string__eq(res->path, _SLIT("-"))) { string tmp_file_path = rand__ulid(); string tmp_exe_file_path = res->out_name; @@ -37258,9 +37303,9 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors } string tmp_v_file_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_file_path}}, {_SLIT(".v"), 0, { .d_c = 0 }}})); string contents = os__get_raw_lines_joined(); - Option_void _t32 = os__write_file(tmp_v_file_path, contents); - if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { - IError err = _t32.err; + Option_void _t34 = os__write_file(tmp_v_file_path, contents); + if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { + IError err = _t34.err; _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to create temporary file "), /*115 &string*/0xfe10, {.d_s = tmp_v_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); VUNREACHABLE(); ; @@ -37268,8 +37313,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors ; string run_options = Array_string_join(os__cmdline__options_before(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), _SLIT(" ")); - Array_string _t33; - string command_options = Array_string_join((_t33 = os__cmdline__options_after(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), array_slice(_t33, 1, _t33.len)), _SLIT(" ")); + Array_string _t35; + string command_options = Array_string_join((_t35 = os__cmdline__options_after(args, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("run")}))), array_slice(_t35, 1, _t35.len)), _SLIT(" ")); string vexe = v__pref__vexe_path(); string tmp_cmd = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = output_option}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = run_options}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(tmp_v_file_path)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = command_options}}, {_SLIT0, 0, { .d_c = 0 }}})); v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("tmp_cmd: "), /*115 &string*/0xfe10, {.d_s = tmp_cmd}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -37277,17 +37322,17 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("exit code: "), /*100 &int*/0xfe07, {.d_i32 = tmp_result}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (output_option.len != 0) { v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("remove tmp exe file: "), /*115 &string*/0xfe10, {.d_s = tmp_exe_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); - Option_void _t34 = os__rm(tmp_exe_file_path); - if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { - IError err = _t34.err; + Option_void _t36 = os__rm(tmp_exe_file_path); + if (_t36.state != 0 && _t36.err._typ != _IError_None___index) { + IError err = _t36.err; } ; } v__pref__Preferences_vrun_elog(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("remove tmp v file: "), /*115 &string*/0xfe10, {.d_s = tmp_v_file_path}}, {_SLIT0, 0, { .d_c = 0 }}}))); - Option_void _t35 = os__rm(tmp_v_file_path); - if (_t35.state != 0 && _t35.err._typ != _IError_None___index) { - IError err = _t35.err; + Option_void _t37 = os__rm(tmp_v_file_path); + if (_t37.state != 0 && _t37.err._typ != _IError_None___index) { + IError err = _t37.err; } ; @@ -37308,8 +37353,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors if (string_ends_with(command, _SLIT(".vsh"))) { res->is_run = true; res->path = command; - Array_string _t36; - res->run_args = (_t36 = args, array_slice(_t36, command_pos + 1, _t36.len)); + Array_string _t38; + res->run_args = (_t38 = args, array_slice(_t38, command_pos + 1, _t38.len)); } else if (string__eq(command, _SLIT("interpret"))) { res->backend = v__pref__Backend__interpret; if (command_pos + 2 > args.len) { @@ -37318,8 +37363,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors VUNREACHABLE(); } res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); - Array_string _t37; - res->run_args = (_t37 = args, array_slice(_t37, command_pos + 2, _t37.len)); + Array_string _t39; + res->run_args = (_t39 = args, array_slice(_t39, command_pos + 2, _t39.len)); v__pref__must_exist(res->path); if (!string_ends_with(res->path, _SLIT(".v")) && os__is_executable(res->path) && os__is_file(res->path) && os__is_file(string__plus(res->path, _SLIT(".v")))) { eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("It looks like you wanted to run \""), /*115 &string*/0xfe10, {.d_s = res->path}}, {_SLIT(".v\", so we went ahead and did that since \""), /*115 &string*/0xfe10, {.d_s = res->path}}, {_SLIT("\" is an executable."), 0, { .d_c = 0 }}}))); @@ -37336,8 +37381,8 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->path = (*(string*)/*ee elem_sym */array_get(args, command_pos + 1)); } Map_string_string m = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - for (int _t38 = 0; _t38 < res->build_options.len; ++_t38) { - string x = ((string*)res->build_options.data)[_t38]; + for (int _t40 = 0; _t40 < res->build_options.len; ++_t40) { + string x = ((string*)res->build_options.data)[_t40]; map_set(&m, &(string[]){x}, &(string[]) { _SLIT("") }); } res->build_options = map_keys(&m); @@ -42330,25 +42375,25 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ }; } v__ast__Expr _t3 = v__ast__ArrayInit_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayInit, (((v__ast__ArrayInit){ - .pos = node.pos, - .elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)), .pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)), + .exprs = exprs, + .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), + .mod = (string){.str=(byteptr)"", .is_lit=1}, + .len_expr = len_expr, + .cap_expr = cap_expr, + .default_expr = default_expr, + .pos = node.pos, + .elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .elem_type = array_info.elem_type, + .default_type = 0, + .typ = typ, .is_fixed = 0, .has_val = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .has_len = has_len, .has_cap = has_cap, .has_default = has_default, .has_it = 0, - .exprs = exprs, - .len_expr = len_expr, - .cap_expr = cap_expr, - .default_expr = default_expr, - .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), - .elem_type = array_info.elem_type, - .default_type = 0, - .typ = typ, })))); return _t3; } else if (type_sym->kind == v__ast__Kind__map) { @@ -42357,13 +42402,13 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ Array_v__ast__Expr vals = __new_array_with_default(0, 0, sizeof(v__ast__Expr), 0); for (int _t4 = 0; _t4 < node.fields.len; ++_t4) { v__ast__StructInitField field = ((v__ast__StructInitField*)node.fields.data)[_t4]; - array_push((array*)&keys, _MOV((v__ast__Expr[]){ v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = field.name,.is_raw = 0,.language = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))) })); + array_push((array*)&keys, _MOV((v__ast__Expr[]){ v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = field.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.is_raw = 0,})))) })); array_push((array*)&vals, _MOV((v__ast__Expr[]){ field.expr })); } - v__ast__Expr _t7 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = typ,.key_type = map_info.key_type,.value_type = map_info.value_type,})))); + v__ast__Expr _t7 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.key_type = map_info.key_type,.value_type = map_info.value_type,})))); return _t7; } - v__ast__Expr _t8 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){node.pos,node.name_pos,node.is_short,node.is_short_syntax,.unresolved = false,node.pre_comments,node.typ_str,node.typ,node.update_expr,node.update_expr_type,node.update_expr_comments,node.is_update_embed,node.has_update_expr,node.fields,node.embeds,node.generic_types,})))); + v__ast__Expr _t8 = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){node.pre_comments,node.update_expr_comments,node.fields,node.embeds,node.generic_types,node.typ_str,node.update_expr,node.pos,node.name_pos,node.typ,node.update_expr_type,node.is_short,node.is_short_syntax,.unresolved = false,node.is_update_embed,node.has_update_expr,})))); return _t8; } @@ -42525,7 +42570,7 @@ void v__ast__Scope_register_struct_field(v__ast__Scope* s, string name, v__ast__ return; } } - (*(v__ast__ScopeStructField*)map_get_and_set((map*)&s->struct_fields, &(string[]){name}, &(v__ast__ScopeStructField[]){ (v__ast__ScopeStructField){.struct_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.orig_type = 0,} })) = field; + (*(v__ast__ScopeStructField*)map_get_and_set((map*)&s->struct_fields, &(string[]){name}, &(v__ast__ScopeStructField[]){ (v__ast__ScopeStructField){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.struct_type = 0,.typ = 0,.orig_type = 0,} })) = field; } void v__ast__Scope_register(v__ast__Scope* s, v__ast__ScopeObject obj) { @@ -43444,7 +43489,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}; + 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,}; } v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v__ast__Type new_type) { @@ -43460,7 +43505,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; + return (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -43484,7 +43529,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.pointer_size = 0,}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cur_fn = 0,.used_maps = 0,.panic_npanics = 0,.gostmts = 0,.pointer_size = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.is_fmt = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -43644,14 +43689,14 @@ 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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 }); } } void v__ast__Table_register_interface(v__ast__Table* t, v__ast__InterfaceDecl idecl) { - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&t->interfaces, &(int[]){idecl.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })) = idecl; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&t->interfaces, &(int[]){idecl.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })) = idecl; } int v__ast__TypeSymbol_register_method(v__ast__TypeSymbol* t, v__ast__Fn new_fn) { @@ -43666,7 +43711,7 @@ Option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__a } v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 469) /*expected idx: 469, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__Fn new_fn = ((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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); @@ -43764,9 +43809,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12435 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12435.arg0; - Array_v__ast__Type types = mr_12435.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12461 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12461.arg0; + Array_v__ast__Type types = mr_12461.arg1; 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); @@ -43798,9 +43843,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13093 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_13093.arg0; - Array_v__ast__Type types = mr_13093.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13119 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_13119.arg0; + Array_v__ast__Type types = mr_13119.arg1; 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); @@ -43823,9 +43868,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13556 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13556.arg0; - Array_v__ast__Type embed_types = mr_13556.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13582 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13582.arg0; + Array_v__ast__Type embed_types = mr_13582.arg1; if (embed_types.len != 0) { Option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok(&(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)); @@ -43852,8 +43897,8 @@ Option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__ast return (Option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_14017 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_14017.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_14043 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_14043.arg0; Option_v__ast__Fn _t5; opt_ok(&(v__ast__Fn[]) { func }, (Option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -43881,7 +43926,7 @@ VV_LOCAL_SYMBOL Option_v__ast__StructField v__ast__Table_register_aggregate_fiel } v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 469) /*expected idx: 469, name: v.ast.Aggregate */ ; bool found_once = false; - v__ast__StructField new_field = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); 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); @@ -43894,7 +43939,7 @@ VV_LOCAL_SYMBOL Option_v__ast__StructField v__ast__Table_register_aggregate_fiel } else if (!v__ast__Type_alias_eq(new_field.typ, type_field.typ)) { return (Option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` type is different"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - new_field = ((v__ast__StructField){new_field.pos,new_field.type_pos,new_field.comments,new_field.has_default_expr,new_field.attrs,.is_pub = new_field.is_pub && type_field.is_pub,new_field.default_val,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,new_field.default_expr,new_field.default_expr_typ,new_field.name,new_field.typ,}); + new_field = ((v__ast__StructField){new_field.comments,new_field.attrs,new_field.default_val,new_field.default_expr,new_field.name,new_field.pos,new_field.type_pos,new_field.i,new_field.default_expr_typ,new_field.typ,new_field.has_default_expr,.is_pub = new_field.is_pub && type_field.is_pub,.is_mut = new_field.is_mut && type_field.is_mut,new_field.is_global,new_field.is_volatile,}); } else { IError err = _t2.err; return (Option_v__ast__StructField){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(t, typ)}}, {_SLIT("` has no field or method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -44016,9 +44061,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17264 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17264.arg0; - Array_v__ast__Type types = mr_17264.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17290 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17290.arg0; + Array_v__ast__Type types = mr_17290.arg1; 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); @@ -44041,9 +44086,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17717 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17717.arg0; - Array_v__ast__Type embed_types = mr_17717.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17743 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17743.arg0; + Array_v__ast__Type embed_types = mr_17743.arg1; if (embed_types.len > 0) { Option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok(&(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)); @@ -44074,8 +44119,8 @@ Option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* t return (Option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18315 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18315.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18341 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18341.arg0; Option_v__ast__StructField _t5; opt_ok(&(v__ast__StructField[]) { field }, (Option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -44110,9 +44155,9 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS for (int _t3 = 0; _t3 < fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)fields.data)[_t3]; if (!_IN_MAP(ADDR(string, field.name), ADDR(map, field_map))) { - (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })) = field; + (*(v__ast__StructField*)map_get_and_set((map*)&field_map, &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })) = field; (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; - } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })))) { + } else if (v__ast__StructField_equals(&field, (voidptr)&/*qq*/(*(v__ast__StructField*)map_get(ADDR(map, field_map), &(string[]){field.name}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,} })))) { (*(int*)map_get_and_set((map*)&field_usages, &(string[]){field.name}, &(int[]){ 0 }))++; } } @@ -44130,7 +44175,7 @@ void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeS field = string_clone(field); int nr_definitions = (*(int*)DenseArray_value(&field_usages.key_values, _t4)); if (nr_definitions == info.variants.len) { - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,} })) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ (*(v__ast__StructField*)map_get((map*)&field_map, &(string[]){field}, &(v__ast__StructField[]){ (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,} })) })); } } info.found_fields = true; @@ -44232,17 +44277,17 @@ inline v__ast__Type v__ast__Table_unaliased_type(v__ast__Table* t, v__ast__Type VV_LOCAL_SYMBOL int v__ast__Table_rewrite_already_registered_symbol(v__ast__Table* t, v__ast__TypeSymbol typ, int existing_idx) { v__ast__TypeSymbol* existing_symbol = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)); if (existing_symbol->kind == v__ast__Kind__placeholder) { - (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,typ.kind,typ.name,typ.cname,.methods = existing_symbol->methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = existing_symbol->methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,typ.kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); int _t1 = existing_idx; return _t1; } if ((existing_idx >= _const_v__ast__string_type_idx && existing_idx <= _const_v__ast__map_type_idx) || existing_idx == _const_v__ast__error_type_idx) { if (existing_idx == _const_v__ast__string_type_idx) { { // Unsafe block - *existing_symbol = *((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,.kind = existing_symbol->kind,typ.name,typ.cname,typ.methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + *existing_symbol = *((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,.kind = existing_symbol->kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); } } else { - (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.parent_idx,typ.info,typ.kind,typ.name,typ.cname,typ.methods,typ.mod,typ.is_pub,typ.language,.idx = existing_idx,}, sizeof(v__ast__TypeSymbol))); + (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, existing_idx)) = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){typ.methods,typ.info,typ.name,typ.cname,typ.mod,typ.parent_idx,.idx = existing_idx,typ.size,typ.align,typ.kind,typ.language,typ.is_pub,}, sizeof(v__ast__TypeSymbol))); } int _t2 = existing_idx; return _t2; @@ -44273,7 +44318,7 @@ inline int v__ast__Table_register_sym(v__ast__Table* t, v__ast__TypeSymbol sym) } } idx = t->type_symbols.len; - array_push((array*)&t->type_symbols, _MOV((v__ast__TypeSymbol*[]){ ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){sym.parent_idx,sym.info,sym.kind,sym.name,sym.cname,sym.methods,sym.mod,sym.is_pub,sym.language,sym.idx,}, sizeof(v__ast__TypeSymbol))) })); + array_push((array*)&t->type_symbols, _MOV((v__ast__TypeSymbol*[]){ ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){sym.methods,sym.info,sym.name,sym.cname,sym.mod,sym.parent_idx,sym.idx,sym.size,sym.align,sym.kind,sym.language,sym.is_pub,}, sizeof(v__ast__TypeSymbol))) })); (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx))->idx = idx; map_set(&t->type_idxs, &(string[]){sym.name}, &(int[]) { idx }); int _t4 = idx; @@ -44282,7 +44327,7 @@ inline int v__ast__Table_register_sym(v__ast__Table* t, v__ast__TypeSymbol sym) // Attr: [inline] inline void v__ast__Table_register_enum_decl(v__ast__Table* t, v__ast__EnumDecl enum_decl) { - (*(v__ast__EnumDecl*)map_get_and_set((map*)&t->enum_decls, &(string[]){enum_decl.name}, &(v__ast__EnumDecl[]){ (v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = enum_decl; + (*(v__ast__EnumDecl*)map_get_and_set((map*)&t->enum_decls, &(string[]){enum_decl.name}, &(v__ast__EnumDecl[]){ (v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,} })) = enum_decl; } bool v__ast__Table_known_type(v__ast__Table* t, string name) { @@ -44484,7 +44529,7 @@ int v__ast__Table_find_or_register_chan(v__ast__Table* t, v__ast__Type elem_type int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol chan_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__chan_type_idx,.info = v__ast__Chan_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Chan, (((v__ast__Chan){.elem_type = elem_type,.is_mut = is_mut,})))),.kind = v__ast__Kind__chan,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol chan_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Chan_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Chan, (((v__ast__Chan){.elem_type = elem_type,.is_mut = is_mut,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__chan_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__chan,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, chan_typ); return _t2; } @@ -44497,7 +44542,7 @@ int v__ast__Table_find_or_register_map(v__ast__Table* t, v__ast__Type key_type, int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol map_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__map_type_idx,.info = v__ast__Map_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Map, (((v__ast__Map){.key_type = key_type,.value_type = value_type,})))),.kind = v__ast__Kind__map,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol map_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Map_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Map, (((v__ast__Map){.key_type = key_type,.value_type = value_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__map_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__map,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, map_typ); return _t2; } @@ -44510,7 +44555,7 @@ int v__ast__Table_find_or_register_thread(v__ast__Table* t, v__ast__Type return_ int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol thread_typ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__thread_type_idx,.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = return_type,})))),.kind = v__ast__Kind__thread,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol thread_typ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = return_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__thread_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__thread,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, thread_typ); return _t2; } @@ -44523,7 +44568,7 @@ int v__ast__Table_find_or_register_promise(v__ast__Table* t, v__ast__Type return int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol promise_type = ((v__ast__TypeSymbol){.parent_idx = (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("Promise")}, &(int[]){ 0 })),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){return_type, (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("JS.Any")}, &(int[]){ 0 }))})),.parent_type = 0,})))),.kind = v__ast__Kind__struct_,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol promise_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = new_array_from_c_array(2, 2, sizeof(v__ast__Type), _MOV((v__ast__Type[2]){return_type, (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("JS.Any")}, &(int[]){ 0 }))})),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = (*(int*)map_get(ADDR(map, t->type_idxs), &(string[]){_SLIT("Promise")}, &(int[]){ 0 })),.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__struct_,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, promise_type); return _t2; } @@ -44536,7 +44581,7 @@ int v__ast__Table_find_or_register_array(v__ast__Table* t, v__ast__Type elem_typ return _t1; } string cname = v__ast__Table_array_cname(t, elem_type); - v__ast__TypeSymbol array_type_ = ((v__ast__TypeSymbol){.parent_idx = _const_v__ast__array_type_idx,.info = v__ast__Array_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Array, (((v__ast__Array){.nr_dims = 1,.elem_type = elem_type,})))),.kind = v__ast__Kind__array,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol array_type_ = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Array_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Array, (((v__ast__Array){.nr_dims = 1,.elem_type = elem_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = _const_v__ast__array_type_idx,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, array_type_); return _t2; } @@ -44558,7 +44603,7 @@ int v__ast__Table_find_or_register_array_fixed(v__ast__Table* t, v__ast__Type el return _t1; } string cname = v__ast__Table_array_fixed_cname(t, elem_type, size); - v__ast__TypeSymbol array_fixed_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__ArrayFixed, (((v__ast__ArrayFixed){.size = size,.size_expr = size_expr,.elem_type = elem_type,})))),.kind = v__ast__Kind__array_fixed,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol array_fixed_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__ArrayFixed, (((v__ast__ArrayFixed){.size_expr = size_expr,.size = size,.elem_type = elem_type,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array_fixed,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, array_fixed_type); return _t2; } @@ -44569,9 +44614,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_31373 = (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_31373.arg0; - string cref = mr_31373.arg1; + multi_return_string_string mr_31399 = (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_31399.arg0; + string cref = mr_31399.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) { @@ -44584,7 +44629,7 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ int _t1 = existing_idx; return _t1; } - v__ast__TypeSymbol mr_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__MultiReturn, (((v__ast__MultiReturn){.types = mr_typs,})))),.kind = v__ast__Kind__multi_return,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + v__ast__TypeSymbol mr_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__MultiReturn, (((v__ast__MultiReturn){.types = mr_typs,})))),.name = name,.cname = cname,.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__multi_return,.language = 0,.is_pub = 0,}); int _t2 = v__ast__Table_register_sym(t, mr_type); return _t2; } @@ -44598,7 +44643,7 @@ int v__ast__Table_find_or_register_fn_type(v__ast__Table* t, string mod, v__ast_ int _t1 = existing_idx; return _t1; } - int _t2 = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__FnType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__FnType, (((v__ast__FnType){.is_anon = anon,.has_decl = has_decl,.func = f,})))),.kind = v__ast__Kind__function,.name = name,.cname = cname,.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = mod,.is_pub = 0,.language = 0,.idx = 0,})); + int _t2 = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__FnType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__FnType, (((v__ast__FnType){.is_anon = anon,.has_decl = has_decl,.func = f,})))),.name = name,.cname = cname,.mod = mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__function,.language = 0,.is_pub = 0,})); return _t2; } @@ -44607,7 +44652,7 @@ int v__ast__Table_add_placeholder_type(v__ast__Table* t, string name, v__ast__La if (string_contains(name, _SLIT("."))) { modname = string_all_before_last(name, _SLIT(".")); } - v__ast__TypeSymbol ph_type = ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__placeholder,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = modname,.is_pub = 0,.language = language,.idx = 0,}); + v__ast__TypeSymbol ph_type = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = modname,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__placeholder,.language = language,.is_pub = 0,}); int _t1 = v__ast__Table_register_sym(t, ph_type); return _t1; } @@ -44881,7 +44926,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type return _t5; } if ((inter_sym->info)._typ == 474 /* v.ast.Interface */) { - Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).attrs; + Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; if (string__eq(attr.name, _SLIT("single_impl"))) { @@ -45465,7 +45510,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.concrete_types = final_concrete_types; info.parent_type = typ; info.fields = fields; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__struct_,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__struct_,.language = 0,.is_pub = 0,})); for (int _t32 = 0; _t32 < needs_unwrap_types.len; ++_t32) { v__ast__Type typ_ = ((v__ast__Type*)needs_unwrap_types.data)[_t32]; v__ast__Table_unwrap_generic_type(t, typ_, generic_names, concrete_types); @@ -45495,7 +45540,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.parent_type = typ; info.fields = fields; info.variants = variants; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__sum_type,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__sum_type,.language = 0,.is_pub = 0,})); for (int _t35 = 0; _t35 < needs_unwrap_types.len; ++_t35) { v__ast__Type typ_ = ((v__ast__Type*)needs_unwrap_types.data)[_t35]; v__ast__Table_unwrap_generic_type(t, typ_, generic_names, concrete_types); @@ -45537,7 +45582,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty info.parent_type = typ; info.fields = fields; info.methods = imethods; - int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info),.kind = v__ast__Kind__interface_,.name = nrt,.cname = v__util__no_dots(c_nrt),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = ts->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int new_idx = v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info),.name = nrt,.cname = v__util__no_dots(c_nrt),.mod = ts->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__interface_,.language = 0,.is_pub = 0,})); v__ast__TypeSymbol* ts_copy = v__ast__Table_sym(t, new_idx); for (int _t43 = 0; _t43 < all_methods.len; ++_t43) { v__ast__Fn method = ((v__ast__Fn*)all_methods.data)[_t43]; @@ -45699,7 +45744,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { parent_info.concrete_types = array_clone_to_depth(&info.concrete_types, 0); parent_info.fields = fields; parent_info.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic); - (*typ)->info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){parent_info.attrs,parent_info.embeds,.fields = fields,parent_info.is_typedef,parent_info.is_union,parent_info.is_heap,.is_generic = false,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){parent_info.attrs,parent_info.embeds,.fields = fields,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),parent_info.is_typedef,parent_info.is_union,parent_info.is_heap,parent_info.is_minify,.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent_info.parent_type); @@ -45771,7 +45816,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { } } } - (*typ)->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){parent_info.types,.fields = fields,.methods = imethods,parent_info.embeds,parent_info.conversions,.is_generic = false,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){parent_info.conversions,parent_info.types,.fields = fields,.methods = imethods,parent_info.embeds,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; (*typ)->methods = all_methods; @@ -45822,7 +45867,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { } } } - (*typ)->info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = fields,parent_info.found_fields,parent_info.is_anon,.is_generic = false,.variants = variants,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),})))); + (*typ)->info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = fields,.variants = variants,parent_info.generic_types,.concrete_types = array_clone_to_depth(&info.concrete_types, 0),.parent_type = v__ast__Type_set_flag(v__ast__new_type(info.parent_idx), v__ast__TypeFlag__generic),parent_info.found_fields,parent_info.is_anon,.is_generic = false,})))); (*typ)->is_pub = true; (*typ)->kind = parent->kind; } else { @@ -46339,7 +46384,7 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.enum_info")); VUNREACHABLE(); - return (v__ast__Enum){.vals = __new_array(0, 0, sizeof(string)),.is_flag = 0,.is_multi_allowed = 0,}; + return (v__ast__Enum){.vals = __new_array(0, 0, sizeof(string)),.is_flag = 0,.is_multi_allowed = 0,.uses_exprs = 0,}; } // Attr: [inline] @@ -46465,7 +46510,7 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.struct_info")); VUNREACHABLE(); - return (v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}; + return (v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}; } // Attr: [inline] @@ -46483,7 +46528,7 @@ inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { } v__ast__TypeSymbol_no_info_panic(t, _SLIT("TypeSymbol.sumtype_info")); VUNREACHABLE(); - return (v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = 0,.is_generic = 0,.variants = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}; + return (v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = 0,.is_generic = 0,}; } bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { @@ -46499,37 +46544,37 @@ bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { } void v__ast__Table_register_builtin_type_symbols(v__ast__Table* t) { - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__placeholder,.name = _SLIT("reserved_0"),.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__void,.name = _SLIT("void"),.cname = _SLIT("void"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__voidptr,.name = _SLIT("voidptr"),.cname = _SLIT("voidptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__byteptr,.name = _SLIT("byteptr"),.cname = _SLIT("byteptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__charptr,.name = _SLIT("charptr"),.cname = _SLIT("charptr"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i8,.name = _SLIT("i8"),.cname = _SLIT("i8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i16,.name = _SLIT("i16"),.cname = _SLIT("i16"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__int,.name = _SLIT("int"),.cname = _SLIT("int"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__i64,.name = _SLIT("i64"),.cname = _SLIT("i64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__isize,.name = _SLIT("isize"),.cname = _SLIT("isize"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u8,.name = _SLIT("u8"),.cname = _SLIT("u8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u16,.name = _SLIT("u16"),.cname = _SLIT("u16"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u32,.name = _SLIT("u32"),.cname = _SLIT("u32"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u64,.name = _SLIT("u64"),.cname = _SLIT("u64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__usize,.name = _SLIT("usize"),.cname = _SLIT("usize"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__f32,.name = _SLIT("f32"),.cname = _SLIT("f32"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__f64,.name = _SLIT("f64"),.cname = _SLIT("f64"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__char,.name = _SLIT("char"),.cname = _SLIT("char"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__bool,.name = _SLIT("bool"),.cname = _SLIT("bool"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__none_,.name = _SLIT("none"),.cname = _SLIT("none"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__string,.name = _SLIT("string"),.cname = _SLIT("string"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__rune,.name = _SLIT("rune"),.cname = _SLIT("rune"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__array,.name = _SLIT("array"),.cname = _SLIT("array"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__map,.name = _SLIT("map"),.cname = _SLIT("map"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__chan,.name = _SLIT("chan"),.cname = _SLIT("chan"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = _SLIT("any"),.cname = _SLIT("any"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__float_literal,.name = _SLIT("float literal"),.cname = _SLIT("float_literal"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__int_literal,.name = _SLIT("int literal"),.cname = _SLIT("int_literal"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = _const_v__ast__void_type,})))),.kind = v__ast__Kind__thread,.name = _SLIT("thread"),.cname = _SLIT("__v_thread"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__interface_,.name = _SLIT("IError"),.cname = _SLIT("IError"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); - v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__u8,.name = _SLIT("zu8"),.cname = _SLIT("zu8"),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = _SLIT("builtin"),.is_pub = 0,.language = 0,.idx = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("reserved_0"),.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__placeholder,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("void"),.cname = _SLIT("void"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__void,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("voidptr"),.cname = _SLIT("voidptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__voidptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("byteptr"),.cname = _SLIT("byteptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__byteptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("charptr"),.cname = _SLIT("charptr"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__charptr,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i8"),.cname = _SLIT("i8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i8,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i16"),.cname = _SLIT("i16"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i16,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("int"),.cname = _SLIT("int"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__int,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("i64"),.cname = _SLIT("i64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__i64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("isize"),.cname = _SLIT("isize"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__isize,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u8"),.cname = _SLIT("u8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u8,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u16"),.cname = _SLIT("u16"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u16,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u32"),.cname = _SLIT("u32"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u32,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("u64"),.cname = _SLIT("u64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("usize"),.cname = _SLIT("usize"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__usize,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("f32"),.cname = _SLIT("f32"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__f32,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("f64"),.cname = _SLIT("f64"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__f64,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("char"),.cname = _SLIT("char"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__char,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("bool"),.cname = _SLIT("bool"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__bool,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("none"),.cname = _SLIT("none"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__none_,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("string"),.cname = _SLIT("string"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__string,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("rune"),.cname = _SLIT("rune"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__rune,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("array"),.cname = _SLIT("array"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__array,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("map"),.cname = _SLIT("map"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__map,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("chan"),.cname = _SLIT("chan"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__chan,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("any"),.cname = _SLIT("any"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("float literal"),.cname = _SLIT("float_literal"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__float_literal,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("int literal"),.cname = _SLIT("int_literal"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__int_literal,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Thread_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Thread, (((v__ast__Thread){.return_type = _const_v__ast__void_type,})))),.name = _SLIT("thread"),.cname = _SLIT("__v_thread"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__thread,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("IError"),.cname = _SLIT("IError"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__interface_,.language = 0,.is_pub = 0,})); + v__ast__Table_register_sym(t, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = _SLIT("zu8"),.cname = _SLIT("zu8"),.mod = _SLIT("builtin"),.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__u8,.language = 0,.is_pub = 0,})); } // Attr: [inline] @@ -46579,23 +46624,26 @@ inline bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t) { return _t1; } -int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { +multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { - int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); + multi_return_int_int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); return _t1; } if (v__ast__Type_nr_muls(typ) > 0) { - int _t2 = t->pointer_size; - return _t2; + return (multi_return_int_int){.arg0=t->pointer_size, .arg1=t->pointer_size}; } v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); + if (sym->size != -1) { + return (multi_return_int_int){.arg0=sym->size, .arg1=sym->align}; + } + int size = 0; + int align = 0; switch (sym->kind) { case v__ast__Kind__placeholder: case v__ast__Kind__void: case v__ast__Kind__none_: + case v__ast__Kind__generic_inst: { - int _t3 = 0; - return _t3; break; } case v__ast__Kind__voidptr: @@ -46608,8 +46656,7 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__thread: case v__ast__Kind__chan: { - int _t4 = t->pointer_size; - return _t4; + size = t->pointer_size; break; } case v__ast__Kind__i8: @@ -46617,15 +46664,15 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__char: case v__ast__Kind__bool: { - int _t5 = 1; - return _t5; + size = 1; + align = 1; break; } case v__ast__Kind__i16: case v__ast__Kind__u16: { - int _t6 = 2; - return _t6; + size = 2; + align = 2; break; } case v__ast__Kind__int: @@ -46634,8 +46681,8 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__f32: case v__ast__Kind__enum_: { - int _t7 = 4; - return _t7; + size = 4; + align = 4; break; } case v__ast__Kind__i64: @@ -46644,14 +46691,15 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__f64: case v__ast__Kind__float_literal: { - int _t8 = 8; - return _t8; + size = 8; + align = 8; break; } case v__ast__Kind__alias: { - int _t9 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type); - return _t9; + multi_return_int_int mr_21155 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type); + size = mr_21155.arg0; + align = mr_21155.arg1; break; } case v__ast__Kind__struct_: @@ -46660,34 +46708,35 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { { int max_alignment = 0; int total_size = 0; - Array_v__ast__Type _t10; /* if prepend */ + Array_v__ast__Type _t4; /* if prepend */ if ((sym->info)._typ == 456 /* v.ast.Struct */) { - Array_v__ast__Type _t11 = {0}; - Array_v__ast__StructField _t11_orig = (*sym->info._v__ast__Struct).fields; - int _t11_len = _t11_orig.len; - _t11 = __new_array(0, _t11_len, sizeof(v__ast__Type)); + Array_v__ast__Type _t5 = {0}; + Array_v__ast__StructField _t5_orig = (*sym->info._v__ast__Struct).fields; + int _t5_len = _t5_orig.len; + _t5 = __new_array(0, _t5_len, sizeof(v__ast__Type)); - for (int _t12 = 0; _t12 < _t11_len; ++_t12) { - v__ast__StructField it = ((v__ast__StructField*) _t11_orig.data)[_t12]; + for (int _t6 = 0; _t6 < _t5_len; ++_t6) { + v__ast__StructField it = ((v__ast__StructField*) _t5_orig.data)[_t6]; v__ast__Type ti = it.typ; - array_push((array*)&_t11, &ti); + array_push((array*)&_t5, &ti); } - _t10 =_t11; + _t4 =_t5; } else { - _t10 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.MultiReturn */ ).types; } - Array_v__ast__Type types = _t10; - for (int _t13 = 0; _t13 < types.len; ++_t13) { - v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t13]; - int field_size = v__ast__Table_type_size(t, ftyp); - int alignment = (field_size > t->pointer_size ? (t->pointer_size) : (field_size)); + 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_21466 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21466.arg0; + int alignment = mr_21466.arg1; if (alignment > max_alignment) { max_alignment = alignment; } total_size = v__ast__round_up(total_size, alignment) + field_size; } - int _t14 = v__ast__round_up(total_size, max_alignment); - return _t14; + size = v__ast__round_up(total_size, max_alignment); + align = max_alignment; break; } case v__ast__Kind__sum_type: @@ -46695,26 +46744,25 @@ int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { case v__ast__Kind__aggregate: { if (sym->info._typ == 475 /* v.ast.SumType */) { - int _t15 = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; - return _t15; + size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; + align = t->pointer_size; } else if (sym->info._typ == 469 /* v.ast.Aggregate */) { - int _t16 = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; - return _t16; + size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; + align = t->pointer_size; } else if (sym->info._typ == 474 /* v.ast.Interface */) { - int res = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; - for (int _t17 = 0; _t17 < (*sym->info._v__ast__Interface).embeds.len; ++_t17) { - v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t17]; - res += v__ast__Table_type_size(t, etyp) - 2 * t->pointer_size; + size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; + align = t->pointer_size; + for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { + v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; + multi_return_int_int mr_22027 = v__ast__Table_type_size(t, etyp); + int esize = mr_22027.arg0; + size += esize - 2 * t->pointer_size; } - int _t18 = res; - return _t18; } else { - int _t19 = 0; - return _t19; } ; break; @@ -46722,31 +46770,30 @@ 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, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ; - int _t20 = info.size * v__ast__Table_type_size(t, info.elem_type); - return _t20; + multi_return_int_int mr_22224 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22224.arg0; + int elem_align = mr_22224.arg1; + size = info.size * elem_size; + align = elem_align; break; } case v__ast__Kind__map: { - int _t21 = (t->pointer_size == 8 ? (120) : (80)); - return _t21; + size = (t->pointer_size == 8 ? (120) : (80)); + align = t->pointer_size; break; } case v__ast__Kind__array: { - int _t22 = (t->pointer_size == 8 ? (32) : (24)); - return _t22; - break; - } - case v__ast__Kind__generic_inst: - { - int _t23 = 0; - return _t23; + size = (t->pointer_size == 8 ? (32) : (24)); + align = t->pointer_size; break; } } ; - return 0; + sym->size = size; + sym->align = align; + return (multi_return_int_int){.arg0=size, .arg1=align}; } // Attr: [inline] @@ -47936,7 +47983,7 @@ v__ast__StructField v__ast__Struct_get_field(v__ast__Struct* s, string name) { } _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown field `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); - return (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}; + return (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}; } Option_v__ast__StructField v__ast__SumType_find_field(v__ast__SumType* s, string name) { @@ -48354,28 +48401,28 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } int modified_left_type = _t6; *node = ((v__ast__AssignStmt){ - .op = v__token__Kind__assign, - .pos = node->pos, .comments = node->comments, .end_comments = node->end_comments, .right = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = v__token__Kind__right_shift, - .pos = node->pos, - .is_stmt = 0, - .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = modified_left_type,.expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)),.typname = v__ast__Table_type_str(c->table, modified_left_type),.expr_type = 0,.has_arg = 0,.pos = node->pos,})))), + .or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}, + .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)),.typname = v__ast__Table_type_str(c->table, modified_left_type),.pos = node->pos,.typ = modified_left_type,.expr_type = 0,.has_arg = 0,})))), .right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, 0)), + .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = node->pos, .left_type = modified_left_type, .right_type = right_type, - .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, - .or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}, + .op = v__token__Kind__right_shift, + .is_stmt = 0, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), }))))})), .left = node->left, .left_types = node->left_types, .right_types = node->right_types, + .pos = node->pos, + .op = v__token__Kind__assign, .is_static = node->is_static, .is_volatile = 0, .is_simple = node->is_simple, @@ -48531,97 +48578,116 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v return _t5; } } + if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) { + bool _t6 = true; + return _t6; + } v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); if (got_sym->kind == v__ast__Kind__enum_) { - if (v__ast__TypeSymbol_is_number(expected_sym)) { - bool _t6 = true; - return _t6; - } - } else if (got_sym->kind == v__ast__Kind__array_fixed) { if (v__ast__TypeSymbol_is_number(expected_sym)) { bool _t7 = true; return _t7; } + } else if (got_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(expected_sym)) { + bool _t8 = true; + return _t8; + } else if (v__ast__Type_is_any_kind_of_pointer(expected)) { + bool _t9 = true; + return _t9; + } + } else if (expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + bool _t10 = true; + return _t10; + } else if (got_sym->kind == v__ast__Kind__array) { + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ; + v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ; + if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { + bool _t11 = true; + return _t11; + } + } } if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t8 = true; - return _t8; + bool _t12 = true; + return _t12; } if (got_is_ptr && exp_is_ptr) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t9 = true; - return _t9; + bool _t13 = true; + return _t13; } } } if (got_is_ptr && exp_is_ptr) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { - bool _t10 = false; - return _t10; + bool _t14 = false; + return _t14; } } int exp_idx = v__ast__Type_idx(expected); int got_idx = v__ast__Type_idx(got); if (exp_idx == got_idx) { - bool _t11 = true; - return _t11; + bool _t15 = true; + return _t15; } if (exp_idx == _const_v__ast__voidptr_type_idx || exp_idx == _const_v__ast__byteptr_type_idx || (v__ast__Type_is_ptr(expected) && v__ast__Type_idx(v__ast__Type_deref(expected)) == _const_v__ast__byte_type_idx)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) { - bool _t12 = true; - return _t12; + bool _t16 = true; + return _t16; } } if (v__ast__Type_is_real_pointer(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { - bool _t13 = true; - return _t13; + bool _t17 = true; + return _t17; } } if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { - bool _t14 = true; - return _t14; + bool _t18 = true; + return _t18; } } if (v__ast__Type_alias_eq(expected, _const_v__ast__charptr_type) && v__ast__Type_alias_eq(got, v__ast__Type_ref(_const_v__ast__char_type))) { - bool _t15 = true; - return _t15; + bool _t19 = true; + return _t19; } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got); if (((sym->idx == _const_v__ast__error_type_idx || (v__ast__Type_alias_eq(got, _const_v__ast__none_type) || v__ast__Type_alias_eq(got, _const_v__ast__error_type))) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional)) || ((sym->idx == _const_v__ast__error_type_idx || v__ast__Type_alias_eq(got, _const_v__ast__error_type)) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__result))) { - bool _t16 = true; - return _t16; - } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { - bool _t17 = false; - return _t17; - } - } - if (!v__checker__Checker_check_basic(c, got, expected)) { - bool _t18 = false; - return _t18; - } - if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { - if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { - bool _t19 = true; - return _t19; - } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { bool _t20 = true; return _t20; - } - if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { + } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { bool _t21 = false; return _t21; } } - if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { + if (!v__checker__Checker_check_basic(c, got, expected)) { bool _t22 = false; return _t22; } - bool _t23 = true; - return _t23; + if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { + if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { + bool _t23 = true; + return _t23; + } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { + bool _t24 = true; + return _t24; + } + if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { + bool _t25 = false; + return _t25; + } + } + if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { + bool _t26 = false; + return _t26; + } + bool _t27 = true; + return _t27; } Option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg) { @@ -48672,20 +48738,25 @@ Option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, return (Option_void){0}; } } - if (v__checker__Checker_check_types(c, got, expected)) { - if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { - return (Option_void){0}; - } - } v__ast__TypeSymbol* got_typ_sym = v__ast__Table_sym(c->table, got); string got_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(got, v__ast__TypeFlag__variadic)); v__ast__TypeSymbol* expected_typ_sym = v__ast__Table_sym(c->table, expected_); string expected_typ_str = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(expected, v__ast__TypeFlag__variadic)); - if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { - if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { - return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + if (v__checker__Checker_check_types(c, got, expected)) { + if (language != v__ast__Language__v || v__ast__Type_is_ptr(expected) == v__ast__Type_is_ptr(got) || arg.is_mut || v__ast__Expr_is_auto_deref_var(arg.expr) || v__ast__Type_has_flag(got, v__ast__TypeFlag__shared_f) || !(v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__array || v__ast__Table_sym(c->table, expected_)->kind == v__ast__Kind__map)) { + return (Option_void){0}; } - return (Option_void){0}; + } else { + if (string__eq(v__ast__TypeSymbol_symbol_name_except_generic(got_typ_sym), v__ast__TypeSymbol_symbol_name_except_generic(expected_typ_sym))) { + if ((v__ast__Type_is_ptr(got) != v__ast__Type_is_ptr(expected)) || !v__checker__Checker_check_same_module(/*rec*/*c, got, expected)) { + return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + return (Option_void){0}; + } + if (v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { + return (Option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(arg.expr)}}, {_SLIT("` (no value) used as value"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } if (!v__ast__Type_alias_eq(got, _const_v__ast__void_type)) { return (Option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use `"), /*115 &string*/0xfe10, {.d_s = got_typ_str}}, {_SLIT("` as `"), /*115 &string*/0xfe10, {.d_s = expected_typ_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -48964,10 +49035,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_16973 = type_hi; - v__ast__Type _var_16982 = type_lo; - type_hi = _var_16982; - type_lo = _var_16973; + v__ast__Type _var_17710 = type_hi; + v__ast__Type _var_17719 = type_lo; + type_hi = _var_17719; + type_lo = _var_17710; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -49177,7 +49248,9 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { - to_set = arg_elem_info.elem_type; + if (string__eq(param_elem_sym->name, gt_name)) { + typ = arg_elem_info.elem_type; + } break; } } @@ -49193,7 +49266,9 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { - to_set = arg_elem_info.elem_type; + if (string__eq(param_elem_sym->name, gt_name)) { + typ = arg_elem_info.elem_type; + } break; } } @@ -49206,6 +49281,20 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param_map_info.value_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_map_info.value_type)->name, gt_name)) { typ = arg_map_info.value_type; } + } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.FnType */ ).func; + if (param_type_func.params.len == arg_type_func.params.len) { + for (int n = 0; n < param_type_func.params.len; ++n) { + v__ast__Param fn_param = ((v__ast__Param*)param_type_func.params.data)[n]; + if (v__ast__Type_has_flag(fn_param.typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, fn_param.typ)->name, gt_name)) { + typ = (*(v__ast__Param*)/*ee elem_sym */array_get(arg_type_func.params, n)).typ; + } + } + if (v__ast__Type_has_flag(param_type_func.return_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_type_func.return_type)->name, gt_name)) { + typ = arg_type_func.return_type; + } + } } else if (arg_sym->kind == v__ast__Kind__struct_ || arg_sym->kind == v__ast__Kind__interface_ || arg_sym->kind == v__ast__Kind__sum_type) { Array_v__ast__Type generic_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); @@ -49286,7 +49375,7 @@ VV_LOCAL_SYMBOL Array_string v__checker__all_valid_comptime_idents(void) { v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Preferences* pref) { bool timers_should_print = false; - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.main_fn_decl_node = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.cur_orm_ts = (v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.is_pub = 0,},.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.files = __new_array(0, 0, sizeof(v__ast__File)),.error_details = __new_array(0, 0, sizeof(string)),.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.pref = pref,.table = table,.file = 0,.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.fn_scope = ((voidptr)(0)),.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.in_for_count = 0,.fn_level = 0,.stmt_level = 0,.expr_level = 0,.comptime_fields_default_type = 0,.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.comptime_call_pos = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,}, sizeof(v__checker__Checker))); return _t1; } @@ -49312,7 +49401,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_reset_checker_state_at_start_of_new_fil c->expr_level = 0; c->stmt_level = 0; c->inside_sql = false; - c->cur_orm_ts = ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.language = 0,.idx = 0,}); + c->cur_orm_ts = ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = 0,.language = 0,.is_pub = 0,}); c->prevent_sum_type_unwrapping_once = false; c->loop_label = _SLIT(""); c->using_new_err_struct = false; @@ -49447,9 +49536,35 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ if (c->pref->is_script && !c->pref->is_test) { v__ast__File* the_main_file = (*(v__ast__File**)array_last(files_from_main_module)); array_push((array*)&the_main_file->stmts, _MOV((v__ast__Stmt[]){ v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = __new_array(0, 0, sizeof(string)), .name = _SLIT("main.main"), .short_name = (string){.str=(byteptr)"", .is_lit=1}, .mod = _SLIT("main"), + .file = the_main_file->path, + .source_file = 0, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = 0, @@ -49463,40 +49578,14 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = the_main_file->path, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .label_names = __new_array(0, 0, sizeof(string)), - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, })))) })); has_main_fn = true; } @@ -49746,8 +49835,8 @@ Array_v__ast__InterfaceEmbedding v__checker__Checker_expand_iface_embeds(v__chec Array_v__ast__InterfaceEmbedding list = iface_decl.embeds; if (!iface_decl.are_embeds_expanded) { list = v__checker__Checker_expand_iface_embeds(c, idecl, level + 1, iface_decl.embeds); - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).embeds = list; - (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,} })).are_embeds_expanded = true; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).embeds = list; + (*(v__ast__InterfaceDecl*)map_get_and_set((map*)&c->table->interfaces, &(int[]){ie.typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).are_embeds_expanded = true; } for (int _t6 = 0; _t6 < list.len; ++_t6) { v__ast__InterfaceEmbedding partial = ((v__ast__InterfaceEmbedding*)list.data)[_t6]; @@ -49884,9 +49973,11 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative value cannot be compared with `"), /*115 &string*/0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node->left._v__ast__IntegerLiteral).pos); } } else if (is_left_type_signed != is_right_type_signed && left_type != _const_v__ast__int_literal_type_idx && right_type != _const_v__ast__int_literal_type_idx) { - int ls = v__ast__Table_type_size(c->table, left_type); - int rs = v__ast__Table_type_size(c->table, right_type); - if ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls)) { + multi_return_int_int mr_23224 = v__ast__Table_type_size(c->table, left_type); + int ls = mr_23224.arg0; + multi_return_int_int mr_23267 = v__ast__Table_type_size(c->table, right_type); + int rs = mr_23267.arg0; + if (!c->pref->translated && ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls))) { string lt = v__ast__Table_sym(c->table, left_type)->name; string rt = v__ast__Table_sym(c->table, right_type)->name; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = lt}}, {_SLIT("` cannot be compared with `"), /*115 &string*/0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); @@ -50158,8 +50249,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, _SLIT("array append cannot be used in an expression"), node->pos); } v__checker__Checker_check_expr_opt_call(c, node->right, right_type); - multi_return_string_v__token__Pos mr_33942 = v__checker__Checker_fail_if_immutable(c, node->left); - node->auto_locked = mr_33942.arg0; + multi_return_string_v__token__Pos mr_33986 = v__checker__Checker_fail_if_immutable(c, node->left); + node->auto_locked = mr_33986.arg0; v__ast__Type left_value_type = v__ast__Table_value_type(c->table, v__checker__Checker_unwrap_generic(c, left_type)); v__ast__TypeSymbol* left_value_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, left_value_type)); if (left_value_sym->kind == v__ast__Kind__interface_) { @@ -50272,19 +50363,19 @@ v__ast__Type former_expected_type; return _t18; } *node = ((v__ast__InfixExpr){ - .op = v__token__Kind__right_shift, - .pos = node->pos, - .is_stmt = false, - .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = modified_left_type,.expr = node->left,.typname = v__ast__Table_type_str(c->table, modified_left_type),.expr_type = 0,.has_arg = 0,.pos = node->pos,})))), + .or_block = node->or_block, + .left = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = node->left,.typname = v__ast__Table_type_str(c->table, modified_left_type),.pos = node->pos,.typ = modified_left_type,.expr_type = 0,.has_arg = 0,})))), .right = node->right, + .auto_locked = node->auto_locked, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = node->pos, .left_type = left_type, .right_type = right_type, - .auto_locked = node->auto_locked, - .or_block = node->or_block, + .op = v__token__Kind__right_shift, + .is_stmt = false, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), }); v__ast__Type _t19 = v__checker__Checker_check_shift(c, node, left_type, right_type); // Defer begin @@ -50567,7 +50658,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } } } else if (((*expr._v__ast__Ident).obj)._typ == 362 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { - if (!c->inside_unsafe) { + if (!c->inside_unsafe && !c->pref->translated) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot modify constant `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*expr._v__ast__Ident).pos); } } @@ -50595,19 +50686,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_44340 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_44340.arg0; - pos = mr_44340.arg1; + multi_return_string_v__token__Pos mr_44503 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_44503.arg0; + pos = mr_44503.arg1; } else if (expr._typ == 321 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_44409 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_44409.arg0; - pos = mr_44409.arg1; + multi_return_string_v__token__Pos mr_44572 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_44572.arg0; + pos = mr_44572.arg1; } else if (expr._typ == 323 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_44481 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_44481.arg0; - pos = mr_44481.arg1; + multi_return_string_v__token__Pos mr_44644 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_44644.arg0; + pos = mr_44644.arg1; } else if (expr._typ == 326 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -50629,7 +50720,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (_t6.state != 0) { /*or block*/ IError err = _t6.err; has_field = false; - *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + *(v__ast__StructField*) _t6.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); } v__ast__StructField field_info = (*(v__ast__StructField*)_t6.data); @@ -50657,9 +50748,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_45945 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_45945.arg0; - pos = mr_45945.arg1; + multi_return_string_v__token__Pos mr_46108 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_46108.arg0; + pos = mr_46108.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -50765,9 +50856,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 292 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_47768 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_47768.arg0; - pos = mr_47768.arg1; + multi_return_string_v__token__Pos mr_47931 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_47931.arg0; + pos = mr_47931.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -51149,7 +51240,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S } string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; - v__ast__StructField field = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 456 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; @@ -51177,12 +51268,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_61862 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_61862.arg0; - embed_types = mr_61862.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_62025 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_62025.arg0; + embed_types = mr_62025.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); @@ -51213,12 +51304,12 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); } has_field = false; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_62693 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_62693.arg0; - embed_types = mr_62693.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_62856 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_62856.arg0; + embed_types = mr_62856.arg1; node->from_embed_types = embed_types; } } @@ -51449,7 +51540,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__ast__Ident id = ident; if ((id.info)._typ == 416 /* v.ast.IdentVar */) { if (id.comptime && Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, id.name)) { - (*(v__ast__Ident*)/*ee elem_sym */array_get((*node._v__ast__DeferStmt).defer_vars, i)) = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT(""),.kind = 0,.info = {0},.is_mut = 0,}); + (*(v__ast__Ident*)/*ee elem_sym */array_get((*node._v__ast__DeferStmt).defer_vars, i)) = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT(""),.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); continue; } v__ast__Type typ = v__checker__Checker_ident(c, (voidptr)&/*qq*/id); @@ -51695,18 +51786,18 @@ VV_LOCAL_SYMBOL Array_string v__checker__Checker_asm_ios(v__checker__Checker* c, array_push((array*)&aliases, _MOV((string[]){ string_clone(io.alias) })); if (_IN_MAP(ADDR(string, io.alias), ADDR(map, scope->objects))) { map_set(&scope->objects, &(string[]){io.alias}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = io.alias, + .expr = io.expr, + .pos = io.pos, + .typ = typ, + .orig_type = typ, .share = 0, .is_mut = 0, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = 0, .is_inherited = 0, - .expr = io.expr, - .typ = typ, - .orig_type = typ, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = io.pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -52230,7 +52321,7 @@ bool v__checker__Checker_expr_defer_0 = false; return _t19; } else if (node._typ == 298 /* v.ast.ComptimeSelector */) { - (*node._v__ast__ComptimeSelector).left_type = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).left)); + (*node._v__ast__ComptimeSelector).left_type = v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).left); v__ast__Type expr_type = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, (*node._v__ast__ComptimeSelector).field_expr)); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, expr_type); if (!v__ast__Type_alias_eq(expr_type, _const_v__ast__string_type)) { @@ -52987,7 +53078,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; if (obj._typ == 363 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; return _t7; @@ -53035,7 +53126,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } bool is_optional = v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional); node->kind = v__ast__IdentKind__variable; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = is_optional,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = is_optional,})))); if (!is_sum_type_cast) { (*obj._v__ast__Var).typ = typ; } @@ -53081,7 +53172,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } node->name = name; node->kind = v__ast__IdentKind__constant; - node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))); + node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); (*obj._v__ast__ConstField).typ = typ; node->obj = obj; v__ast__Type _t13 = typ; @@ -53204,11 +53295,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as if (!is_mut || (*expr._v__ast__SelectorExpr).is_mut) { array_push((array*)&smartcasts, _MOV((v__ast__Type[]){ to_type })); v__ast__Scope_register_struct_field(scope, v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr), ((v__ast__ScopeStructField){ - .struct_type = (*expr._v__ast__SelectorExpr).expr_type, + .smartcasts = smartcasts, .name = (*expr._v__ast__SelectorExpr).field_name, .pos = (*expr._v__ast__SelectorExpr).pos, + .struct_type = (*expr._v__ast__SelectorExpr).expr_type, .typ = cur_type, - .smartcasts = smartcasts, .orig_type = orig_type, })); } else { @@ -53231,18 +53322,18 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as if ((!is_mut || (*expr._v__ast__Ident).is_mut) && !is_already_casted) { array_push((array*)&smartcasts, _MOV((v__ast__Type[]){ to_type })); v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = smartcasts, .name = (*expr._v__ast__Ident).name, + .expr = {0}, + .pos = (*expr._v__ast__Ident).pos, + .typ = cur_type, + .orig_type = orig_type, .share = 0, .is_mut = (*expr._v__ast__Ident).is_mut, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = 0, .is_inherited = 0, - .expr = {0}, - .typ = cur_type, - .orig_type = orig_type, - .smartcasts = smartcasts, - .pos = (*expr._v__ast__Ident).pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -53447,8 +53538,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_117098 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_117098.arg0; + multi_return_string_v__token__Pos mr_117243 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_117243.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -53538,6 +53629,12 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre if ((*node->right._v__ast__PrefixExpr).op == v__token__Kind__amp) { v__checker__Checker_error(c, _SLIT("unexpected `&`, expecting expression"), (*node->right._v__ast__PrefixExpr).pos); } + } else if ((node->right)._typ == 326 /* v.ast.SelectorExpr */) { + v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); + v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 456) /*expected idx: 456, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.Enum */ ).uses_exprs))) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take address of field in struct `"), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(c->table, (*node->right._v__ast__SelectorExpr).expr_type)}}, {_SLIT("`, which is tagged as `[minify]`"), 0, { .d_c = 0 }}})), v__token__Pos_extend(node->pos, (*node->right._v__ast__SelectorExpr).pos)); + } } } if (node->op == v__token__Kind__amp && !v__ast__Type_is_ptr(right_type)) { @@ -53968,7 +54065,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_warn_or_error(v__checker__Checker* c, s return; } if (!Array_int_contains(c->error_lines, pos.line_nr)) { - v__errors__Error err = ((v__errors__Error){.message = message,.details = details,.file_path = c->file->path,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__checker,}); + v__errors__Error err = ((v__errors__Error){.message = message,.details = details,.file_path = c->file->path,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__checker,}); array_push((array*)&c->file->errors, _MOV((v__errors__Error[]){ err })); array_push((array*)&c->errors, _MOV((v__errors__Error[]){ err })); array_push((array*)&c->error_lines, _MOV((int[]){ pos.line_nr })); @@ -54221,7 +54318,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -54319,8 +54416,10 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp return _t2; } else if (expr._typ == 327 /* v.ast.SizeOf */) { + multi_return_int_int mr_3715 = v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ); + int s = mr_3715.arg0; Option_v__ast__ComptTimeConstValue _t3; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ)))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(&s) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); return _t3; } else if (expr._typ == 304 /* v.ast.FloatLiteral */) { @@ -55505,10 +55604,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Chec for (int _t2 = 0; _t2 < sym_app->methods.len; ++_t2) { v__ast__Fn m = ((v__ast__Fn*)sym_app->methods.data)[_t2]; if (m.return_type == typ_vweb_result) { - multi_return_bool_int_int mr_9819 = v__checker__Checker_verify_vweb_params_for_method(c, m); - bool is_ok = mr_9819.arg0; - int nroute_attributes = mr_9819.arg1; - int nargs = mr_9819.arg2; + multi_return_bool_int_int mr_9832 = v__checker__Checker_verify_vweb_params_for_method(c, m); + bool is_ok = mr_9832.arg0; + int nroute_attributes = mr_9832.arg1; + int nargs = mr_9832.arg2; if (!is_ok) { v__ast__FnDecl* f = ((v__ast__FnDecl*)(m.source_fn)); if (isnil(f)) { @@ -55559,34 +55658,35 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ } } c->inside_ct_attr = true; - node->ct_skip = v__checker__Checker_comptime_if_branch(c, node->ct_expr, node->pos); + node->ct_skip = (v__checker__Checker_comptime_if_branch(c, node->ct_expr, node->pos) == v__checker__ComptimeBranchSkipState__skip ? (true) : (false)); c->inside_ct_attr = false; node->ct_evaled = true; bool _t5 = node->ct_skip; return _t5; } -VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos) { +VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime_if_branch(v__checker__Checker* c, v__ast__Expr cond, v__token__Pos pos) { if (cond._typ == 290 /* v.ast.BoolLiteral */) { - bool _t1 = !(*cond._v__ast__BoolLiteral).val; + v__checker__ComptimeBranchSkipState _t1 = ((*cond._v__ast__BoolLiteral).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t1; } else if (cond._typ == 321 /* v.ast.ParExpr */) { - bool _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); + v__checker__ComptimeBranchSkipState _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); return _t2; } else if (cond._typ == 323 /* v.ast.PrefixExpr */) { if ((*cond._v__ast__PrefixExpr).op != v__token__Kind__not) { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__PrefixExpr).pos); } - bool _t3 = !v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__PrefixExpr).right, (*cond._v__ast__PrefixExpr).pos); + v__checker__ComptimeBranchSkipState reversed = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__PrefixExpr).right, (*cond._v__ast__PrefixExpr).pos); + v__checker__ComptimeBranchSkipState _t3 = (reversed == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__skip) : reversed == v__checker__ComptimeBranchSkipState__skip ? (v__checker__ComptimeBranchSkipState__eval) : (reversed)); return _t3; } else if (cond._typ == 322 /* v.ast.PostfixExpr */) { if ((*cond._v__ast__PostfixExpr).op != v__token__Kind__question) { v__checker__Checker_error(c, _SLIT("invalid $if postfix operator"), (*cond._v__ast__PostfixExpr).pos); } else if (((*cond._v__ast__PostfixExpr).expr)._typ == 306 /* v.ast.Ident */) { - bool _t4 = !Array_string_contains(c->pref->compile_defines_all, (*(*cond._v__ast__PostfixExpr).expr._v__ast__Ident).name); + v__checker__ComptimeBranchSkipState _t4 = (Array_string_contains(c->pref->compile_defines_all, (*(*cond._v__ast__PostfixExpr).expr._v__ast__Ident).name) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t4; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__PostfixExpr).pos); @@ -55595,16 +55695,24 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* else if (cond._typ == 310 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and)) { - bool l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); - bool r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); - bool _t5 = l || r; - return _t5; + v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); + v__checker__ComptimeBranchSkipState r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); + if (l == v__checker__ComptimeBranchSkipState__unknown || r == v__checker__ComptimeBranchSkipState__unknown) { + v__checker__ComptimeBranchSkipState _t5 = v__checker__ComptimeBranchSkipState__unknown; + return _t5; + } + v__checker__ComptimeBranchSkipState _t6 = (l == v__checker__ComptimeBranchSkipState__eval && r == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t6; } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__logical_or)) { - bool l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); - bool r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); - bool _t6 = l && r; - return _t6; + v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); + v__checker__ComptimeBranchSkipState r = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).right, (*cond._v__ast__InfixExpr).pos); + if (l == v__checker__ComptimeBranchSkipState__unknown || r == v__checker__ComptimeBranchSkipState__unknown) { + v__checker__ComptimeBranchSkipState _t7 = v__checker__ComptimeBranchSkipState__unknown; + return _t7; + } + v__checker__ComptimeBranchSkipState _t8 = (l == v__checker__ComptimeBranchSkipState__eval || r == v__checker__ComptimeBranchSkipState__eval ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t8; } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__key_is) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__not_is)) { if (((*cond._v__ast__InfixExpr).left)._typ == 332 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 332 /* v.ast.TypeNode */) { @@ -55612,17 +55720,17 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* if (sym->kind != v__ast__Kind__interface_) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); } - bool _t7 = false; - return _t7; + v__checker__ComptimeBranchSkipState _t9 = v__checker__ComptimeBranchSkipState__unknown; + return _t9; } else if (((*cond._v__ast__InfixExpr).left)._typ == 332 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 299 /* v.ast.ComptimeType */) { v__ast__TypeNode left = /* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).left)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).left)._typ, 332) /*expected idx: 332, name: v.ast.TypeNode */ ; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, left.typ); - bool _t8 = v__ast__Table_is_comptime_type(c->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)); - return _t8; + v__checker__ComptimeBranchSkipState _t10 = (v__ast__Table_is_comptime_type(c->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t10; } else if (((*cond._v__ast__InfixExpr).left)._typ == 326 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 332 /* v.ast.TypeNode */) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); - bool _t9 = false; - return _t9; + v__checker__ComptimeBranchSkipState _t11 = v__checker__ComptimeBranchSkipState__unknown; + return _t11; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition: expected a type or a selector expression or an interface check"), v__ast__Expr_pos((*cond._v__ast__InfixExpr).left)); } @@ -55632,23 +55740,23 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* } else if (((*cond._v__ast__InfixExpr).left)._typ == 306 /* v.ast.Ident */) { v__ast__Type left_type = v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); v__ast__Type right_type = v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).right); - Option_v__ast__Expr _t10 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); - if (_t10.state != 0) { /*or block*/ - IError err = _t10.err; + Option_v__ast__Expr _t12 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); + if (_t12.state != 0) { /*or block*/ + IError err = _t12.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*(*cond._v__ast__InfixExpr).left._v__ast__Ident).pos); - bool _t11 = false; - return _t11; + v__checker__ComptimeBranchSkipState _t13 = v__checker__ComptimeBranchSkipState__unknown; + return _t13; } - v__ast__Expr expr = (*(v__ast__Expr*)_t10.data); + v__ast__Expr expr = (*(v__ast__Expr*)_t12.data); if (!v__checker__Checker_check_types(c, right_type, left_type)) { string left_name = v__ast__Table_type_to_str(c->table, left_type); string right_name = v__ast__Table_type_to_str(c->table, right_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*cond._v__ast__InfixExpr).pos); } bool different = !string__eq(v__ast__Expr_str(expr), v__ast__Expr_str((*cond._v__ast__InfixExpr).right)); - bool _t12 = ((*cond._v__ast__InfixExpr).op == v__token__Kind__eq ? (different) : (!different)); - return _t12; + v__checker__ComptimeBranchSkipState _t14 = ((*cond._v__ast__InfixExpr).op == v__token__Kind__eq ? ((different ? (v__checker__ComptimeBranchSkipState__skip) : (v__checker__ComptimeBranchSkipState__eval))) : ((different ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)))); + return _t14; } else { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid `$if` condition: "), /*115 &string*/0xfe10, {.d_s = charptr_vstring_literal( /* v.ast.Expr */ v_typeof_sumtype_v__ast__Expr( ((*cond._v__ast__InfixExpr).left)._typ ))}}, {_SLIT("1"), 0, { .d_c = 0 }}})), (*cond._v__ast__InfixExpr).pos); } @@ -55660,168 +55768,175 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_comptime_if_branch(v__checker__Checker* else if (cond._typ == 306 /* v.ast.Ident */) { string cname = (*cond._v__ast__Ident).name; if (Array_string_contains(_const_v__checker__valid_comptime_if_os, cname)) { - bool is_os_target_different = false; + bool is_os_target_equal = true; if (!c->pref->output_cross_c) { string target_os = string_to_lower(v__pref__OS_str(c->pref->os)); - is_os_target_different = !string__eq(cname, target_os); + is_os_target_equal = string__eq(cname, target_os); } - bool _t13 = is_os_target_different; - return _t13; + v__checker__ComptimeBranchSkipState _t15 = (is_os_target_equal ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t15; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_compilers, cname)) { - bool _t14 = v__pref__cc_from_string(cname) != c->pref->ccompiler_type; - return _t14; + v__checker__ComptimeBranchSkipState _t16 = (v__pref__cc_from_string(cname) == c->pref->ccompiler_type ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t16; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_platforms, cname)) { if (string__eq(cname, _SLIT("aarch64"))) { v__checker__Checker_note(c, _SLIT("use `arm64` instead of `aarch64`"), pos); } if (string__eq(cname, _SLIT("amd64"))) { - bool _t15 = c->pref->arch != v__pref__Arch__amd64; - return _t15; - } - else if (string__eq(cname, _SLIT("i386"))) { - bool _t16 = c->pref->arch != v__pref__Arch__i386; - return _t16; - } - else if (string__eq(cname, _SLIT("aarch64"))) { - bool _t17 = c->pref->arch != v__pref__Arch__arm64; + v__checker__ComptimeBranchSkipState _t17 = (c->pref->arch == v__pref__Arch__amd64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t17; } - else if (string__eq(cname, _SLIT("arm64"))) { - bool _t18 = c->pref->arch != v__pref__Arch__arm64; + else if (string__eq(cname, _SLIT("i386"))) { + v__checker__ComptimeBranchSkipState _t18 = (c->pref->arch == v__pref__Arch__i386 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t18; } - else if (string__eq(cname, _SLIT("arm32"))) { - bool _t19 = c->pref->arch != v__pref__Arch__arm32; + else if (string__eq(cname, _SLIT("aarch64"))) { + v__checker__ComptimeBranchSkipState _t19 = (c->pref->arch == v__pref__Arch__arm64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t19; } - else if (string__eq(cname, _SLIT("rv64"))) { - bool _t20 = c->pref->arch != v__pref__Arch__rv64; + else if (string__eq(cname, _SLIT("arm64"))) { + v__checker__ComptimeBranchSkipState _t20 = (c->pref->arch == v__pref__Arch__arm64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t20; } - else if (string__eq(cname, _SLIT("rv32"))) { - bool _t21 = c->pref->arch != v__pref__Arch__rv32; + else if (string__eq(cname, _SLIT("arm32"))) { + v__checker__ComptimeBranchSkipState _t21 = (c->pref->arch == v__pref__Arch__arm32 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t21; } - else { - bool _t22 = false; + else if (string__eq(cname, _SLIT("rv64"))) { + v__checker__ComptimeBranchSkipState _t22 = (c->pref->arch == v__pref__Arch__rv64 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t22; + } + else if (string__eq(cname, _SLIT("rv32"))) { + v__checker__ComptimeBranchSkipState _t23 = (c->pref->arch == v__pref__Arch__rv32 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t23; + } + else { + v__checker__ComptimeBranchSkipState _t24 = v__checker__ComptimeBranchSkipState__unknown; + return _t24; }; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_cpu_features, cname)) { - bool _t23 = false; - return _t23; + v__checker__ComptimeBranchSkipState _t25 = v__checker__ComptimeBranchSkipState__unknown; + return _t25; } else if (Array_string_contains(_const_v__checker__valid_comptime_if_other, cname)) { if (string__eq(cname, _SLIT("apk"))) { - bool _t24 = !c->pref->is_apk; - return _t24; - } - else if (string__eq(cname, _SLIT("js"))) { - bool _t25 = !v__pref__Backend_is_js(c->pref->backend); - return _t25; - } - else if (string__eq(cname, _SLIT("debug"))) { - bool _t26 = !c->pref->is_debug; + v__checker__ComptimeBranchSkipState _t26 = (c->pref->is_apk ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t26; } - else if (string__eq(cname, _SLIT("prod"))) { - bool _t27 = !c->pref->is_prod; + else if (string__eq(cname, _SLIT("js"))) { + v__checker__ComptimeBranchSkipState _t27 = (v__pref__Backend_is_js(c->pref->backend) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t27; } - else if (string__eq(cname, _SLIT("profile"))) { - bool _t28 = !c->pref->is_prof; + else if (string__eq(cname, _SLIT("debug"))) { + v__checker__ComptimeBranchSkipState _t28 = (c->pref->is_debug ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t28; } - else if (string__eq(cname, _SLIT("test"))) { - bool _t29 = !c->pref->is_test; + else if (string__eq(cname, _SLIT("prod"))) { + v__checker__ComptimeBranchSkipState _t29 = (c->pref->is_prod ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t29; } - else if (string__eq(cname, _SLIT("glibc"))) { - bool _t30 = false; + else if (string__eq(cname, _SLIT("profile"))) { + v__checker__ComptimeBranchSkipState _t30 = (c->pref->is_prof ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t30; } - else if (string__eq(cname, _SLIT("threads"))) { - bool _t31 = c->table->gostmts == 0; + else if (string__eq(cname, _SLIT("test"))) { + v__checker__ComptimeBranchSkipState _t31 = (c->pref->is_test ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t31; } - else if (string__eq(cname, _SLIT("prealloc"))) { - bool _t32 = !c->pref->prealloc; + else if (string__eq(cname, _SLIT("musl"))) { + v__checker__ComptimeBranchSkipState _t32 = v__checker__ComptimeBranchSkipState__unknown; return _t32; } - else if (string__eq(cname, _SLIT("no_bounds_checking"))) { - bool _t33 = !Array_string_contains(c->pref->compile_defines_all, cname); + else if (string__eq(cname, _SLIT("glibc"))) { + v__checker__ComptimeBranchSkipState _t33 = v__checker__ComptimeBranchSkipState__unknown; return _t33; } - else if (string__eq(cname, _SLIT("freestanding"))) { - bool _t34 = !c->pref->is_bare || c->pref->output_cross_c; + else if (string__eq(cname, _SLIT("threads"))) { + v__checker__ComptimeBranchSkipState _t34 = (c->table->gostmts > 0 ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t34; } + else if (string__eq(cname, _SLIT("prealloc"))) { + v__checker__ComptimeBranchSkipState _t35 = (c->pref->prealloc ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t35; + } + else if (string__eq(cname, _SLIT("no_bounds_checking"))) { + v__checker__ComptimeBranchSkipState _t36 = (Array_string_contains(c->pref->compile_defines_all, cname) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t36; + } + else if (string__eq(cname, _SLIT("freestanding"))) { + v__checker__ComptimeBranchSkipState _t37 = (c->pref->is_bare && !c->pref->output_cross_c ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t37; + } else if (string__eq(cname, _SLIT("interpreter"))) { - c->pref->backend != v__pref__Backend__interpret; + v__checker__ComptimeBranchSkipState _t38 = (c->pref->backend == v__pref__Backend__interpret ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t38; } else { - bool _t35 = false; - return _t35; + v__checker__ComptimeBranchSkipState _t39 = v__checker__ComptimeBranchSkipState__unknown; + return _t39; }; } else if (!Array_string_contains(c->pref->compile_defines_all, cname)) { if (string__eq(cname, _SLIT("linux_or_macos"))) { v__checker__Checker_error(c, _SLIT("linux_or_macos is deprecated, use `$if linux || macos {` instead"), (*cond._v__ast__Ident).pos); - bool _t36 = false; - return _t36; + v__checker__ComptimeBranchSkipState _t40 = v__checker__ComptimeBranchSkipState__unknown; + return _t40; } v__ast__Type typ = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, cond)); if (((*cond._v__ast__Ident).obj)._typ != 364 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 362 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 363 /* v.ast.GlobalField */) { if (!c->inside_ct_attr) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown var: `"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - bool _t37 = false; - return _t37; + v__checker__ComptimeBranchSkipState _t41 = v__checker__ComptimeBranchSkipState__unknown; + return _t41; } - Option_v__ast__Expr _t38 = v__checker__Checker_find_obj_definition(c, (*cond._v__ast__Ident).obj); - if (_t38.state != 0) { /*or block*/ - IError err = _t38.err; + Option_v__ast__Expr _t42 = v__checker__Checker_find_obj_definition(c, (*cond._v__ast__Ident).obj); + if (_t42.state != 0) { /*or block*/ + IError err = _t42.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*cond._v__ast__Ident).pos); - bool _t39 = false; - return _t39; + v__checker__ComptimeBranchSkipState _t43 = v__checker__ComptimeBranchSkipState__unknown; + return _t43; } - v__ast__Expr expr = (*(v__ast__Expr*)_t38.data); + v__ast__Expr expr = (*(v__ast__Expr*)_t42.data); if (!v__checker__Checker_check_types(c, typ, _const_v__ast__bool_type)) { string type_name = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-bool type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` used as $if condition"), 0, { .d_c = 0 }}})), (*cond._v__ast__Ident).pos); } - bool _t40 = !(/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 290) /*expected idx: 290, name: v.ast.BoolLiteral */ ).val; - return _t40; + v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 290) /*expected idx: 290, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + return _t44; } } else if (cond._typ == 297 /* v.ast.ComptimeCall */) { if ((*cond._v__ast__ComptimeCall).is_pkgconfig) { - Option_v__pkgconfig__Main_ptr _t41 = v__pkgconfig__main(new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){string_clone((*cond._v__ast__ComptimeCall).args_var)}))); - if (_t41.state != 0) { /*or block*/ - IError err = _t41.err; + Option_v__pkgconfig__Main_ptr _t45 = v__pkgconfig__main(new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){string_clone((*cond._v__ast__ComptimeCall).args_var)}))); + if (_t45.state != 0) { /*or block*/ + IError err = _t45.err; v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), (*cond._v__ast__ComptimeCall).pos); - bool _t42 = true; - return _t42; + v__checker__ComptimeBranchSkipState _t46 = v__checker__ComptimeBranchSkipState__skip; + return _t46; } - v__pkgconfig__Main* m = (*(v__pkgconfig__Main**)_t41.data); - Option_string _t43 = v__pkgconfig__Main_run(m); - if (_t43.state != 0) { /*or block*/ - IError err = _t43.err; - bool _t44 = true; - return _t44; + v__pkgconfig__Main* m = (*(v__pkgconfig__Main**)_t45.data); + Option_string _t47 = v__pkgconfig__Main_run(m); + if (_t47.state != 0) { /*or block*/ + IError err = _t47.err; + v__checker__ComptimeBranchSkipState _t48 = v__checker__ComptimeBranchSkipState__skip; + return _t48; } - (*(string*)_t43.data); + (*(string*)_t47.data); } + v__checker__ComptimeBranchSkipState _t49 = v__checker__ComptimeBranchSkipState__eval; + return _t49; } else { v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), pos); } ; - bool _t45 = false; - return _t45; + v__checker__ComptimeBranchSkipState _t50 = v__checker__ComptimeBranchSkipState__unknown; + return _t50; } v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__ArrayInit* node) { @@ -56055,7 +56170,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } VV_LOCAL_SYMBOL void v__checker__Checker_check_array_init_para_type(v__checker__Checker* c, string para, v__ast__Expr expr, v__token__Pos pos) { - v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_expr(c, expr)); + v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, expr))); if (!(sym->kind == v__ast__Kind__int || sym->kind == v__ast__Kind__int_literal)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("array "), /*115 &string*/0xfe10, {.d_s = para}}, {_SLIT(" needs to be an int"), 0, { .d_c = 0 }}})), pos); } @@ -56704,7 +56819,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 == 284 /* v.ast.AnonFn */) { @@ -56724,7 +56839,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 == 309 /* v.ast.IndexExpr */) { @@ -56783,15 +56898,15 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__ast__Fn f = *(v__ast__Fn*)_t16.data; found = true; func = f; - (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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; } } @@ -56807,7 +56922,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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) { @@ -57340,7 +57455,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t19 = _const_v__ast__void_type; return _t19; } - v__ast__Fn method = ((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 _t20; @@ -57380,7 +57495,7 @@ 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*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__Fn_Array_v__ast__Type mr_42797 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); @@ -57853,7 +57968,7 @@ Option_void v__checker__Checker_check_expected_arg_count(v__checker__Checker* c, } bool is_params =_t1.len > 0; if (is_params) { - array_push((array*)&node->args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.is_mut = 0,.share = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.typ_str = (string){.str=(byteptr)"", .is_lit=1},.typ = last_typ,.update_expr = {0},.update_expr_type = 0,.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_update_embed = 0,.has_update_expr = 0,.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),})))),.typ = 0,.is_tmp_autofree = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}) })); + array_push((array*)&node->args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = (string){.str=(byteptr)"", .is_lit=1},.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = last_typ,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.share = 0,.is_mut = 0,.is_tmp_autofree = 0,}) })); return (Option_void){0}; } } @@ -57930,6 +58045,16 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, `"), /*115 &string*/0xfe10, {.d_s = (*arg_expr._v__ast__CallExpr).name}}, {_SLIT("` must return a bool"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__CallExpr).pos); } } + else if (arg_expr._typ == 330 /* v.ast.StringLiteral */) { + if (!is_map) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, should use e.g. `"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("(it > 2)`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__StringLiteral).pos); + } + } + else if (arg_expr._typ == 329 /* v.ast.StringInterLiteral */) { + if (!is_map) { + v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type mismatch, should use e.g. `"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("(it > 2)`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__StringInterLiteral).pos); + } + } else { } @@ -58127,12 +58252,12 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch } VV_LOCAL_SYMBOL void v__checker__scope_register_it(v__ast__Scope* s, v__token__Pos pos, v__ast__Type typ) { - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = typ,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = pos,.typ = typ,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__checker__scope_register_a_b(v__ast__Scope* s, v__token__Pos pos, v__ast__Type typ) { - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("a"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Type_ref(typ),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); - v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("b"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Type_ref(typ),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("a"),.expr = {0},.pos = pos,.typ = v__ast__Type_ref(typ),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(s, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("b"),.expr = {0},.pos = pos,.typ = v__ast__Type_ref(typ),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__ast__ForCStmt node) { @@ -58340,7 +58465,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; node->typ = _const_v__ast__void_type; int nbranches_with_return = 0; int nbranches_without_return = 0; - bool should_skip = false; + v__checker__ComptimeBranchSkipState skip_state = v__checker__ComptimeBranchSkipState__unknown; bool found_branch = false; bool is_comptime_type_is_expr = false; for (int i = 0; i < node->branches.len; ++i) { @@ -58350,8 +58475,8 @@ bool v__checker__Checker_if_expr_defer_0 = false; } if (!node->has_else || i < node->branches.len - 1) { if (node->is_comptime) { - should_skip = v__checker__Checker_comptime_if_branch(c, branch.cond, branch.pos); - (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)).pkg_exist = !should_skip; + skip_state = v__checker__Checker_comptime_if_branch(c, branch.cond, branch.pos); + (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)).pkg_exist = (skip_state == v__checker__ComptimeBranchSkipState__eval ? (true) : (false)); } else { c->expected_type = _const_v__ast__bool_type; v__ast__Type cond_typ = v__checker__Checker_unwrap_generic(c, v__checker__Checker_expr(c, branch.cond)); @@ -58378,7 +58503,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; if (((*branch.cond._v__ast__InfixExpr).right)._typ == 299 /* v.ast.ComptimeType */ && (left)._typ == 332 /* v.ast.TypeNode */) { is_comptime_type_is_expr = true; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - should_skip = !v__ast__Table_is_comptime_type(c->table, checked_type, /* as */ *(v__ast__ComptimeType*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__ComptimeType,((*branch.cond._v__ast__InfixExpr).right)._typ, 299) /*expected idx: 299, name: v.ast.ComptimeType */ ); + skip_state = (v__ast__Table_is_comptime_type(c->table, checked_type, /* as */ *(v__ast__ComptimeType*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__ComptimeType,((*branch.cond._v__ast__InfixExpr).right)._typ, 299) /*expected idx: 299, name: v.ast.ComptimeType */ ) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } else { v__ast__Type got_type = v__checker__Checker_unwrap_generic(c, (/* as */ *(v__ast__TypeNode*)__as_cast(((*branch.cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*branch.cond._v__ast__InfixExpr).right)._typ, 332) /*expected idx: 332, name: v.ast.TypeNode */ ).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got_type); @@ -58392,13 +58517,11 @@ bool v__checker__Checker_if_expr_defer_0 = false; } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 332 /* v.ast.TypeNode */ && (left)._typ == 332 /* v.ast.TypeNode */ && sym->kind == v__ast__Kind__interface_) { is_comptime_type_is_expr = true; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - should_skip = !v__ast__Table_does_type_implement_interface(c->table, checked_type, got_type); + skip_state = (v__ast__Table_does_type_implement_interface(c->table, checked_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } else if ((left)._typ == 332 /* v.ast.TypeNode */) { is_comptime_type_is_expr = true; v__ast__Type left_type = v__checker__Checker_unwrap_generic(c, (*left._v__ast__TypeNode).typ); - if (!v__ast__Type_alias_eq(left_type, got_type)) { - should_skip = true; - } + skip_state = (v__ast__Type_alias_eq(left_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); } } } @@ -58406,10 +58529,10 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool cur_skip_flags = c->skip_flags; if (found_branch) { c->skip_flags = true; - } else if (should_skip) { + } else if (skip_state == v__checker__ComptimeBranchSkipState__skip) { c->skip_flags = true; - should_skip = false; - } else if (!is_comptime_type_is_expr) { + skip_state = v__checker__ComptimeBranchSkipState__unknown; + } else if (!is_comptime_type_is_expr && skip_state == v__checker__ComptimeBranchSkipState__eval) { found_branch = true; } if (c->fn_level == 0 && c->pref->output_cross_c) { @@ -58925,7 +59048,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch ; if (_t12.state != 0) { /*or block*/ IError err = _t12.err; - *(v__ast__Param*) _t12.data = ((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = 0,.typ = 0,}); + *(v__ast__Param*) _t12.data = ((v__ast__Param){.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,},.typ = 0,.is_mut = 0,.is_auto_rec = 0,.is_hidden = 0,}); } v__ast__Param param = *(v__ast__Param*)_t12.data; @@ -59273,7 +59396,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ v__ast__Type ti = it.typ; array_push((array*)&_t4, &ti); } - expr_type = v__ast__Table_register_sym(c->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Aggregate, (((v__ast__Aggregate){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sum_type = node->cond_type,.types =_t4,})))),.kind = v__ast__Kind__aggregate,.name = name,.cname = strings__Builder_str(&agg_cname),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = c->mod,.is_pub = 0,.language = 0,.idx = 0,})); + expr_type = v__ast__Table_register_sym(c->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Aggregate, (((v__ast__Aggregate){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.sum_type = node->cond_type,.types =_t4,})))),.name = name,.cname = strings__Builder_str(&agg_cname),.mod = c->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__aggregate,.language = 0,.is_pub = 0,})); } } else { expr_type = (*(v__ast__TypeNode*)/*ee elem_sym */array_get(expr_types, 0)).typ; @@ -59411,45 +59534,45 @@ bool v__checker__Checker_sql_expr_defer_0 = false; v__checker__Checker_sql_expr(c, (voidptr)&/*qq*/n); c->inside_sql = tmp_inside_sql; n.where_expr = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = v__token__Kind__eq, - .pos = n.pos, - .is_stmt = 0, + .or_block = ((v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}), .left = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__v, - .tok_kind = v__token__Kind__eq, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = c->fn_scope, - .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = (string){.str=(byteptr)"", .is_lit=1},.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), + .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), .mod = _SLIT("main"), .name = _SLIT("id"), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = c->fn_scope, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = v__token__Kind__eq, + .language = v__ast__Language__v, .kind = v__ast__IdentKind__unresolved, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = false, })))), .right = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__c, - .tok_kind = v__token__Kind__eq, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = c->fn_scope, - .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = (string){.str=(byteptr)"", .is_lit=1},.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), + .obj = v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = (string){.str=(byteptr)"", .is_lit=1},.expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))), .mod = _SLIT("main"), .name = (string){.str=(byteptr)"", .is_lit=1}, + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = _const_v__ast__int_type,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = c->fn_scope, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = v__token__Kind__eq, + .language = v__ast__Language__c, .kind = 0, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = _const_v__ast__int_type,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = false, })))), + .auto_locked = _SLIT(""), + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = n.pos, .left_type = _const_v__ast__int_type, .right_type = _const_v__ast__int_type, - .auto_locked = _SLIT(""), - .or_block = ((v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}), + .op = v__token__Kind__eq, + .is_stmt = 0, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), })))); (*(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; } @@ -60153,6 +60276,10 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } } + if ((*struct_sym->info._v__ast__Struct).is_minify) { + array_sort_with_compare(&node->fields, (voidptr)v__checker__minify_sort_fn); + array_sort_with_compare(&(*struct_sym->info._v__ast__Struct).fields, (voidptr)v__checker__minify_sort_fn); + } for (int _t2 = 0; _t2 < node->attrs.len; ++_t2) { v__ast__Attr attr = ((v__ast__Attr*)node->attrs.data)[_t2]; if (string__eq(attr.name, _SLIT("typedef")) && node->language != v__ast__Language__c) { @@ -60265,6 +60392,52 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } +VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b) { + if (v__ast__Type_alias_eq(a->typ, b->typ)) { + int _t1 = 0; + return _t1; + } + if (a->typ == _const_v__ast__bool_type_idx) { + if (b->typ == _const_v__ast__bool_type_idx) { + int _t2 = 0; + return _t2; + } + int _t3 = 1; + return _t3; + } else if (b->typ == _const_v__ast__bool_type_idx) { + int _t4 = -1; + return _t4; + } + v__ast__Table* t = global_table; + v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); + v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); + if ((a_sym->info)._typ == 485 /* v.ast.Enum */) { + if (!(*a_sym->info._v__ast__Enum).is_flag && !(*a_sym->info._v__ast__Enum).uses_exprs) { + if (b_sym->kind == v__ast__Kind__enum_) { + int a_nr_vals = ((*a_sym->info._v__ast__Enum)).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.Enum */ ).vals.len; + int _t5 = (a_nr_vals > b_nr_vals ? (-1) : a_nr_vals < b_nr_vals ? (1) : (0)); + return _t5; + } + int _t6 = 1; + return _t6; + } + } else if ((b_sym->info)._typ == 485 /* v.ast.Enum */) { + if (!(*b_sym->info._v__ast__Enum).is_flag && !(*b_sym->info._v__ast__Enum).uses_exprs) { + int _t7 = -1; + return _t7; + } + } + multi_return_int_int mr_5357 = v__ast__Table_type_size(t, a->typ); + int a_size = mr_5357.arg0; + int a_align = mr_5357.arg1; + multi_return_int_int mr_5396 = v__ast__Table_type_size(t, b->typ); + int b_size = mr_5396.arg0; + int b_align = mr_5396.arg1; + int _t8 = (a_align > b_align ? (-1) : a_align < b_align ? (1) : a_size > b_size ? (-1) : a_size < b_size ? (1) : (0)); + return _t8; +} + v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node) { if (v__ast__Type_alias_eq(node->typ, _const_v__ast__void_type)) { if (v__ast__Type_alias_eq(c->expected_type, _const_v__ast__void_type)) { @@ -60381,7 +60554,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t9; } else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { - v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_generic = 0,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,}); + v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); @@ -60406,16 +60579,21 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str 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); } } + 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_2892273012681280244_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) { v__ast__StructInitField* field = ((v__ast__StructInitField*)node->fields.data) + i; - v__ast__StructField field_info = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField field_info = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); string field_name = _SLIT(""); if (node->is_short) { if (i >= info.fields.len) { break; } - field_info = (*(v__ast__StructField*)/*ee elem_sym */array_get(info.fields, i)); + field_info = (*(v__ast__StructField*)/*ee elem_sym */array_get(info_fields_sorted, i)); field_name = field_info.name; (*(v__ast__StructInitField*)/*ee elem_sym */array_get(node->fields, i)).name = field_name; } else { @@ -60425,7 +60603,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (_t11.state != 0) { /*or block*/ IError err = _t11.err; exists = false; - *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + *(v__ast__StructField*) _t11.data = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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,}); } field_info = (*(v__ast__StructField*)_t11.data); @@ -61458,7 +61636,7 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* return _t7; } else if (node->op == (v__token__Kind__plus)) { - v__ast__Expr _t8 = (t->pref->backend == v__pref__Backend__c ? (v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = string__plus(v__util__smart_quote((*node->left._v__ast__StringLiteral).val, (*node->left._v__ast__StringLiteral).is_raw), v__util__smart_quote((*node->right._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).is_raw)),.is_raw = 0,.language = 0,.pos = pos,}))))) : (v__ast__InfixExpr_to_sumtype_v__ast__Expr(node))); + v__ast__Expr _t8 = (t->pref->backend == v__pref__Backend__c ? (v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = string__plus(v__util__smart_quote((*node->left._v__ast__StringLiteral).val, (*node->left._v__ast__StringLiteral).is_raw), v__util__smart_quote((*node->right._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).is_raw)),.pos = pos,.language = 0,.is_raw = 0,}))))) : (v__ast__InfixExpr_to_sumtype_v__ast__Expr(node))); return _t8; } else { @@ -62231,7 +62409,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -62328,7 +62506,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 219 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } else if (node._typ == 342 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -62341,7 +62519,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; for (int _t3 = 0; _t3 < (*node._v__ast__GlobalDecl).fields.len; ++_t3) { v__ast__GlobalField gfield = ((v__ast__GlobalField*)(*node._v__ast__GlobalDecl).fields.data)[_t3]; string gkey = gfield.name; - (*(v__ast__GlobalField*)map_get_and_set((map*)&all_globals, &(string[]){gkey}, &(v__ast__GlobalField[]){ (v__ast__GlobalField){.name = (string){.str=(byteptr)"", .is_lit=1},.has_expr = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_markused = 0,.is_volatile = 0,.typ = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),} })) = gfield; + (*(v__ast__GlobalField*)map_get_and_set((map*)&all_globals, &(string[]){gkey}, &(v__ast__GlobalField[]){ (v__ast__GlobalField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.has_expr = 0,.is_markused = 0,.is_volatile = 0,} })) = gfield; } } @@ -62411,7 +62589,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ for (int _t1 = 0; _t1 < all_fn_root_names.len; ++_t1) { string fn_name = ((string*)all_fn_root_names.data)[_t1]; if (!_IN_MAP(ADDR(string, fn_name), ADDR(map, w->used_fns))) { - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} }))); } } } @@ -62980,7 +63158,7 @@ void v__markused__Walker_or_block(v__markused__Walker* w, v__ast__OrExpr node) { } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, string var_name) { v__gen__c__Type array_type = v__gen__c__Gen_unwrap(g, node.typ); string array_styp = _SLIT(""); v__gen__c__Type elem_type = v__gen__c__Gen_unwrap(g, node.elem_type); @@ -62999,9 +63177,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } int len = node.exprs.len; if (array_type.unaliased_sym->kind == v__ast__Kind__array_fixed) { - v__gen__c__Gen_fixed_array_init(g, node, array_type); + v__gen__c__Gen_fixed_array_init(g, node, array_type, var_name); } else if (len == 0) { - v__gen__c__Gen_array_init_with_fields(g, node, elem_type, is_amp, shared_styp); + v__gen__c__Gen_array_init_with_fields(g, node, elem_type, is_amp, shared_styp, var_name); } else { string elem_styp = v__gen__c__Gen_typ(g, elem_type.typ); string noscan = v__gen__c__Gen_check_noscan(g, elem_type.typ); @@ -63043,17 +63221,24 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type array_type, string var_name) { if (node.has_it) { g->inside_lambda = true; string tmp = v__gen__c__Gen_new_tmp_var(g); - string s = v__gen__c__Gen_go_before_stmt(g, 0); + string s = _SLIT(""); + if (var_name.len != 0) { + tmp = var_name; + } else { + s = v__gen__c__Gen_go_before_stmt(g, 0); + } bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); string ret_typ = v__gen__c__Gen_typ(g, node.typ); string elem_typ = v__gen__c__Gen_typ(g, node.elem_type); g->empty_line = true; - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + if (var_name.len == 0) { + v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + } v__gen__c__Gen_write(g, _SLIT("{")); if (node.has_val) { for (int i = 0; i < node.exprs.len; ++i) { @@ -63091,12 +63276,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_writeln(g, _SLIT("}")); g->indent--; v__gen__c__Gen_writeln(g, _SLIT("}")); - if (s_ends_with_ln) { - v__gen__c__Gen_writeln(g, s); - } else { - v__gen__c__Gen_write(g, s); + if (var_name.len == 0) { + if (s_ends_with_ln) { + v__gen__c__Gen_writeln(g, s); + } else { + v__gen__c__Gen_write(g, s); + } + v__gen__c__Gen_write(g, tmp); } - v__gen__c__Gen_write(g, tmp); g->inside_lambda = false; return; } @@ -63140,7 +63327,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } -VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp) { +VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v__ast__ArrayInit node, v__gen__c__Type elem_type, bool is_amp, string shared_styp, string var_name) { string elem_styp = v__gen__c__Gen_typ(g, elem_type.typ); string noscan = v__gen__c__Gen_check_noscan(g, elem_type.typ); bool is_default_array = elem_type.unaliased_sym->kind == v__ast__Kind__array && node.has_default; @@ -63148,13 +63335,20 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v_ if (node.has_it) { g->inside_lambda = true; string tmp = v__gen__c__Gen_new_tmp_var(g); - string s = v__gen__c__Gen_go_before_stmt(g, 0); + string s = _SLIT(""); + if (var_name.len != 0) { + tmp = var_name; + } else { + s = v__gen__c__Gen_go_before_stmt(g, 0); + } bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); string ret_typ = v__gen__c__Gen_typ(g, node.typ); string elem_typ = v__gen__c__Gen_typ(g, node.elem_type); g->empty_line = true; - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + if (var_name.len == 0) { + v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" ="), 0, { .d_c = 0 }}}))); + } if (is_default_array) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("__new_array_with_array_default"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); } else if (is_default_map) { @@ -63212,12 +63406,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init_with_fields(v__gen__c__Gen* g, v_ v__gen__c__Gen_writeln(g, _SLIT("}")); g->indent--; v__gen__c__Gen_writeln(g, _SLIT("}")); - if (s_ends_with_ln) { - v__gen__c__Gen_writeln(g, s); - } else { - v__gen__c__Gen_write(g, s); + if (var_name.len == 0) { + if (s_ends_with_ln) { + v__gen__c__Gen_writeln(g, s); + } else { + v__gen__c__Gen_write(g, s); + } + v__gen__c__Gen_write(g, tmp); } - v__gen__c__Gen_write(g, tmp); g->inside_lambda = false; return; } @@ -63632,43 +63828,85 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g continue; } array_push((array*)&done, _MOV((v__ast__Type[]){ t })); + strings__Builder fn_builder = strings__new_builder(512); string left_type_str = v__gen__c__Gen_typ(g, t); string fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT("_contains"), 0, { .d_c = 0 }}})); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ; - string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); - v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, left_info.elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - left_type_str = _SLIT("Array_voidptr"); - elem_type_str = _SLIT("voidptr"); - } - strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); - strings__Builder fn_builder = strings__new_builder(512); - strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); - strings__Builder_writeln(&fn_builder, _SLIT("\tfor (int i = 0; i < a.len; ++i) {")); - if (elem_sym->kind == v__ast__Kind__string) { - strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(((string*)a.data)[i], v)) {")); - } else if (elem_sym->kind == v__ast__Kind__array && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__function) { - strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (((voidptr*)a.data)[i] == v) {")); - } else if (elem_sym->kind == v__ast__Kind__map && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__struct_ && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__interface_ && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__sum_type && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else if (elem_sym->kind == v__ast__Kind__alias && v__ast__Type_nr_muls(left_info.elem_type) == 0) { - string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); - strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); - } else { - strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); + if (left_final_sym->kind == v__ast__Kind__array) { + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ).elem_type; + string elem_type_str = v__gen__c__Gen_typ(g, elem_type); + v__ast__Kind elem_kind = v__ast__Table_sym(g->table, elem_type)->kind; + bool elem_is_not_ptr = v__ast__Type_nr_muls(elem_type) == 0; + if (elem_kind == v__ast__Kind__function) { + left_type_str = _SLIT("Array_voidptr"); + elem_type_str = _SLIT("voidptr"); + } + strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, _SLIT("\tfor (int i = 0; i < a.len; ++i) {")); + if (elem_kind == v__ast__Kind__string) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(((string*)a.data)[i], v)) {")); + } else if (elem_kind == v__ast__Kind__array && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__function) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (((voidptr*)a.data)[i] == v) {")); + } else if (elem_kind == v__ast__Kind__map && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__struct_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__interface_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_interface_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__sum_type && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_sumtype_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__alias && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_alias_eq((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i], v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); + } + } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ; + int size = left_info.size; + v__ast__Type elem_type = left_info.elem_type; + string elem_type_str = v__gen__c__Gen_typ(g, elem_type); + v__ast__Kind elem_kind = v__ast__Table_sym(g->table, elem_type)->kind; + bool elem_is_not_ptr = v__ast__Type_nr_muls(elem_type) == 0; + if (elem_kind == v__ast__Kind__function) { + left_type_str = _SLIT("Array_voidptr"); + elem_type_str = _SLIT("voidptr"); + } + strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v); // auto"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = left_type_str}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT(" v) {"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tfor (int i = 0; i < "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("; ++i) {"), 0, { .d_c = 0 }}}))); + if (elem_kind == v__ast__Kind__string) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (fast_string_eq(a[i], v)) {")); + } else if (elem_kind == v__ast__Kind__array && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, left_info.elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_arr_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__function) { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (a[i] == v) {")); + } else if (elem_kind == v__ast__Kind__map && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_map_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__struct_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, elem_type); + strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ("), /*115 &string*/0xfe10, {.d_s = ptr_typ}}, {_SLIT("_struct_eq(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__interface_ && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__sum_type && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else if (elem_kind == v__ast__Kind__alias && elem_is_not_ptr) { + string ptr_typ = v__gen__c__Gen_equality_fn(g, 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(a[i], v)) {"), 0, { .d_c = 0 }}}))); + } else { + strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (a[i] == v) {")); + } } strings__Builder_writeln(&fn_builder, _SLIT("\t\t\treturn true;")); strings__Builder_writeln(&fn_builder, _SLIT("\t\t}")); @@ -64238,7 +64476,7 @@ string sref_name; v__ast__Expr val = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, i)); bool is_call = false; bool blank_assign = false; - v__ast__Ident ident = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident ident = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, var_type)); if ((left)->_typ == 306 /* v.ast.Ident */) { ident = (*left->_v__ast__Ident); @@ -64474,7 +64712,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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); @@ -64592,7 +64830,7 @@ string sref_name; } else if (is_decl) { if (is_fixed_array_init && !has_val) { if ((val)._typ == 286 /* v.ast.ArrayInit */) { - v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit)); + v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); } else { v__gen__c__Gen_write(g, _SLIT("{0}")); } @@ -64603,7 +64841,11 @@ string sref_name; if (v__ast__Expr_is_auto_deref_var(val)) { v__gen__c__Gen_write(g, _SLIT("*")); } - v__gen__c__Gen_expr(g, val); + if ((val)._typ == 286 /* v.ast.ArrayInit */) { + v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); + } else { + v__gen__c__Gen_expr(g, val); + } if (is_auto_heap) { v__gen__c__Gen_write(g, _SLIT("))")); } @@ -64654,7 +64896,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v for (int i = 0; i < node->left.len; ++i) { v__ast__Expr lx = ((v__ast__Expr*)node->left.data)[i]; bool is_auto_heap = false; - v__ast__Ident ident = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = 0,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident ident = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); if ((lx)._typ == 306 /* v.ast.Ident */) { ident = (*lx._v__ast__Ident); if ((*lx._v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { @@ -66879,7 +67121,7 @@ string v__gen__c__gen(Array_v__ast__File_ptr files, v__ast__Table* table, v__pre .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -67565,7 +67807,7 @@ VV_LOCAL_SYMBOL v__gen__c__Gen* v__gen__c__cgen_process_one_file_cb(sync__pool__ .strs_to_free0 = __new_array(0, 0, sizeof(string)), .comptime_for_method = (string){.str=(byteptr)"", .is_lit=1}, .comptime_for_field_var = (string){.str=(byteptr)"", .is_lit=1}, - .comptime_for_field_value = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, + .comptime_for_field_value = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, .comptime_for_field_type = 0, .comptime_var_type_map = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .prevent_sum_type_unwrapping_once = 0, @@ -68664,6 +68906,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ v__gen__c__Gen_writeln(g, _SLIT(";")); } else { string styp = v__gen__c__Gen_base_type(g, (*stmt._v__ast__ExprStmt).typ); + #if defined(__TINYC__) && defined(TARGET_IS_32BIT) && defined(_WIN32) + { + if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__int_literal_type)) { + styp = _SLIT("int"); + } else if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__float_literal_type)) { + styp = _SLIT("f64"); + } + } + #endif v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("opt_ok(&("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]) { "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_stmt(g, stmt); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT(" }, (Option*)(&"), /*115 &string*/0xfe10, {.d_s = tmp_var}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); @@ -69134,7 +69385,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, Option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_67520 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); @@ -69955,7 +70206,7 @@ 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__ArrayDecompose).expr); } else if (node._typ == 286 /* v.ast.ArrayInit */) { - v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit)); + v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit), _SLIT("")); } else if (node._typ == 287 /* v.ast.AsCast */) { v__gen__c__Gen_as_cast(g, (*node._v__ast__AsCast)); @@ -70583,11 +70834,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_106764 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_106764.arg0; - string key_eq_fn = mr_106764.arg1; - string clone_fn = mr_106764.arg2; - string free_fn = mr_106764.arg3; + multi_return_string_string_string_string mr_106768 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_106768.arg0; + string key_eq_fn = mr_106768.arg1; + string clone_fn = mr_106768.arg2; + string free_fn = mr_106768.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -71423,7 +71674,7 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; } } if (v__ast__ConstField_is_simple_define_const(&field)) { - v__gen__c__Gen_const_decl_simple_define(g, name, v__gen__c__Gen_expr_string(g, field_expr)); + v__gen__c__Gen_const_decl_simple_define(g, 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); } @@ -71518,7 +71769,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_write_precomputed(v__gen__c__Gen* } VV_LOCAL_SYMBOL void v__gen__c__Gen_const_decl_simple_define(v__gen__c__Gen* g, string name, string val) { - strings__Builder_write_string(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("#define _const_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); + 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__"))) { + x = string_substr(x, 6, (x).len); + } + } else { + x = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_const_"), /*115 &string*/0xfe10, {.d_s = x}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + 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); } @@ -71815,6 +72074,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ else { }; } + bool is_minify = (*sym->info._v__ast__Struct).is_minify; strings__Builder_writeln(&g->type_definitions, pre_pragma); if ((*sym->info._v__ast__Struct).is_union) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("union "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); @@ -71825,9 +72085,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_146119 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_146119.arg0; - string base = mr_146119.arg1; + multi_return_string_string mr_146502 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_146502.arg0; + string base = mr_146502.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -71844,7 +72104,27 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ string type_name = v__gen__c__Gen_typ(g, field.typ); string field_name = v__gen__c__c_name(field.name); string volatile_prefix = (field.is_volatile ? (_SLIT("volatile ")) : (_SLIT(""))); - strings__Builder_writeln(&g->type_definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = volatile_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + string size_suffix = _SLIT(""); + if (is_minify && !g->is_cc_msvc) { + if (field.typ == _const_v__ast__bool_type_idx) { + size_suffix = _SLIT(" : 1"); + } else { + v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); + if ((field_sym->info)._typ == 485 /* v.ast.Enum */) { + if (!(*field_sym->info._v__ast__Enum).is_flag && !(*field_sym->info._v__ast__Enum).uses_exprs) { + int bits_needed = 0; + int l = (*field_sym->info._v__ast__Enum).vals.len; + for (;;) { + if (!(l > 0)) break; + bits_needed++; + l >>= 1; + } + size_suffix = str_intp(2, _MOV((StrIntpData[]){{_SLIT(" : "), /*100 &int*/0xfe07, {.d_i32 = bits_needed}}, {_SLIT0, 0, { .d_c = 0 }}})); + } + } + } + } + strings__Builder_writeln(&g->type_definitions, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = volatile_prefix}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = size_suffix}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else { strings__Builder_writeln(&g->type_definitions, _SLIT("\tEMPTY_STRUCT_DECLARATION;")); @@ -72104,11 +72384,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_155392 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_155392.arg0; - string pafile = mr_155392.arg1; - string pamod = mr_155392.arg2; - string pafn = mr_155392.arg3; + multi_return_int_string_string_string mr_156325 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_156325.arg0; + string pafile = mr_156325.arg1; + string pamod = mr_156325.arg2; + string pafn = mr_156325.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 }}}))); @@ -72131,11 +72411,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_156659 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_156659.arg0; - string pafile = mr_156659.arg1; - string pamod = mr_156659.arg2; - string pafn = mr_156659.arg3; + multi_return_int_string_string_string mr_157592 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_157592.arg0; + string pafile = mr_157592.arg1; + string pamod = mr_157592.arg2; + string pafn = mr_157592.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 }}}))); @@ -72245,11 +72525,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_159269 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_159269.arg0; - string key_eq_fn = mr_159269.arg1; - string clone_fn = mr_159269.arg2; - string free_fn = mr_159269.arg3; + multi_return_string_string_string_string mr_160202 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_160202.arg0; + string key_eq_fn = mr_160202.arg1; + string clone_fn = mr_160202.arg2; + string free_fn = mr_160202.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(""))); @@ -72774,9 +73054,9 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { strings__Builder_write_string(&methods_wrapper, str_intp(5, _MOV((StrIntpData[]){{_SLIT("static inline "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, method.return_type)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = cctype}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = iwpostfix}}, {_SLIT("("), 0, { .d_c = 0 }}}))); 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)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(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)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) }); - multi_return_Array_string_Array_string_Array_bool mr_173751 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_173751.arg0; + 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_174684 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_174684.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__")); @@ -72790,11 +73070,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){.is_variadic = 0,.language = 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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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_174215 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_174215.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_175148 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_175148.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 }}})); @@ -73260,7 +73540,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){.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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)),.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 }}}))); @@ -73338,7 +73618,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast_ if ((node.field_expr)._typ == 326 /* v.ast.SelectorExpr */) { if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 306 /* v.ast.Ident */) { if (string__eq((*(*node.field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name, g->comptime_for_field_var) && string__eq((*node.field_expr._v__ast__SelectorExpr).field_name, _SLIT("name"))) { - v__gen__c__Gen_write(g, v__gen__c__c_name(g->comptime_for_field_value.name)); + string field_name = g->comptime_for_field_value.name; + v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.left_type)); + Option_v__ast__StructField _t1 = v__ast__Table_find_field_with_embeds(g->table, left_sym, field_name); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(node.left)}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node.left)); + VUNREACHABLE(); + ; + } + + (*(v__ast__StructField*)_t1.data); + v__gen__c__Gen_write(g, v__gen__c__c_name(field_name)); return; } } @@ -74829,8 +75120,19 @@ int ctmp; for (int _t15 = 0; _t15 < node->attrs.len; ++_t15) { v__ast__Attr attr = ((v__ast__Attr*)node->attrs.data)[_t15]; if (string__eq(attr.name, _SLIT("export"))) { + bool _t16 = false; + Array_v__ast__Attr _t16_orig = node->attrs; + int _t16_len = _t16_orig.len; + for (int _t17 = 0; _t17 < _t16_len; ++_t17) { + v__ast__Attr it = ((v__ast__Attr*) _t16_orig.data)[_t17]; + if (string__eq(it.name, _SLIT("weak"))) { + _t16 = true; + break; + } + } + string weak = (_t16 ? (_SLIT("VWEAK ")) : (_SLIT(""))); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("// export alias: "), /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}}))); - string export_alias = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fn_attrs}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = arg_str}}, {_SLIT(")"), 0, { .d_c = 0 }}})); + string export_alias = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = weak}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fn_attrs}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = attr.arg}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = arg_str}}, {_SLIT(")"), 0, { .d_c = 0 }}})); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("VV_EXPORTED_SYMBOL "), /*115 &string*/0xfe10, {.d_s = export_alias}}, {_SLIT("; // exported fn "), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = export_alias}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -74909,9 +75211,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF v__gen__c__Gen_write(g, node->decl.name); return; } - multi_return_string_string mr_14615 = v__gen__c__closure_ctx(node->decl); - string ctx_struct = mr_14615.arg0; - string arg_struct = mr_14615.arg1; + multi_return_string_string mr_14693 = v__gen__c__closure_ctx(node->decl); + string ctx_struct = mr_14693.arg0; + string arg_struct = mr_14693.arg1; v__gen__c__Gen_write(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("__closure_create("), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT("_wrapper, "), /*115 &string*/0xfe10, {.d_s = node->decl.name}}, {_SLIT("_unwrapper, ("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("*) memdup(&("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); g->indent++; for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { @@ -74921,7 +75223,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn(v__gen__c__Gen* g, v__ast__AnonF g->indent--; int ps = g->table->pointer_size; int is_big_cutoff = (g->pref->os == v__pref__OS__windows || g->pref->arch == v__pref__Arch__arm32 ? (ps) : (ps * 2)); - bool is_big = v__ast__Table_type_size(g->table, node->decl.return_type) > is_big_cutoff; + multi_return_int_int mr_15314 = v__ast__Table_type_size(g->table, node->decl.return_type); + int rt_size = mr_15314.arg0; + bool is_big = rt_size > is_big_cutoff; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT(")))"), 0, { .d_c = 0 }}}))); strings__Builder sb = strings__new_builder(512); string ret_styp = v__gen__c__Gen_typ(g, node->decl.return_type); @@ -74977,9 +75281,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_anon_fn_decl(v__gen__c__Gen* g, v__ast__ node->has_gen = true; strings__Builder builder = strings__new_builder(256); if (node->inherited_vars.len > 0) { - multi_return_string_string mr_17084 = v__gen__c__closure_ctx(node->decl); - string ctx_struct = mr_17084.arg0; - string arg_struct = mr_17084.arg1; + multi_return_string_string mr_17185 = v__gen__c__closure_ctx(node->decl); + string ctx_struct = mr_17185.arg0; + string arg_struct = mr_17185.arg1; strings__Builder_writeln(&builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ctx_struct}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); for (int _t1 = 0; _t1 < node->inherited_vars.len; ++_t1) { v__ast__Param var = ((v__ast__Param*)node->inherited_vars.data)[_t1]; @@ -75833,11 +76137,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_41672 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_41672.arg0; - string pafile = mr_41672.arg1; - string pamod = mr_41672.arg2; - string pafn = mr_41672.arg3; + multi_return_int_string_string_string mr_41773 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_41773.arg0; + string pafile = mr_41773.arg1; + string pamod = mr_41773.arg2; + string pafn = mr_41773.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(")")); @@ -75927,7 +76231,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a free_tmp_arg_vars = false; g->tmp_count_af++; v__ast__Scope* scope = v__ast__Scope_innermost(g->file->scope, node.pos.pos); - Array_v__ast__CallArg args = new_array_from_c_array(1, 1, sizeof(v__ast__CallArg), _MOV((v__ast__CallArg[1]){((v__ast__CallArg){.is_mut = 0,.share = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = node.left,.typ = node.receiver_type,.is_tmp_autofree = node.free_receiver,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})})); + Array_v__ast__CallArg args = new_array_from_c_array(1, 1, sizeof(v__ast__CallArg), _MOV((v__ast__CallArg[1]){((v__ast__CallArg){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.expr = node.left,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = node.receiver_type,.share = 0,.is_mut = 0,.is_tmp_autofree = node.free_receiver,})})); _PUSH_MANY(&args, (node.args), _t1, Array_v__ast__CallArg); for (int i = 0; i < args.len; ++i) { v__ast__CallArg arg = ((v__ast__CallArg*)args.data)[i]; @@ -75956,7 +76260,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a } s = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = t}}, {_SLIT(" = "), 0, { .d_c = 0 }}})); } else { - v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = t,.share = 0,.is_mut = 0,.is_autofree_tmp = true,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__string_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = node.pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = t,.expr = {0},.pos = node.pos,.typ = _const_v__ast__string_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = true,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); s = str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = t}}, {_SLIT(" = "), 0, { .d_c = 0 }}})); } s = /*f*/string__plus(s, v__gen__c__Gen_expr_string(g, arg.expr)); @@ -76549,6 +76853,19 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_write_fn_attrs(v__gen__c__Gen* g, Array_v_ v__gen__c__Gen_write(g, _SLIT("__NOINLINE ")); } else if (string__eq(attr.name, _SLIT("weak"))) { + bool _t2 = false; + Array_v__ast__Attr _t2_orig = attrs; + int _t2_len = _t2_orig.len; + for (int _t3 = 0; _t3 < _t2_len; ++_t3) { + v__ast__Attr it = ((v__ast__Attr*) _t2_orig.data)[_t3]; + if (string__eq(it.name, _SLIT("export"))) { + _t2 = true; + break; + } + } + if (_t2) { + continue; + } v__gen__c__Gen_write(g, _SLIT("VWEAK ")); } else if (string__eq(attr.name, _SLIT("noreturn"))) { @@ -76596,8 +76913,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_write_fn_attrs(v__gen__c__Gen* g, Array_v_ else { }; } - string _t2 = fn_attrs; - return _t2; + string _t4 = fn_attrs; + return _t4; } VV_LOCAL_SYMBOL string v__gen__c__call_convention_attribute(string cconvention, bool is_cc_msvc) { @@ -78156,7 +78473,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { Array_v__ast__InfixExpr infix_exprs = __new_array_with_default(0, 0, sizeof(v__ast__InfixExpr), 0); for (int i = 0; i < (*node.right._v__ast__ArrayInit).exprs.len; ++i) { - array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.op = v__token__Kind__key_is,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_stmt = 0,.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),}) })); + array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.op = v__token__Kind__key_is,.is_stmt = 0,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,}) })); } v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_sumtype_interface_array(g, infix_exprs); @@ -78178,7 +78495,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { if (Array_v__ast__Type_contains(v__ast__TypeSymbol_sumtype_info(elem_type_.sym).variants, node.left_type)) { - v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.typ = elem_type,.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.expr_type = node.left_type,.has_arg = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = elem_type,.expr_type = node.left_type,.has_arg = 0,}); v__gen__c__Gen_gen_array_contains(g, node.right_type, node.right, v__ast__CastExpr_to_sumtype_v__ast__Expr(&new_node_left)); return; } @@ -78213,7 +78530,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { Array_v__ast__InfixExpr infix_exprs = __new_array_with_default(0, 0, sizeof(v__ast__InfixExpr), 0); for (int i = 0; i < (*node.right._v__ast__ArrayInit).exprs.len; ++i) { - array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.op = v__token__Kind__key_is,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_stmt = 0,.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),}) })); + array_push((array*)&infix_exprs, _MOV((v__ast__InfixExpr[]){ ((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node.left,.right = (*(v__ast__Expr*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).exprs, i)),.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = node.left_type,.right_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, i)),.op = v__token__Kind__key_is,.is_stmt = 0,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,}) })); } v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_sumtype_interface_array(g, infix_exprs); @@ -78230,12 +78547,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 451 /* v.ast.Array */) { - v__ast__Type elem_type = (*right.sym->info._v__ast__Array).elem_type; + if ((right.sym->info)._typ == 479 /* v.ast.ArrayFixed */) { + v__ast__Type elem_type = (*right.sym->info._v__ast__ArrayFixed).elem_type; v__gen__c__Type elem_type_ = v__gen__c__Gen_unwrap(g, elem_type); if (elem_type_.sym->kind == v__ast__Kind__sum_type) { if (Array_v__ast__Type_contains(v__ast__TypeSymbol_sumtype_info(elem_type_.sym).variants, node.left_type)) { - v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.typ = elem_type,.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.expr_type = node.left_type,.has_arg = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__CastExpr new_node_left = ((v__ast__CastExpr){.arg = v__ast__EmptyExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__EmptyExpr, (((v__ast__EmptyExpr){.x = 0,})))),.expr = node.left,.typname = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = elem_type,.expr_type = node.left_type,.has_arg = 0,}); v__gen__c__Gen_gen_array_contains(g, node.right_type, node.right, v__ast__CastExpr_to_sumtype_v__ast__Expr(&new_node_left)); return; } @@ -78654,7 +78971,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } if (skips > 0) { init_styp = /*f*/string__plus(init_styp, _SLIT(" = ")); - init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.typ_str = styp,.typ = utyp,.update_expr = {0},.update_expr_type = 0,.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_update_embed = 0,.has_update_expr = 0,.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),})))))); + init_styp = /*f*/string__plus(init_styp, v__gen__c__Gen_expr_string(g, v__ast__StructInit_to_sumtype_v__ast__Expr(ADDR(v__ast__StructInit, (((v__ast__StructInit){.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.update_expr_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__StructInitField)),.embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ_str = styp,.update_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = utyp,.update_expr_type = 0,.is_short = 0,.is_short_syntax = 0,.unresolved = 0,.is_update_embed = 0,.has_update_expr = 0,})))))); } } strings__Builder_writeln(&dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = dec_fn_dec}}, {_SLIT(" {\n "), /*115 &string*/0xfe10, {.d_s = init_styp}}, {_SLIT(";\n if (!root) {\n const char *error_ptr = cJSON_GetErrorPtr();\n if (error_ptr != NULL) {\n const int error_pos = (int)cJSON_GetErrorPos();\n int maxcontext_chars = 30;\n byte *buf = vcalloc_noscan(maxcontext_chars + 10);\n if(error_pos > 0) {\n int backlines = 1;\n int backchars = error_pos < maxcontext_chars-7 ? (int)error_pos : maxcontext_chars-7 ;\n char *prevline_ptr = (char*)error_ptr;\n while(backchars--){\n char prevc = *(prevline_ptr - 1);\n if(0==prevc){\n break;\n }\n if(10==prevc && !backlines--){\n break;\n }\n prevline_ptr--;\n if(123==prevc) {\n break; // stop at `{` too\n }\n }\n int maxchars = vstrlen_char(prevline_ptr);\n vmemcpy(buf, prevline_ptr, (maxchars < maxcontext_chars ? maxchars : maxcontext_chars));\n }\n return (Option_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){.state = 2,.err = _v_error(tos2(buf)),.data = {0}};\n }\n }\n"), 0, { .d_c = 0 }}}))); @@ -80467,18 +80784,18 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp r.name = tmp; where_expr.left = v__ast__Ident_to_sumtype_v__ast__Expr(&l); where_expr.right = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){ - .pos = r.pos, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = prim, - .is_mut = false, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .next_token = 0, .expr = v__ast__Ident_to_sumtype_v__ast__Expr(&r), + .scope = 0, + .pos = r.pos, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .expr_type = (/* as */ *(v__ast__IdentVar*)__as_cast((r.info)._v__ast__IdentVar,(r.info)._typ, 416) /*expected idx: 416, name: v.ast.IdentVar */ ).typ, .typ = _const_v__ast__int_type, .name_type = 0, + .next_token = 0, .gkind_field = 0, - .scope = 0, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = false, })))); v__ast__SqlExpr arr = ((v__ast__SqlExpr){ .typ = field.typ, @@ -80582,7 +80899,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_table_name(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL v__ast__StructField v__gen__c__Gen_get_struct_field(v__gen__c__Gen* g, string name) { v__ast__Struct info = v__ast__TypeSymbol_struct_info(v__ast__Table_sym(g->table, (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){g->sql_table_name}, &(int[]){ 0 })))); - v__ast__StructField f = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}); + v__ast__StructField f = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; if (string__eq(field.name, name)) { @@ -81121,7 +81438,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; array_push((array*)&_t11, &ti); } _PUSH_MANY(&used_embed_fields, (_t11), _t10, Array_string); - v__ast__StructInit default_init = ((v__ast__StructInit){node.pos,node.name_pos,node.is_short,node.is_short_syntax,node.unresolved,node.pre_comments,node.typ_str,.typ = embed,node.update_expr,node.update_expr_type,node.update_expr_comments,.is_update_embed = true,node.has_update_expr,.fields = init_fields_to_embed,node.embeds,node.generic_types,}); + v__ast__StructInit default_init = ((v__ast__StructInit){node.pre_comments,node.update_expr_comments,.fields = init_fields_to_embed,node.embeds,node.generic_types,node.typ_str,node.update_expr,node.pos,node.name_pos,.typ = embed,node.update_expr_type,node.is_short,node.is_short_syntax,node.unresolved,.is_update_embed = true,node.has_update_expr,}); int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); @@ -81221,7 +81538,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; Option_multi_return_v__ast__StructField_Array_v__ast__Type _t15 = v__ast__Table_find_field_from_embeds(g->table, update_sym, field->name); if (_t15.state != 0) { /*or block*/ IError err = _t15.err; - *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; + *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } multi_return_v__ast__StructField_Array_v__ast__Type mr_6986 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); @@ -81358,39 +81675,39 @@ Option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v_ } string raw_text = (*(string*)_t2.data); - v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.file_path = file_path, - .file_base = os__base(file_path), - .text = raw_text, - .pos = 0, - .line_nr = 0, - .last_nl_pos = -1, - .is_crlf = 0, - .is_inside_string = 0, - .is_inter_start = 0, - .is_inter_end = 0, - .is_enclosed_inter = 0, - .line_comment = (string){.str=(byteptr)"", .is_lit=1}, - .last_lt = -1, - .is_started = 0, - .is_print_line_on_error = true, - .is_print_colored_error = true, - .is_print_rel_paths_on_error = true, - .quote = 0, - .inter_quote = 0, - .nr_lines = 0, - .is_vh = 0, - .is_fmt = pref->is_fmt, - .comments_mode = comments_mode, - .is_inside_toplvl_statement = 0, - .all_tokens = __new_array(0, 0, sizeof(v__token__Token)), - .tidx = 0, - .eofs = 0, - .pref = pref, + v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.all_tokens = __new_array(0, 0, sizeof(v__token__Token)), .error_details = __new_array(0, 0, sizeof(string)), .errors = __new_array(0, 0, sizeof(v__errors__Error)), .warnings = __new_array(0, 0, sizeof(v__errors__Warning)), .notices = __new_array(0, 0, sizeof(v__errors__Notice)), .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .file_path = file_path, + .file_base = os__base(file_path), + .text = raw_text, + .line_comment = (string){.str=(byteptr)"", .is_lit=1}, + .pref = pref, + .pos = 0, + .line_nr = 0, + .last_nl_pos = -1, + .last_lt = -1, + .nr_lines = 0, + .tidx = 0, + .eofs = 0, + .quote = 0, + .inter_quote = 0, + .comments_mode = comments_mode, + .is_crlf = 0, + .is_inside_string = 0, + .is_inter_start = 0, + .is_inter_end = 0, + .is_enclosed_inter = 0, + .is_started = 0, + .is_print_line_on_error = true, + .is_print_colored_error = true, + .is_print_rel_paths_on_error = true, + .is_vh = 0, + .is_fmt = pref->is_fmt, + .is_inside_toplvl_statement = 0, .should_abort = 0, }, sizeof(v__scanner__Scanner))); v__scanner__Scanner_init_scanner(s); @@ -81400,39 +81717,39 @@ Option_v__scanner__Scanner_ptr v__scanner__new_scanner_file(string file_path, v_ } v__scanner__Scanner* v__scanner__new_scanner(string text, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref) { - v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.file_path = _SLIT("internal_memory"), - .file_base = _SLIT("internal_memory"), - .text = text, - .pos = 0, - .line_nr = 0, - .last_nl_pos = -1, - .is_crlf = 0, - .is_inside_string = 0, - .is_inter_start = 0, - .is_inter_end = 0, - .is_enclosed_inter = 0, - .line_comment = (string){.str=(byteptr)"", .is_lit=1}, - .last_lt = -1, - .is_started = 0, - .is_print_line_on_error = true, - .is_print_colored_error = true, - .is_print_rel_paths_on_error = true, - .quote = 0, - .inter_quote = 0, - .nr_lines = 0, - .is_vh = 0, - .is_fmt = pref->is_fmt, - .comments_mode = comments_mode, - .is_inside_toplvl_statement = 0, - .all_tokens = __new_array(0, 0, sizeof(v__token__Token)), - .tidx = 0, - .eofs = 0, - .pref = pref, + v__scanner__Scanner* s = ((v__scanner__Scanner*)memdup(&(v__scanner__Scanner){.all_tokens = __new_array(0, 0, sizeof(v__token__Token)), .error_details = __new_array(0, 0, sizeof(string)), .errors = __new_array(0, 0, sizeof(v__errors__Error)), .warnings = __new_array(0, 0, sizeof(v__errors__Warning)), .notices = __new_array(0, 0, sizeof(v__errors__Notice)), .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .file_path = _SLIT("internal_memory"), + .file_base = _SLIT("internal_memory"), + .text = text, + .line_comment = (string){.str=(byteptr)"", .is_lit=1}, + .pref = pref, + .pos = 0, + .line_nr = 0, + .last_nl_pos = -1, + .last_lt = -1, + .nr_lines = 0, + .tidx = 0, + .eofs = 0, + .quote = 0, + .inter_quote = 0, + .comments_mode = comments_mode, + .is_crlf = 0, + .is_inside_string = 0, + .is_inter_start = 0, + .is_inter_end = 0, + .is_enclosed_inter = 0, + .is_started = 0, + .is_print_line_on_error = true, + .is_print_colored_error = true, + .is_print_rel_paths_on_error = true, + .is_vh = 0, + .is_fmt = pref->is_fmt, + .is_inside_toplvl_statement = 0, .should_abort = 0, }, sizeof(v__scanner__Scanner))); v__scanner__Scanner_init_scanner(s); @@ -81471,13 +81788,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_token(v__scanner_ s->tidx++; int line_offset = (tok_kind == v__token__Kind__hash ? (0) : (1)); v__token__Token _t1 = ((v__token__Token){ - .kind = tok_kind, .lit = lit, .line_nr = s->line_nr + line_offset, .col = v__mathutil__max_T_int(1, v__scanner__Scanner_current_column(s) - len + 1), .pos = s->pos - len + 1, .len = len, .tidx = cidx, + .kind = tok_kind, }); return _t1; } @@ -81485,13 +81802,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_token(v__scanner_ // Attr: [inline] inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_eof_token(v__scanner__Scanner* s) { v__token__Token _t1 = ((v__token__Token){ - .kind = v__token__Kind__eof, .lit = _SLIT(""), .line_nr = s->line_nr + 1, .col = v__scanner__Scanner_current_column(s), .pos = s->pos, .len = 1, .tidx = s->tidx, + .kind = v__token__Kind__eof, }); return _t1; } @@ -81501,13 +81818,13 @@ inline VV_LOCAL_SYMBOL v__token__Token v__scanner__Scanner_new_multiline_token(v int cidx = s->tidx; s->tidx++; v__token__Token _t1 = ((v__token__Token){ - .kind = tok_kind, .lit = lit, .line_nr = start_line + 1, .col = v__mathutil__max_T_int(1, v__scanner__Scanner_current_column(s) - len + 1), .pos = s->pos - len + 1, .len = len, .tidx = cidx, + .kind = tok_kind, }); return _t1; } @@ -82890,19 +83207,19 @@ void v__scanner__Scanner_error(v__scanner__Scanner* s, string msg) { s->should_abort = true; return; } - array_push((array*)&s->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = msg,.details = details,.file_path = s->file_path,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__scanner,}) })); + array_push((array*)&s->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = msg,.details = details,.file_path = s->file_path,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__scanner,}) })); } } VV_LOCAL_SYMBOL void v__scanner__Scanner_vet_error(v__scanner__Scanner* s, string msg, v__vet__FixKind fix) { v__vet__Error ve = ((v__vet__Error){ - .kind = v__vet__ErrorKind__error, .message = msg, .details = (string){.str=(byteptr)"", .is_lit=1}, .file_path = s->file_path, .pos = ((v__token__Pos){.len = 0,.line_nr = s->line_nr,.pos = 0,.col = v__scanner__Scanner_current_column(s) - 1,.last_line = 0,}), .fix = fix, .typ = v__vet__ErrorType__default, + .kind = v__vet__ErrorKind__error, }); array_push((array*)&s->vet_errors, _MOV((v__vet__Error[]){ ve })); } @@ -83429,18 +83746,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } v__ast__Expr r0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(right, 0)); v__ast__Var v = ((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = (*lx._v__ast__Ident).name, + .expr = (left.len == right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(right, i))) : (v__ast__empty_expr())), + .pos = (*lx._v__ast__Ident).pos, + .typ = 0, + .orig_type = 0, .share = share, .is_mut = (*lx._v__ast__Ident).is_mut || p->inside_for, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = 0, .is_inherited = 0, - .expr = (left.len == right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(right, i))) : (v__ast__empty_expr())), - .typ = 0, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = (*lx._v__ast__Ident).pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -83509,14 +83826,14 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__Stmt _t13 = v__ast__AssignStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssignStmt, (((v__ast__AssignStmt){ - .op = op, - .pos = pos, .comments = comments, .end_comments = end_comments, .right = right, .left = left, .left_types = __new_array(0, 0, sizeof(v__ast__Type)), .right_types = __new_array(0, 0, sizeof(v__ast__Type)), + .pos = pos, + .op = op, .is_static = is_static, .is_volatile = is_volatile, .is_simple = p->inside_for && p->tok.kind == v__token__Kind__lcbr, @@ -83594,7 +83911,7 @@ 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) { - v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); + v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = 0,.is_env = 0,.is_pkgconfig = 0,}))); v__parser__Parser_check(p, v__token__Kind__dollar); v__token__Pos start_pos = v__token__Token_pos(&p->prev_tok); string error_msg = _SLIT("only `$tmpl()`, `$env()`, `$embed_file()`, `$pkgconfig()` and `$vweb.html()` comptime functions are supported right now"); @@ -83622,24 +83939,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__parser__Parser_check(p, v__token__Kind__string); v__parser__Parser_check(p, v__token__Kind__rpar); v__ast__ComptimeCall _t3 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = s, - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = true, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = spos, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = true, + .is_pkgconfig = 0, }); return _t3; } @@ -83648,24 +83965,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__parser__Parser_check(p, v__token__Kind__string); v__parser__Parser_check(p, v__token__Kind__rpar); v__ast__ComptimeCall _t4 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = s, - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = spos, - .is_pkgconfig = true, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = true, }); return _t4; } @@ -83712,7 +84029,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } - v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); + v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = ((v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.len = 0,.is_compressed = 0,}),.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = 0,.is_embed = true,.is_env = 0,.is_pkgconfig = 0,}); return _t8; } Array_string fn_path = string_split(p->cur_fn_name, _SLIT("_")); @@ -83737,7 +84054,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } if (!os__exists(path)) { if (p->pref->is_fmt) { - v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); + v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.method_name = method_name,.left = {0},.args_var = literal_string_param,.env_value = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.result_type = 0,.has_parens = 0,.is_vweb = true,.is_embed = 0,.is_env = 0,.is_pkgconfig = 0,}); return _t9; } if (is_html) { @@ -83754,24 +84071,24 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ v__ast__File* file = v__parser__parse_comptime(tmpl_path, v_code, p->table, p->pref, p->scope); file->path = tmpl_path; v__ast__ComptimeCall _t11 = ((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = *file, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = __new_array(0, 0, sizeof(v__ast__CallArg)), .method_name = method_name, - .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .scope = 0, .left = {0}, .args_var = literal_string_param, - .is_vweb = true, - .vweb_tmpl = *file, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = 0, + .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), + .method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = __new_array(0, 0, sizeof(v__ast__CallArg)), - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = true, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = 0, }); return _t11; } @@ -83791,12 +84108,12 @@ VV_LOCAL_SYMBOL v__ast__ComptimeFor v__parser__Parser_comptime_for(v__parser__Pa v__ast__ComptimeForKind kind = v__ast__ComptimeForKind__methods; v__parser__Parser_open_scope(p); if (string__eq(for_val, _SLIT("methods"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FunctionData")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FunctionData")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } else if (string__eq(for_val, _SLIT("fields"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FieldData")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("FieldData")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); kind = v__ast__ComptimeForKind__fields; } else if (string__eq(for_val, _SLIT("attributes"))) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = v__ast__Table_find_type_idx(p->table, _SLIT("StructAttribute")),.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var,.expr = {0},.pos = var_pos,.typ = v__ast__Table_find_type_idx(p->table, _SLIT("StructAttribute")),.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); kind = v__ast__ComptimeForKind__attributes; } else { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown kind `"), /*115 &string*/0xfe10, {.d_s = for_val}}, {_SLIT("`, available are: `methods`, `fields` or `attributes`"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->prev_tok)); @@ -83840,24 +84157,24 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars v__parser__Parser_check(p, v__token__Kind__lcbr); } v__ast__Expr _t1 = v__ast__ComptimeCall_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeCall, (((v__ast__ComptimeCall){ - .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), - .has_parens = 0, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .embed_file = (v__ast__EmbeddedFile){.bytes = __new_array(0, 0, sizeof(u8)),.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.len = 0,.is_compressed = 0,}, + .args = args, .method_name = method_name, - .method_pos = method_pos, - .scope = p->scope, .left = left, .args_var = _SLIT(""), - .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, - .is_embed = 0, - .is_env = 0, + .env_value = (string){.str=(byteptr)"", .is_lit=1}, + .scope = p->scope, + .pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)), + .method_pos = method_pos, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .is_pkgconfig = 0, .left_type = 0, .result_type = 0, - .env_value = (string){.str=(byteptr)"", .is_lit=1}, - .args = args, - .embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}, + .has_parens = 0, + .is_vweb = 0, + .is_embed = 0, + .is_env = 0, + .is_pkgconfig = 0, })))); return _t1; } @@ -83872,7 +84189,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars if (has_parens) { v__parser__Parser_check(p, v__token__Kind__rpar); } - v__ast__Expr _t2 = v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeSelector, (((v__ast__ComptimeSelector){.has_parens = has_parens,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.left = left,.left_type = 0,.field_expr = expr,.typ = 0,})))); + v__ast__Expr _t2 = v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(ADDR(v__ast__ComptimeSelector, (((v__ast__ComptimeSelector){.left = left,.field_expr = expr,.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.left_type = 0,.typ = 0,.has_parens = has_parens,})))); return _t2; } @@ -83924,7 +84241,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser int line_nr = p->tok.line_nr; last_pos = v__token__Token_pos(&p->tok); v__parser__Parser_check(p, v__token__Kind__rsbr); - if (exprs.len == 1 && (p->tok.kind == v__token__Kind__name || p->tok.kind == v__token__Kind__amp || p->tok.kind == v__token__Kind__lsbr) && p->tok.line_nr == line_nr) { + if (exprs.len == 1 && p->tok.line_nr == line_nr && ((p->tok.kind == v__token__Kind__name || p->tok.kind == v__token__Kind__amp) || (p->tok.kind == v__token__Kind__lsbr && v__parser__Parser_is_array_type(p)))) { elem_type = v__parser__Parser_parse_type(p); if (string__eq(v__ast__Table_sym(p->table, elem_type)->name, _SLIT("byte"))) { v__parser__Parser_error(p, _SLIT("`byte` has been deprecated in favor of `u8`: use `[10]u8{}` instead of `[10]byte{}`")); @@ -83938,7 +84255,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser string n = v__parser__Parser_check_name(p); if (!string__eq(n, _SLIT("init"))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected `init:`, not `"), /*115 &string*/0xfe10, {.d_s = n}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); - v__ast__ArrayInit _t4 = ((v__ast__ArrayInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.is_fixed = 0,.has_val = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.len_expr = {0},.cap_expr = {0},.default_expr = {0},.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.elem_type = 0,.default_type = 0,.typ = 0,}); + v__ast__ArrayInit _t4 = ((v__ast__ArrayInit){.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.len_expr = {0},.cap_expr = {0},.default_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type = 0,.default_type = 0,.typ = 0,.is_fixed = 0,.has_val = 0,.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,}); return _t4; } v__parser__Parser_check(p, v__token__Kind__colon); @@ -84026,7 +84343,7 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser } else { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("wrong field `"), /*115 &string*/0xfe10, {.d_s = key}}, {_SLIT("`, expecting `len`, `cap`, or `init`"), 0, { .d_c = 0 }}}))); - v__ast__ArrayInit _t9 = ((v__ast__ArrayInit){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.is_fixed = 0,.has_val = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.len_expr = {0},.cap_expr = {0},.default_expr = {0},.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.elem_type = 0,.default_type = 0,.typ = 0,}); + v__ast__ArrayInit _t9 = ((v__ast__ArrayInit){.ecmnts = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.expr_types = __new_array(0, 0, sizeof(v__ast__Type)),.mod = (string){.str=(byteptr)"", .is_lit=1},.len_expr = {0},.cap_expr = {0},.default_expr = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.elem_type = 0,.default_type = 0,.typ = 0,.is_fixed = 0,.has_val = 0,.has_len = 0,.has_cap = 0,.has_default = 0,.has_it = 0,}); return _t9; }; if (p->tok.kind != v__token__Kind__rcbr) { @@ -84037,25 +84354,25 @@ VV_LOCAL_SYMBOL v__ast__ArrayInit v__parser__Parser_array_init(v__parser__Parser } v__token__Pos pos = v__token__Pos_extend_with_last_line(first_pos, last_pos, p->prev_tok.line_nr); v__ast__ArrayInit _t10 = ((v__ast__ArrayInit){ - .pos = pos, - .elem_type_pos = elem_type_pos, .ecmnts = ecmnts, .pre_cmnts = pre_cmnts, + .exprs = exprs, + .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), + .mod = p->mod, + .len_expr = len_expr, + .cap_expr = cap_expr, + .default_expr = default_expr, + .pos = pos, + .elem_type_pos = elem_type_pos, + .elem_type = elem_type, + .default_type = 0, + .typ = array_type, .is_fixed = is_fixed, .has_val = has_val, - .mod = p->mod, .has_len = has_len, .has_cap = has_cap, .has_default = has_default, .has_it = has_it, - .exprs = exprs, - .len_expr = len_expr, - .cap_expr = cap_expr, - .default_expr = default_expr, - .expr_types = __new_array(0, 0, sizeof(v__ast__Type)), - .elem_type = elem_type, - .default_type = 0, - .typ = array_type, }); return _t10; } @@ -84078,12 +84395,12 @@ VV_LOCAL_SYMBOL v__ast__MapInit v__parser__Parser_map_init(v__parser__Parser* p) } array_push((array*)&comments, _MOV((Array_v__ast__Comment[]){ v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})) })); } - v__ast__MapInit _t4 = ((v__ast__MapInit){.pos = v__token__Pos_extend_with_last_line(first_pos, v__token__Token_pos(&p->tok), p->tok.line_nr),.comments = comments,.pre_cmnts = pre_cmnts,.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = 0,.key_type = 0,.value_type = 0,}); + v__ast__MapInit _t4 = ((v__ast__MapInit){.comments = comments,.pre_cmnts = pre_cmnts,.keys = keys,.vals = vals,.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Pos_extend_with_last_line(first_pos, v__token__Token_pos(&p->tok), p->tok.line_nr),.typ = 0,.key_type = 0,.value_type = 0,}); return _t4; } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_it_as_index(v__parser__Parser* p) { - map_set(&p->scope->objects, &(string[]){_SLIT("it")}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = false,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = false,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))) }); + map_set(&p->scope->objects, &(string[]){_SLIT("it")}, &(v__ast__ScopeObject[]) { v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = false,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = false,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,})))) }); } v__ast__Expr v__parser__Parser_expr(v__parser__Parser* p, int precedence) { @@ -84326,7 +84643,7 @@ bool inside_array_lit; v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.typ = typ,.expr = expr,.typname = typname,.expr_type = 0,.has_arg = 0,.pos = pos,})))); + node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){.arg = {0},.expr = expr,.typname = typname,.pos = pos,.typ = typ,.expr_type = 0,.has_arg = 0,})))); } else { node = v__ast__ArrayInit_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayInit, (v__parser__Parser_array_init(p)))); } @@ -84382,7 +84699,7 @@ bool inside_array_lit; if (p->tok.kind != v__token__Kind__dot && p->tok.line_nr == p->prev_tok.line_nr) { v__parser__Parser_warn_with_pos(p, _SLIT("use e.g. `typeof(expr).name` or `sum_type_instance.type_name()` instead"), spos); } - node = v__ast__TypeOf_to_sumtype_v__ast__Expr(ADDR(v__ast__TypeOf, (((v__ast__TypeOf){.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr = expr,.expr_type = 0,})))); + node = v__ast__TypeOf_to_sumtype_v__ast__Expr(ADDR(v__ast__TypeOf, (((v__ast__TypeOf){.expr = expr,.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; } case v__token__Kind__key_dump: @@ -84392,7 +84709,7 @@ bool inside_array_lit; v__parser__Parser_check(p, v__token__Kind__lpar); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr = expr,.expr_type = 0,.cname = (string){.str=(byteptr)"", .is_lit=1},})))); + node = v__ast__DumpExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__DumpExpr, (((v__ast__DumpExpr){.expr = expr,.cname = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->tok)),.expr_type = 0,})))); break; } case v__token__Kind__key_offsetof: @@ -84415,7 +84732,7 @@ bool inside_array_lit; string field = p->tok.lit; v__parser__Parser_next(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__OffsetOf_to_sumtype_v__ast__Expr(ADDR(v__ast__OffsetOf, (((v__ast__OffsetOf){.struct_type = st,.field = field,.pos = pos,})))); + node = v__ast__OffsetOf_to_sumtype_v__ast__Expr(ADDR(v__ast__OffsetOf, (((v__ast__OffsetOf){.field = field,.pos = pos,.struct_type = st,})))); break; } case v__token__Kind__key_likely: @@ -84456,7 +84773,7 @@ bool inside_array_lit; v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT("anon"),.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = _SLIT("anon"),.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); } Option_v__ast__Expr _t11; opt_ok(&(v__ast__Expr[]) { node }, (Option*)(&_t11), sizeof(v__ast__Expr)); @@ -84610,7 +84927,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); p->is_stmt_ident = is_stmt_ident; } } else if (p->tok.kind == v__token__Kind__key_as) { @@ -84632,7 +84949,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((node)._typ == 309 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } - node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.op = tok.kind,.pos = pos,.is_stmt = true,.left = node,.right = right,.left_type = 0,.right_type = 0,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),})))); + node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.right = right,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value = v__ast__empty_comptime_const_expr(),.pos = pos,.left_type = 0,.right_type = 0,.op = tok.kind,.is_stmt = true,.ct_left_value_evaled = 0,.ct_right_value_evaled = 0,})))); } else if (v__token__Kind_is_infix(p->tok.kind)) { if (v__token__Kind_is_prefix(p->tok.kind) && p->tok.line_nr != p->prev_tok.line_nr) { if (p->tok.kind == v__token__Kind__mul && v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__assign) { @@ -84707,7 +85024,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -84722,19 +85039,19 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__Expr _t2 = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){ - .op = op, - .pos = pos, - .is_stmt = p->is_stmt_ident, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), .left = left, .right = right, + .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, + .ct_left_value = v__ast__empty_comptime_const_expr(), + .ct_right_value = v__ast__empty_comptime_const_expr(), + .pos = pos, .left_type = 0, .right_type = 0, - .auto_locked = (string){.str=(byteptr)"", .is_lit=1}, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .op = op, + .is_stmt = p->is_stmt_ident, .ct_left_value_evaled = 0, - .ct_left_value = v__ast__empty_comptime_const_expr(), .ct_right_value_evaled = 0, - .ct_right_value = v__ast__empty_comptime_const_expr(), })))); return _t2; } @@ -84793,7 +85110,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -84807,7 +85124,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) p->or_is_handled = false; } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__Expr _t4 = v__ast__PrefixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PrefixExpr, (((v__ast__PrefixExpr){.op = op,.pos = pos,.right_type = 0,.right = right,.or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.is_option = 0,})))); + v__ast__Expr _t4 = v__ast__PrefixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PrefixExpr, (((v__ast__PrefixExpr){.or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.right = right,.pos = pos,.right_type = 0,.op = op,.is_option = 0,})))); return _t4; } @@ -84852,7 +85169,7 @@ string old_expr_mod; p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -84873,33 +85190,33 @@ string old_expr_mod; Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__CallExpr _t1 = ((v__ast__CallExpr){ - .pos = pos, - .name_pos = first_pos, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .args = args, + .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), + .concrete_types = concrete_types, + .raw_concrete_types = concrete_types, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .comments = comments, .mod = p->mod, .name = fn_name, + .left = {0}, + .scope = p->scope, + .pos = pos, + .name_pos = first_pos, + .concrete_list_pos = concrete_list_pos, + .left_type = 0, + .receiver_type = 0, + .return_type = 0, + .fn_var_type = 0, + .language = language, .is_method = 0, .is_field = 0, .is_fn_var = 0, .is_keep_alive = 0, .is_noreturn = 0, .is_ctor_new = 0, - .args = args, - .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), - .language = language, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), - .left = {0}, - .left_type = 0, - .receiver_type = 0, - .return_type = 0, - .fn_var_type = 0, .should_be_skipped = 0, - .concrete_types = concrete_types, - .concrete_list_pos = concrete_list_pos, - .raw_concrete_types = concrete_types, .free_receiver = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), - .comments = comments, }); // Defer begin if (v__parser__Parser_call_expr_defer_0) { @@ -84947,7 +85264,7 @@ Array_v__ast__CallArg v__parser__Parser_call_args(v__parser__Parser* p) { } v__token__Pos pos = v__token__Pos_extend(arg_start_pos, v__token__Token_pos(&p->prev_tok)); _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t3, Array_v__ast__Comment); - array_push((array*)&args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.is_mut = is_mut,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.comments = comments,.expr = expr,.typ = 0,.is_tmp_autofree = 0,.pos = pos,}) })); + array_push((array*)&args, _MOV((v__ast__CallArg[]){ ((v__ast__CallArg){.comments = comments,.expr = expr,.pos = pos,.typ = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.is_mut = is_mut,.is_tmp_autofree = 0,}) })); if (p->tok.kind != v__token__Kind__rpar) { v__parser__Parser_check(p, v__token__Kind__comma); } @@ -85075,7 +85392,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { Option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t6; } @@ -85089,7 +85406,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); @@ -85102,14 +85419,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t9; } } @@ -85123,7 +85440,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8890 = v__parser__Parser_parse_generic_types(p); @@ -85163,23 +85480,23 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = param.name, + .expr = {0}, + .pos = param.pos, + .typ = param.typ, + .orig_type = 0, .share = 0, .is_mut = param.is_mut, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = param.is_mut || param.is_auto_rec, .is_inherited = 0, - .expr = {0}, - .typ = param.typ, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = param.pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -85214,12 +85531,26 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ - .is_variadic = is_variadic, + .params = params, + .generic_names = generic_names, + .attrs = p->attrs, + .mod = p->mod, + .file = p->file_name, + .name = name, + .pos = start_pos, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type = return_type, + .receiver_type = rec.typ, + .usages = 0, + .ctdefine_idx = conditional_ctdefine_idx, + .source_fn = 0, .language = language, + .file_mode = file_mode, + .is_variadic = is_variadic, .is_pub = is_pub, .is_ctor_new = 0, .is_deprecated = is_deprecated, @@ -85231,21 +85562,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_method = true, .no_body = no_body, - .mod = p->mod, - .file = p->file_name, - .file_mode = file_mode, - .pos = start_pos, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type = return_type, - .receiver_type = rec.typ, - .name = name, - .params = params, - .source_fn = 0, - .usages = 0, - .generic_names = generic_names, - .attrs = p->attrs, .is_conditional = conditional_ctdefine_idx != _const_v__ast__invalid_type_idx, - .ctdefine_idx = conditional_ctdefine_idx, })); } else { if (language == v__ast__Language__c) { @@ -85278,8 +85595,22 @@ 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){ - .is_variadic = is_variadic, + .params = params, + .generic_names = generic_names, + .attrs = p->attrs, + .mod = p->mod, + .file = p->file_name, + .name = name, + .pos = start_pos, + .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 = conditional_ctdefine_idx, + .source_fn = 0, .language = language, + .file_mode = file_mode, + .is_variadic = is_variadic, .is_pub = is_pub, .is_ctor_new = is_ctor_new, .is_deprecated = is_deprecated, @@ -85291,21 +85622,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_method = false, .no_body = no_body, - .mod = p->mod, - .file = p->file_name, - .file_mode = file_mode, - .pos = start_pos, - .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, - .name = name, - .params = params, - .source_fn = 0, - .usages = 0, - .generic_names = generic_names, - .attrs = p->attrs, .is_conditional = conditional_ctdefine_idx != _const_v__ast__invalid_type_idx, - .ctdefine_idx = conditional_ctdefine_idx, })); } p->cur_fn_name = name; @@ -85323,13 +85640,39 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.language = 0,.file_mode = 0,.rec_share = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ + .receiver = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = rec.name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = rec.typ,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}), + .generic_names = generic_names, + .attrs = p->attrs, + .params = params, + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = comments, + .end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, .name = name, .short_name = short_fn_name, .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = rec.pos, + .method_type_pos = rec.type_pos, + .body_pos = body_start_pos, + .return_type_pos = return_type_pos, + .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), + .method_idx = type_sym_method_idx, + .ctdefine_idx = conditional_ctdefine_idx, + .idx = 0, + .return_type = return_type, + .ninstances = 0, + .language = language, + .file_mode = 0, + .rec_share = 0, .is_deprecated = is_deprecated, .is_pub = is_pub, .is_variadic = is_variadic, @@ -85343,40 +85686,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_keep_alive = is_keep_alive, .is_unsafe = is_unsafe, .is_markused = is_markused, - .receiver = ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = rec.name,.typ = rec.typ,}), - .receiver_pos = rec.pos, .is_method = is_method, - .method_type_pos = rec.type_pos, - .method_idx = type_sym_method_idx, .rec_mut = rec.is_mut, - .rec_share = 0, - .language = language, - .file_mode = 0, .no_body = no_body, .is_builtin = p->builtin_mod || Array_string_contains(_const_v__util__builtin_module_parts, p->mod), - .body_pos = body_start_pos, - .file = p->file_name, - .generic_names = generic_names, .is_direct_arr = is_direct_arr, - .attrs = p->attrs, - .ctdefine_idx = conditional_ctdefine_idx, - .idx = 0, - .params = params, - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = return_type, - .return_type_pos = return_type_pos, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = comments, - .end_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = p->label_names, - .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), }); if (generic_names.len > 0) { v__ast__Table_register_fn_generic_types(p->table, v__ast__FnDecl_fkey(&fn_decl)); @@ -85463,13 +85780,13 @@ bool v__parser__Parser_fn_receiver_defer_0 = false; rec->typ = v__ast__Type_deref(rec->typ); } array_push((array*)params, _MOV((v__ast__Param[]){ ((v__ast__Param){ - .pos = rec_start_pos, .name = rec->name, + .pos = rec_start_pos, + .type_pos = rec->type_pos, + .typ = rec->typ, .is_mut = rec->is_mut, .is_auto_rec = is_auto_rec, - .type_pos = rec->type_pos, .is_hidden = 0, - .typ = rec->typ, }) })); // Defer begin if (v__parser__Parser_fn_receiver_defer_0) { @@ -85485,7 +85802,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->pref->is_script && p->tok.kind == v__token__Kind__name) { v__parser__Parser_error_with_pos(p, _SLIT("function declarations in script mode should be before all script statements"), v__token__Token_pos(&p->tok)); - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } bool old_inside_defer = p->inside_defer; @@ -85504,18 +85821,18 @@ bool v__parser__Parser_anon_fn_defer_0 = false; } bool is_stack_obj = !v__ast__Type_has_flag(arg.typ, v__ast__TypeFlag__shared_f) && (arg.is_mut || v__ast__Type_is_ptr(arg.typ)); v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = arg.name, + .expr = {0}, + .pos = arg.pos, + .typ = arg.typ, + .orig_type = 0, .share = 0, .is_mut = arg.is_mut, .is_autofree_tmp = 0, .is_arg = true, .is_auto_deref = 0, .is_inherited = 0, - .expr = {0}, - .typ = arg.typ, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = arg.pos, .is_used = true, .is_changed = 0, .is_or = 0, @@ -85542,7 +85859,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){.is_variadic = is_variadic,.language = 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 = false,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.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,.name = (string){.str=(byteptr)"", .is_lit=1},.params = args,.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 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,}); 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; @@ -85559,9 +85876,35 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__ast__Type typ = v__ast__new_type(idx); p->inside_defer = old_inside_defer; v__ast__AnonFn _t3 = ((v__ast__AnonFn){.decl = ((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = args, + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = label_names, .name = name, .short_name = _SLIT(""), .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = return_type_pos, + .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = return_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = is_variadic, @@ -85575,40 +85918,14 @@ bool v__parser__Parser_anon_fn_defer_0 = false; .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = false, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = no_body, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = args, - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = return_type, - .return_type_pos = return_type_pos, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = label_names, - .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), }),.inherited_vars = inherited_vars,.typ = typ,.has_gen = 0,}); // Defer begin if (v__parser__Parser_anon_fn_defer_0) { @@ -85687,7 +86004,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_ if (alanguage != v__ast__Language__v) { v__parser__Parser_check_for_impure_v(p, alanguage, pos); } - array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = pos,.name = _SLIT(""),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = pos,.is_hidden = 0,.typ = arg_type,}) })); + array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = _SLIT(""),.pos = pos,.type_pos = pos,.typ = arg_type,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); arg_no++; if (arg_no > 1024) { v__parser__Parser_error_with_pos(p, _SLIT("too many args"), pos); @@ -85772,7 +86089,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Param_bool_bool v__parser__Parser_fn_ if (alanguage != v__ast__Language__v) { v__parser__Parser_check_for_impure_v(p, alanguage, (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i))); } - array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i)),.name = arg_name,.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i)),.is_hidden = 0,.typ = typ,}) })); + array_push((array*)&args, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = arg_name,.pos = (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i)),.type_pos = (*(v__token__Pos*)/*ee elem_sym */array_get(type_pos, i)),.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); if (is_variadic && p->tok.kind == v__token__Kind__comma) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot use ...(variadic) with non-final parameter "), /*115 &string*/0xfe10, {.d_s = arg_name}}, {_SLIT0, 0, { .d_c = 0 }}})), (*(v__token__Pos*)/*ee elem_sym */array_get(arg_pos, i))); return (multi_return_Array_v__ast__Param_bool_bool){.arg0=__new_array_with_default(0, 0, sizeof(v__ast__Param), 0), .arg1=false, .arg2=false}; @@ -85800,13 +86117,13 @@ VV_LOCAL_SYMBOL v__ast__GoExpr v__parser__Parser_go_expr(v__parser__Parser* p) { _t1 = (*expr._v__ast__CallExpr); } else { v__parser__Parser_error_with_pos(p, _SLIT("expression in `go` must be a function call"), v__ast__Expr_pos(expr)); - _t1 = ((v__ast__CallExpr){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = {0},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + _t1 = ((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,}); } v__ast__CallExpr call_expr = _t1; v__token__Pos pos = v__token__Pos_extend(spos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_register_auto_import(p, _SLIT("sync.threads")); p->table->gostmts++; - v__ast__GoExpr _t2 = ((v__ast__GoExpr){.pos = pos,.call_expr = call_expr,.is_expr = 0,}); + v__ast__GoExpr _t2 = ((v__ast__GoExpr){.call_expr = call_expr,.pos = pos,.is_expr = 0,}); return _t2; } @@ -85835,8 +86152,8 @@ VV_LOCAL_SYMBOL Array_v__ast__Param v__parser__Parser_closure_vars(v__parser__Pa if (is_mut) { var->is_changed = true; } - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){(*var).name,(*var).share,.is_mut = is_mut,(*var).is_autofree_tmp,(*var).is_arg,(*var).is_auto_deref,.is_inherited = true,(*var).expr,(*var).typ,(*var).orig_type,(*var).smartcasts,.pos = var_pos,.is_used = false,.is_changed = false,(*var).is_or,(*var).is_tmp,(*var).is_auto_heap,(*var).is_stack_obj,}))))); - array_push((array*)&vars, _MOV((v__ast__Param[]){ ((v__ast__Param){.pos = var_pos,.name = var_name,.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = 0,.typ = 0,}) })); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){(*var).smartcasts,(*var).name,(*var).expr,.pos = var_pos,(*var).typ,(*var).orig_type,(*var).share,.is_mut = is_mut,(*var).is_autofree_tmp,(*var).is_arg,(*var).is_auto_deref,.is_inherited = true,.is_used = false,.is_changed = false,(*var).is_or,(*var).is_tmp,(*var).is_auto_heap,(*var).is_stack_obj,}))))); + array_push((array*)&vars, _MOV((v__ast__Param[]){ ((v__ast__Param){.name = var_name,.pos = var_pos,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = 0,}) })); if (p->tok.kind != v__token__Kind__comma) { break; } @@ -85997,7 +86314,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { v__ast__Stmt _t8 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of value iteration variable `"), /*115 &string*/0xfe10, {.d_s = val_var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})))))); return _t8; } - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = key_var_name,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = key_var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = key_var_name,.expr = {0},.pos = key_var_pos,.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); } else if (v__ast__Scope_known_var(p->scope, val_var_name)) { v__ast__Stmt _t9 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of value iteration variable `"), /*115 &string*/0xfe10, {.d_s = val_var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})))))); return _t9; @@ -86014,7 +86331,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { is_range = true; v__parser__Parser_next(p); high_expr = v__parser__Parser_expr(p, 0); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = val_var_name,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__int_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = val_var_pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = val_var_name,.expr = {0},.pos = val_var_pos,.typ = _const_v__ast__int_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = true,.is_auto_heap = 0,.is_stack_obj = true,}))))); if (key_var_name.len > 0) { v__ast__Stmt _t11 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("cannot declare index variable with range `for`"), key_var_pos)))); return _t11; @@ -86025,18 +86342,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { } } else { v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){ + .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), .name = val_var_name, + .expr = {0}, + .pos = val_var_pos, + .typ = 0, + .orig_type = 0, .share = 0, .is_mut = val_is_mut, .is_autofree_tmp = 0, .is_arg = 0, .is_auto_deref = val_is_mut, .is_inherited = 0, - .expr = {0}, - .typ = 0, - .orig_type = 0, - .smartcasts = __new_array(0, 0, sizeof(v__ast__Type)), - .pos = val_var_pos, .is_used = 0, .is_changed = 0, .is_or = 0, @@ -86049,21 +86366,21 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_for_stmt(v__parser__Parser* p) { Array_v__ast__Stmt stmts = v__parser__Parser_parse_block_no_scope(p, false); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); v__ast__ForInStmt for_in_stmt = ((v__ast__ForInStmt){ + .stmts = stmts, .key_var = key_var_name, .val_var = val_var_name, - .is_range = is_range, .high = high_expr, - .stmts = stmts, - .pos = pos, - .val_is_mut = val_is_mut, .cond = cond, + .label = (string){.str=(byteptr)"", .is_lit=1}, + .scope = p->scope, + .pos = pos, .key_type = 0, .val_type = 0, .cond_type = 0, .high_type = 0, .kind = 0, - .label = (string){.str=(byteptr)"", .is_lit=1}, - .scope = p->scope, + .is_range = is_range, + .val_is_mut = val_is_mut, }); v__parser__Parser_close_scope(p); v__ast__Stmt _t13 = v__ast__ForInStmt_to_sumtype_v__ast__Stmt(&for_in_stmt); @@ -86110,7 +86427,7 @@ bool was_inside_ct_if_expr; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t2, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__key_match) { v__parser__Parser_error(p, _SLIT("cannot use `match` with `if` statements")); - v__ast__IfExpr _t3 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t3 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -86126,7 +86443,7 @@ bool was_inside_ct_if_expr; v__token__Pos body_pos = v__token__Token_pos(&p->tok); v__parser__Parser_open_scope(p); if (prev_guard) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); } array_push((array*)&branches, _MOV((v__ast__IfBranch[]){ ((v__ast__IfBranch){.pos = v__token__Pos_extend(start_pos, end_pos),.body_pos = v__token__Pos_extend(body_pos, v__token__Token_pos(&p->tok)),.comments = comments,.cond = {0},.pkg_exist = 0,.stmts = v__parser__Parser_parse_block_no_scope(p, false),.scope = p->scope,}) })); v__parser__Parser_close_scope(p); @@ -86140,7 +86457,7 @@ bool was_inside_ct_if_expr; v__parser__Parser_check(p, v__token__Kind__key_if); if (p->tok.kind == v__token__Kind__key_match) { v__parser__Parser_error(p, _SLIT("cannot use `match` with `if` statements")); - v__ast__IfExpr _t5 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t5 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -86185,7 +86502,7 @@ bool was_inside_ct_if_expr; cond = v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IfGuardExpr, (((v__ast__IfGuardExpr){.vars = vars,.expr = expr,.expr_type = 0,})))); for (int _t10 = 0; _t10 < vars.len; ++_t10) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)vars.data)[_t10]; - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = var.name,.share = 0,.is_mut = var.is_mut,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = cond,.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = var.pos,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = var.name,.expr = cond,.pos = var.pos,.typ = 0,.orig_type = 0,.share = 0,.is_mut = var.is_mut,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = 0,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } prev_guard = true; } else { @@ -86223,7 +86540,7 @@ bool was_inside_ct_if_expr; if (is_comptime) { if (p->tok.kind == v__token__Kind__key_else) { v__parser__Parser_error(p, _SLIT("use `$else` instead of `else` in compile-time `if` branches")); - v__ast__IfExpr _t14 = ((v__ast__IfExpr){.is_comptime = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.left = {0},.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.is_expr = 0,.typ = 0,.has_else = 0,}); + v__ast__IfExpr _t14 = ((v__ast__IfExpr){.post_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__IfBranch)),.left = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.tok_kind = 0,.is_comptime = 0,.is_expr = 0,.has_else = 0,}); // Defer begin if (v__parser__Parser_if_expr_defer_0) { p->inside_if_expr = was_inside_if_expr; @@ -86245,14 +86562,14 @@ bool was_inside_ct_if_expr; pos.last_line = (*(v__ast__Comment*)array_last(comments)).pos.last_line; } v__ast__IfExpr _t15 = ((v__ast__IfExpr){ - .is_comptime = is_comptime, - .tok_kind = 0, - .pos = pos, .post_comments = comments, - .left = {0}, .branches = branches, - .is_expr = is_expr, + .left = {0}, + .pos = pos, .typ = 0, + .tok_kind = 0, + .is_comptime = is_comptime, + .is_expr = is_expr, .has_else = has_else, }); // Defer begin @@ -86338,12 +86655,12 @@ VV_LOCAL_SYMBOL v__ast__MatchExpr v__parser__Parser_match_expr(v__parser__Parser p->inside_match_case = false; if (p->tok.kind == v__token__Kind__dotdot) { v__parser__Parser_error_with_pos(p, _SLIT("match only supports inclusive (`...`) ranges, not exclusive (`..`)"), v__token__Token_pos(&p->tok)); - v__ast__MatchExpr _t5 = ((v__ast__MatchExpr){.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.cond = {0},.branches = __new_array(0, 0, sizeof(v__ast__MatchBranch)),.is_expr = 0,.return_type = 0,.cond_type = 0,.expected_type = 0,.is_sum_type = 0,}); + v__ast__MatchExpr _t5 = ((v__ast__MatchExpr){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.branches = __new_array(0, 0, sizeof(v__ast__MatchBranch)),.cond = {0},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.cond_type = 0,.expected_type = 0,.tok_kind = 0,.is_expr = 0,.is_sum_type = 0,}); return _t5; } else if (p->tok.kind == v__token__Kind__ellipsis) { v__parser__Parser_next(p); v__ast__Expr expr2 = v__parser__Parser_expr(p, 0); - array_push((array*)&exprs, _MOV((v__ast__Expr[]){ v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = true,.has_low = true,.pos = v__token__Token_pos(&p->tok),.is_gated = 0,.low = expr,.high = expr2,})))) })); + array_push((array*)&exprs, _MOV((v__ast__Expr[]){ v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = expr,.high = expr2,.pos = v__token__Token_pos(&p->tok),.has_high = true,.has_low = true,.is_gated = 0,})))) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); } @@ -86394,7 +86711,7 @@ VV_LOCAL_SYMBOL v__ast__MatchExpr v__parser__Parser_match_expr(v__parser__Parser v__parser__Parser_check(p, v__token__Kind__rcbr); } v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__MatchExpr _t9 = ((v__ast__MatchExpr){.tok_kind = 0,.pos = pos,.comments = comments,.cond = cond,.branches = branches,.is_expr = 0,.return_type = 0,.cond_type = 0,.expected_type = 0,.is_sum_type = is_sum_type,}); + v__ast__MatchExpr _t9 = ((v__ast__MatchExpr){.comments = comments,.branches = branches,.cond = cond,.pos = pos,.return_type = 0,.cond_type = 0,.expected_type = 0,.tok_kind = 0,.is_expr = 0,.is_sum_type = is_sum_type,}); return _t9; } @@ -86525,13 +86842,13 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars pos.last_line = (*(v__ast__Comment*)array_last(post_comments)).pos.last_line; } array_push((array*)&branches, _MOV((v__ast__SelectBranch[]){ ((v__ast__SelectBranch){ - .pos = pos, .comment = comment, + .post_comments = post_comments, + .stmts = stmts, + .stmt = stmt, + .pos = pos, .is_else = is_else, .is_timeout = is_timeout, - .post_comments = post_comments, - .stmt = stmt, - .stmts = stmts, }) })); if (p->tok.kind == v__token__Kind__rcbr || ((is_else || is_timeout) && no_lcbr)) { break; @@ -86564,33 +86881,33 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_lockable(v__parser__Parser* p) { v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)); } v__ast__Expr expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){ - .language = v__ast__Language__v, - .tok_kind = 0, - .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, 0)), - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = 0, - .scope = p->scope, .obj = {0}, .mod = p->mod, .name = (*(string*)/*ee elem_sym */array_get(names, 0)), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))), + .scope = p->scope, + .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, 0)), + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = 0, + .language = v__ast__Language__v, .kind = 0, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,.share = 0,})))), + .comptime = 0, .is_mut = true, })))); for (int i = 1; i < names.len; i++) { expr = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){ - .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, i)), + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = (*(string*)/*ee elem_sym */array_get(names, i)), - .is_mut = true, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .next_token = (i < names.len - 1 ? (v__token__Kind__dot) : (p->tok.kind)), .expr = expr, + .scope = p->scope, + .pos = (*(v__token__Pos*)/*ee elem_sym */array_get(positions, i)), + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .expr_type = 0, .typ = 0, .name_type = 0, + .next_token = (i < names.len - 1 ? (v__token__Kind__dot) : (p->tok.kind)), .gkind_field = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = true, })))); } v__ast__Expr _t3 = expr; @@ -86978,8 +87295,22 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) return_type_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->prev_tok)); } v__ast__Fn func = ((v__ast__Fn){ - .is_variadic = is_variadic, + .params = args, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = p->attrs, + .mod = (string){.str=(byteptr)"", .is_lit=1}, + .file = (string){.str=(byteptr)"", .is_lit=1}, + .name = name, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = return_type_pos, + .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, @@ -86991,21 +87322,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name) .is_keep_alive = 0, .is_method = false, .no_body = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, - .file = (string){.str=(byteptr)"", .is_lit=1}, - .file_mode = 0, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type_pos = return_type_pos, - .return_type = return_type, - .receiver_type = 0, - .name = name, - .params = args, - .source_fn = 0, - .usages = 0, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = p->attrs, .is_conditional = 0, - .ctdefine_idx = 0, }); bool has_decl = p->builtin_mod && string_starts_with(name, _SLIT("Map")) && string_ends_with(name, _SLIT("Fn")); int idx = v__ast__Table_find_or_register_fn_type(p->table, p->mod, func, false, has_decl); @@ -87074,7 +87391,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) { v__ast__Type _t5 = v__ast__new_type(idx); return _t5; } - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = true,.is_generic = 0,.variants = variant_types,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))),.kind = v__ast__Kind__sum_type,.name = prepend_mod_name,.cname = v__util__no_dots(prepend_mod_name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = 0,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = variant_types,.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = true,.is_generic = 0,})))),.name = prepend_mod_name,.cname = v__util__no_dots(prepend_mod_name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__sum_type,.language = 0,.is_pub = 0,})); v__ast__Type _t6 = v__ast__new_type(idx); return _t6; } else if (variants.len == 1) { @@ -87387,7 +87704,7 @@ v__ast__Type v__parser__Parser_parse_generic_type(v__parser__Parser* p, string n v__ast__Type _t1 = v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic); return _t1; } - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = true,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = true,})); v__ast__Type _t2 = v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic); return _t2; } @@ -87463,7 +87780,7 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str else { } ; - int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__GenericInst, (((v__ast__GenericInst){.parent_idx = parent_idx,.concrete_types = concrete_types,})))),.kind = v__ast__Kind__generic_inst,.name = bs_name,.cname = v__util__no_dots(bs_cname),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = 0,.language = 0,.idx = 0,})); + int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__GenericInst, (((v__ast__GenericInst){.parent_idx = parent_idx,.concrete_types = concrete_types,})))),.name = bs_name,.cname = v__util__no_dots(bs_cname),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__generic_inst,.language = 0,.is_pub = 0,})); v__ast__Type _t3 = v__ast__new_type(idx); return _t3; } @@ -87473,7 +87790,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){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))),.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},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 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,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 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,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.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},.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)),.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,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.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),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.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,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.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,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.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)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.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)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + 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,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -87489,21 +87806,42 @@ bool v__parser__parse_stmt_defer_0 = false; 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__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .file_base = (string){.str=(byteptr)"", .is_lit=1}, .file_name = tmpl_path, .file_name_dir = (string){.str=(byteptr)"", .is_lit=1}, .unique_prefix = (string){.str=(byteptr)"", .is_lit=1}, - .file_backend_mode = 0, + .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 = pref, .scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, pref), - .comments_mode = v__scanner__CommentsMode__skip_comments, - .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,}, .table = table, + .scope = scope, + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = v__scanner__CommentsMode__skip_comments, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -87532,38 +87870,17 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = scope, - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__ast__File* res = v__parser__Parser_parse(&p); v__parser__Parser_free_scanner(&p); @@ -87573,21 +87890,42 @@ v__ast__File* v__parser__parse_comptime(string tmpl_path, string text, v__ast__T v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* table, v__scanner__CommentsMode comments_mode, v__pref__Preferences* pref) { v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = v__scanner__new_scanner(text, comments_mode, pref), - .comments_mode = comments_mode, - .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,}, .table = table, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = comments_mode, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -87616,38 +87954,17 @@ v__ast__File* v__parser__parse_text(string text, string path, v__ast__Table* tab .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); v__ast__File* res = v__parser__Parser_parse(&p); @@ -87719,21 +88036,42 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne } v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = (*(v__scanner__Scanner**)_t1.data), - .comments_mode = comments_mode, - .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,}, .table = table, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = comments_mode, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -87762,38 +88100,17 @@ v__ast__File* v__parser__parse_file(string path, v__ast__Table* table, v__scanne .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = table->global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); v__ast__File* res = v__parser__Parser_parse(&p); @@ -87813,21 +88130,42 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri } v__parser__Parser p = ((v__parser__Parser){ - .pref = pref, + .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,}, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .ast_imports = __new_array(0, 0, sizeof(v__ast__Import)), + .used_imports = __new_array(0, 0, sizeof(string)), + .auto_imports = __new_array(0, 0, sizeof(string)), + .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), + .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), + .notices = __new_array(0, 0, sizeof(v__errors__Notice)), + .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), + .label_names = __new_array(0, 0, sizeof(string)), + .global_labels = __new_array(0, 0, sizeof(string)), + .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), + .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), + .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), .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}, - .file_backend_mode = 0, + .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 = pref, .scanner = (*(v__scanner__Scanner**)_t1.data), - .comments_mode = v__scanner__CommentsMode__parse_comments, - .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,}, .table = table_, + .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), + .expr_level = 0, + .n_asm = 0, + .file_backend_mode = 0, .language = 0, .fn_language = 0, - .expr_level = 0, + .comments_mode = v__scanner__CommentsMode__parse_comments, .inside_vlib_file = 0, .inside_test_file = 0, .inside_if = 0, @@ -87856,38 +88194,17 @@ multi_return_ref_v__ast__File_Array_v__vet__Error v__parser__parse_vet_file(stri .inside_struct_field_decl = 0, .or_is_handled = 0, .builtin_mod = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, .is_manualfree = 0, .has_globals = 0, .is_generated = 0, .is_translated = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .expr_mod = (string){.str=(byteptr)"", .is_lit=1}, - .scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = global_scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))), - .imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), - .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)), - .imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), .is_amp = 0, .returns = 0, .is_stmt_ident = 0, .expecting_type = 0, - .errors = __new_array_with_default(0, 0, sizeof(v__errors__Error), 0), - .warnings = __new_array_with_default(0, 0, sizeof(v__errors__Warning), 0), - .notices = __new_array(0, 0, sizeof(v__errors__Notice)), - .vet_errors = __new_array(0, 0, sizeof(v__vet__Error)), - .cur_fn_name = (string){.str=(byteptr)"", .is_lit=1}, - .label_names = __new_array(0, 0, sizeof(string)), .name_error = 0, - .n_asm = 0, - .global_labels = __new_array(0, 0, sizeof(string)), .comptime_if_cond = 0, - .defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)), .should_abort = 0, - .codegen_text = (string){.str=(byteptr)"", .is_lit=1}, - .struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)), - .if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)), }); v__parser__Parser_set_path(&p, path); if (string_contains_any_substr(p.scanner->text, new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("\n "), _SLIT(" \n")})))) { @@ -88055,6 +88372,29 @@ v__token__Token v__parser__Parser_peek_token_after_var_list(v__parser__Parser* p return _t1; } +VV_LOCAL_SYMBOL bool v__parser__Parser_is_array_type(v__parser__Parser* p) { + int i = 1; + v__token__Token tok = p->tok; + int line_nr = p->tok.line_nr; + for (;;) { + tok = v__parser__Parser_peek_token(p, i); + if (tok.line_nr != line_nr) { + bool _t1 = false; + return _t1; + } + if (tok.kind == v__token__Kind__name || tok.kind == v__token__Kind__amp) { + bool _t2 = true; + return _t2; + } + i++; + if (tok.kind == v__token__Kind__lsbr || tok.kind != v__token__Kind__rsbr) { + continue; + } + } + bool _t3 = false; + return _t3; +} + void v__parser__Parser_open_scope(v__parser__Parser* p) { p->scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = p->scope,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = p->tok.pos,.end_pos = 0,}, sizeof(v__ast__Scope))); } @@ -88250,9 +88590,35 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { } v__parser__Parser_close_scope(p); v__ast__Stmt _t22 = v__ast__FnDecl_to_sumtype_v__ast__Stmt(ADDR(v__ast__FnDecl, (((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = __new_array(0, 0, sizeof(v__ast__Param)), + .stmts = stmts, + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = p->label_names, .name = _SLIT("main.main"), .short_name = _SLIT("main"), .mod = _SLIT("main"), + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = 0, .is_variadic = 0, @@ -88266,40 +88632,14 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = __new_array(0, 0, sizeof(v__ast__Param)), - .stmts = stmts, - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = p->label_names, - .pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, })))); return _t22; } else if (p->pref->is_fmt) { @@ -88394,7 +88734,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { v__token__Pos pos = v__token__Token_pos(&p->tok); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - v__ast__Stmt _t2 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssertStmt, (((v__ast__AssertStmt){.pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)),.expr = expr,.is_used = p->inside_test_file || !p->pref->is_prod,})))); + v__ast__Stmt _t2 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__AssertStmt, (((v__ast__AssertStmt){.expr = expr,.pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)),.is_used = p->inside_test_file || !p->pref->is_prod,})))); return _t2; break; } @@ -88511,7 +88851,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { if (p->tok.line_nr == line && p->tok.kind == v__token__Kind__name) { label = v__parser__Parser_check_name(p); } - v__ast__Stmt _t22 = v__ast__BranchStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__BranchStmt, (((v__ast__BranchStmt){.kind = tok.kind,.label = label,.pos = v__token__Token_pos(&tok),})))); + v__ast__Stmt _t22 = v__ast__BranchStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__BranchStmt, (((v__ast__BranchStmt){.label = label,.pos = v__token__Token_pos(&tok),.kind = tok.kind,})))); return _t22; break; } @@ -88539,7 +88879,7 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { p->defer_vars = __new_array_with_default(0, 0, sizeof(v__ast__Ident), 0); Array_v__ast__Stmt stmts = v__parser__Parser_parse_block(p); p->inside_defer = false; - v__ast__Stmt _t26 = v__ast__DeferStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__DeferStmt, (((v__ast__DeferStmt){.stmts = stmts,.pos = v__token__Pos_extend_with_last_line(spos, v__token__Token_pos(&p->tok), p->prev_tok.line_nr),.defer_vars = array_clone_to_depth(&p->defer_vars, 0),.ifdef = (string){.str=(byteptr)"", .is_lit=1},.idx_in_fn = -1,})))); + v__ast__Stmt _t26 = v__ast__DeferStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__DeferStmt, (((v__ast__DeferStmt){.stmts = stmts,.defer_vars = array_clone_to_depth(&p->defer_vars, 0),.ifdef = (string){.str=(byteptr)"", .is_lit=1},.pos = v__token__Pos_extend_with_last_line(spos, v__token__Token_pos(&p->tok), p->prev_tok.line_nr),.idx_in_fn = -1,})))); return _t26; } break; @@ -88860,12 +89200,12 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } } array_push((array*)&templates, _MOV((v__ast__AsmTemplate[]){ ((v__ast__AsmTemplate){ - .name = name, - .is_label = is_label, - .is_directive = is_directive, .args = args, .comments = comments, + .name = name, .pos = v__token__Pos_extend(template_pos, v__token__Token_pos(&p->tok)), + .is_label = is_label, + .is_directive = is_directive, }) })); } v__ast__Scope* scope = p->scope; @@ -88919,18 +89259,18 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } scope->end_pos = p->prev_tok.pos; v__ast__AsmStmt _t18 = ((v__ast__AsmStmt){ - .arch = arch, - .is_basic = is_top_level || output.len + input.len + clobbered.len == 0, - .is_volatile = is_volatile, - .is_goto = is_goto, .clobbered = clobbered, - .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), .templates = templates, - .scope = scope, .output = output, .input = input, .global_labels = global_labels, .local_labels = local_labels, + .scope = scope, + .pos = v__token__Pos_extend(pos, v__token__Token_pos(&p->prev_tok)), + .arch = arch, + .is_basic = is_top_level || output.len + input.len + clobbered.len == 0, + .is_volatile = is_volatile, + .is_goto = is_goto, }); // Defer begin if (v__parser__Parser_asm_stmt_defer_0) { @@ -89245,7 +89585,7 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) v__token__Pos apos = v__token__Token_pos(&p->prev_tok); if (p->tok.kind == v__token__Kind__key_unsafe) { v__parser__Parser_next(p); - v__ast__Attr _t1 = ((v__ast__Attr){.name = _SLIT("unsafe"),.has_arg = 0,.arg = (string){.str=(byteptr)"", .is_lit=1},.kind = kind,.ct_expr = {0},.ct_opt = 0,.pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)),.ct_evaled = 0,.ct_skip = 0,}); + v__ast__Attr _t1 = ((v__ast__Attr){.name = _SLIT("unsafe"),.arg = (string){.str=(byteptr)"", .is_lit=1},.ct_expr = {0},.pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)),.kind = kind,.has_arg = 0,.ct_opt = 0,.ct_evaled = 0,.ct_skip = 0,}); return _t1; } string name = _SLIT(""); @@ -89303,12 +89643,12 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) } v__ast__Attr _t2 = ((v__ast__Attr){ .name = name, - .has_arg = has_arg, .arg = arg, - .kind = kind, .ct_expr = comptime_cond, - .ct_opt = comptime_cond_opt, .pos = v__token__Pos_extend(apos, v__token__Token_pos(&p->tok)), + .kind = kind, + .has_arg = has_arg, + .ct_opt = comptime_cond_opt, .ct_evaled = 0, .ct_skip = 0, }); @@ -89385,7 +89725,7 @@ v__ast__NodeError v__parser__Parser_error_with_pos(v__parser__Parser* p, string _v_exit(1); VUNREACHABLE(); } else { - array_push((array*)&p->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = p->file_name,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,}) })); + array_push((array*)&p->errors, _MOV((v__errors__Error[]){ ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = p->file_name,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__parser,}) })); if (p->pref->check_only) { v__parser__Parser_next(p); } @@ -89462,13 +89802,13 @@ void v__parser__Parser_note_with_pos(v__parser__Parser* p, string s, v__token__P void v__parser__Parser_vet_error(v__parser__Parser* p, string msg, int line, v__vet__FixKind fix, v__vet__ErrorType typ) { v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = line + 1,.pos = 0,.col = 0,.last_line = 0,}); array_push((array*)&p->vet_errors, _MOV((v__vet__Error[]){ ((v__vet__Error){ - .kind = v__vet__ErrorKind__error, .message = msg, .details = (string){.str=(byteptr)"", .is_lit=1}, .file_path = p->scanner->file_path, .pos = pos, .fix = fix, .typ = typ, + .kind = v__vet__ErrorKind__error, }) })); } @@ -89477,9 +89817,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_47746 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_47746.arg0; - Array_v__ast__Comment left_comments = mr_47746.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48071 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_48071.arg0; + Array_v__ast__Comment left_comments = mr_48071.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); } @@ -89539,24 +89879,24 @@ v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Langua } else { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected token `"), /*115 &string*/0xfe10, {.d_s = p->tok.lit}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); } - v__ast__Ident _t1 = ((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = p->scope,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.kind = 0,.info = {0},.is_mut = 0,}); + v__ast__Ident _t1 = ((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.info = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,}); return _t1; } v__token__Pos pos = v__token__Token_pos(&p->tok); string name = v__parser__Parser_check_name(p); if (string__eq(name, _SLIT("_"))) { v__ast__Ident _t2 = ((v__ast__Ident){ - .language = 0, - .tok_kind = p->tok.kind, - .pos = pos, - .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .comptime = p->comptime_if_cond, - .scope = p->scope, .obj = {0}, .mod = (string){.str=(byteptr)"", .is_lit=1}, .name = _SLIT("_"), + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = 0,.is_mut = false,.is_static = false,.is_volatile = false,.is_optional = 0,})))), + .scope = p->scope, + .pos = pos, + .mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .tok_kind = p->tok.kind, + .language = 0, .kind = v__ast__IdentKind__blank_ident, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = false,.is_static = false,.is_volatile = false,.is_optional = 0,.share = 0,})))), + .comptime = p->comptime_if_cond, .is_mut = 0, }); return _t2; @@ -89567,17 +89907,17 @@ v__ast__Ident v__parser__Parser_parse_ident(v__parser__Parser* p, v__ast__Langua name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = p->expr_mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}})); } v__ast__Ident _t3 = ((v__ast__Ident){ - .language = language, - .tok_kind = p->tok.kind, - .pos = pos, - .mut_pos = mut_pos, - .comptime = p->comptime_if_cond, - .scope = p->scope, .obj = {0}, .mod = p->mod, .name = name, + .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),.is_mut = is_mut,.is_static = is_static,.is_volatile = is_volatile,.is_optional = 0,})))), + .scope = p->scope, + .pos = pos, + .mut_pos = mut_pos, + .tok_kind = p->tok.kind, + .language = language, .kind = v__ast__IdentKind__unresolved, - .info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = 0,.is_mut = is_mut,.is_static = is_static,.is_volatile = is_volatile,.is_optional = 0,.share = v__ast__sharetype_from_flags(is_shared, is_atomic),})))), + .comptime = p->comptime_if_cond, .is_mut = is_mut, }); return _t3; @@ -89722,7 +90062,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__parser__Parser_error(p, _SLIT("`}` expected; explicit `map` initialization does not support parameters")); } } - v__ast__Expr _t4 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.pos = pos,.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = __new_array(0, 0, sizeof(v__ast__Expr)),.vals = __new_array(0, 0, sizeof(v__ast__Expr)),.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.typ = map_type,.key_type = 0,.value_type = 0,})))); + v__ast__Expr _t4 = v__ast__MapInit_to_sumtype_v__ast__Expr(ADDR(v__ast__MapInit, (((v__ast__MapInit){.comments = __new_array(0, 0, sizeof(Array_v__ast__Comment)),.pre_cmnts = __new_array(0, 0, sizeof(v__ast__Comment)),.keys = __new_array(0, 0, sizeof(v__ast__Expr)),.vals = __new_array(0, 0, sizeof(v__ast__Expr)),.val_types = __new_array(0, 0, sizeof(v__ast__Type)),.pos = pos,.typ = map_type,.key_type = 0,.value_type = 0,})))); return _t4; } if (string__eq(p->tok.lit, _SLIT("chan"))) { @@ -89858,12 +90198,12 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__parser__Parser_check(p, v__token__Kind__rpar); node = v__ast__CastExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CastExpr, (((v__ast__CastExpr){ .arg = arg, - .typ = to_typ, .expr = expr, .typname = v__ast__Table_sym(p->table, to_typ)->name, + .pos = v__token__Pos_extend(start_pos, end_pos), + .typ = to_typ, .expr_type = 0, .has_arg = has_arg, - .pos = v__token__Pos_extend(start_pos, end_pos), })))); p->expr_mod = _SLIT(""); v__ast__Expr _t18 = node; @@ -89878,7 +90218,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); v__parser__Parser_check(p, v__token__Kind__rpar); - node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.language = 0,.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.left = node,.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.should_be_skipped = 0,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.free_receiver = 0,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),})))); + node = v__ast__CallExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__CallExpr, (((v__ast__CallExpr){.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.args = args,.expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.left = node,.scope = p->scope,.pos = pos,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.concrete_list_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.left_type = 0,.receiver_type = 0,.return_type = 0,.fn_var_type = 0,.language = 0,.is_method = 0,.is_field = 0,.is_fn_var = 0,.is_keep_alive = 0,.is_noreturn = 0,.is_ctor_new = 0,.should_be_skipped = 0,.free_receiver = 0,})))); } } } 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) { @@ -89895,7 +90235,7 @@ v__ast__Expr v__parser__Parser_name_expr(v__parser__Parser* p) { string field = v__parser__Parser_check_name(p); v__ast__GenericKindField fkind = ((string__eq(field, _SLIT("name"))) ? (v__ast__GenericKindField__name) : (string__eq(field, _SLIT("typ"))) ? (v__ast__GenericKindField__typ) : (v__ast__GenericKindField__unknown)); v__token__Pos_extend(pos, v__token__Token_pos(&p->tok)); - v__ast__Expr _t21 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){.pos = pos,.field_name = field,.is_mut = 0,.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.next_token = 0,.expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){.language = 0,.tok_kind = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comptime = 0,.scope = p->scope,.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = name,.kind = 0,.info = {0},.is_mut = 0,})))),.expr_type = 0,.typ = 0,.name_type = 0,.gkind_field = fkind,.scope = p->scope,.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),})))); + v__ast__Expr _t21 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__SelectorExpr, (((v__ast__SelectorExpr){.from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)),.field_name = field,.expr = v__ast__Ident_to_sumtype_v__ast__Expr(ADDR(v__ast__Ident, (((v__ast__Ident){.obj = {0},.mod = (string){.str=(byteptr)"", .is_lit=1},.name = name,.info = {0},.scope = p->scope,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.tok_kind = 0,.language = 0,.kind = 0,.comptime = 0,.is_mut = 0,})))),.scope = p->scope,.pos = pos,.mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.expr_type = 0,.typ = 0,.name_type = 0,.next_token = 0,.gkind_field = fkind,.is_mut = 0,})))); return _t21; } if (v__parser__Parser_peek_token(p, 2).kind == v__token__Kind__name && v__parser__Parser_peek_token(p, 3).kind == v__token__Kind__lpar && !known_var) { @@ -89987,7 +90327,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos_high = v__token__Pos_extend(or_pos_high, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t1 = ((v__ast__IndexExpr){.pos = pos_high,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = has_high,.has_low = 0,.pos = pos_high,.is_gated = is_gated,.low = v__ast__empty_expr(),.high = high,})))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = v__ast__OrKind__block,.pos = or_pos_high,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t1 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = v__ast__OrKind__block,.pos = or_pos_high,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = v__ast__empty_expr(),.high = high,.pos = pos_high,.has_high = has_high,.has_low = 0,.is_gated = is_gated,})))),.left = left,.pos = pos_high,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t1; } if (p->tok.kind == v__token__Kind__question) { @@ -89996,7 +90336,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t2 = ((v__ast__IndexExpr){.pos = pos_high,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.has_high = has_high,.has_low = 0,.pos = pos_high,.is_gated = is_gated,.low = v__ast__empty_expr(),.high = high,})))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = or_kind_high,.pos = or_pos_high,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t2 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_high,.kind = or_kind_high,.pos = or_pos_high,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){.low = v__ast__empty_expr(),.high = high,.pos = pos_high,.has_high = has_high,.has_low = 0,.is_gated = is_gated,})))),.left = left,.pos = pos_high,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t2; } v__ast__Expr expr = v__parser__Parser_expr(p, 0); @@ -90024,14 +90364,14 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos_low = v__token__Pos_extend(or_pos_low, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t3 = ((v__ast__IndexExpr){.pos = pos_low,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ - .has_high = has_high, - .has_low = has_low, - .pos = pos_low, - .is_gated = is_gated, + v__ast__IndexExpr _t3 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = v__ast__OrKind__block,.pos = or_pos_low,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ .low = expr, .high = high, - })))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = v__ast__OrKind__block,.pos = or_pos_low,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + .pos = pos_low, + .has_high = has_high, + .has_low = has_low, + .is_gated = is_gated, + })))),.left = left,.pos = pos_low,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t3; } if (p->tok.kind == v__token__Kind__question) { @@ -90040,14 +90380,14 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t4 = ((v__ast__IndexExpr){.pos = pos_low,.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ - .has_high = has_high, - .has_low = has_low, - .pos = pos_low, - .is_gated = is_gated, + v__ast__IndexExpr _t4 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = or_kind_low,.pos = or_pos_low,}),.index = v__ast__RangeExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__RangeExpr, (((v__ast__RangeExpr){ .low = expr, .high = high, - })))),.or_expr = ((v__ast__OrExpr){.stmts = or_stmts_low,.kind = or_kind_low,.pos = or_pos_low,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + .pos = pos_low, + .has_high = has_high, + .has_low = has_low, + .is_gated = is_gated, + })))),.left = left,.pos = pos_low,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t4; } v__token__Pos pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->tok)); @@ -90066,7 +90406,7 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); v__parser__Parser_close_scope(p); p->inside_or_expr = was_inside_or_expr; - v__ast__IndexExpr _t5 = ((v__ast__IndexExpr){.pos = pos,.index = expr,.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = v__ast__OrKind__block,.pos = or_pos,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t5 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = v__ast__OrKind__block,.pos = or_pos,}),.index = expr,.left = left,.pos = pos,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t5; } if (p->tok.kind == v__token__Kind__question) { @@ -90075,17 +90415,17 @@ VV_LOCAL_SYMBOL v__ast__IndexExpr v__parser__Parser_index_expr(v__parser__Parser v__parser__Parser_next(p); } } - v__ast__IndexExpr _t6 = ((v__ast__IndexExpr){.pos = pos,.index = expr,.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.left = left,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); + v__ast__IndexExpr _t6 = ((v__ast__IndexExpr){.or_expr = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}),.index = expr,.left = left,.pos = pos,.left_type = 0,.is_setter = 0,.is_map = 0,.is_array = 0,.is_farray = 0,.is_option = 0,.is_direct = 0,.is_gated = is_gated,}); return _t6; } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_it(v__parser__Parser* p) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("it"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("it"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL void v__parser__Parser_scope_register_ab(v__parser__Parser* p) { - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("a"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("b"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = 0,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("a"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("b"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = 0,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = 0,}))))); } VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v__ast__Expr left) { @@ -90141,7 +90481,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ p->inside_or_expr = true; v__parser__Parser_next(p); v__parser__Parser_open_scope(p); - v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.name = _SLIT("err"),.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.expr = {0},.typ = _const_v__ast__error_type,.orig_type = 0,.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.pos = v__token__Token_pos(&p->tok),.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); + v__ast__Scope_register(p->scope, v__ast__Var_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__Var, (((v__ast__Var){.smartcasts = __new_array(0, 0, sizeof(v__ast__Type)),.name = _SLIT("err"),.expr = {0},.pos = v__token__Token_pos(&p->tok),.typ = _const_v__ast__error_type,.orig_type = 0,.share = 0,.is_mut = 0,.is_autofree_tmp = 0,.is_arg = 0,.is_auto_deref = 0,.is_inherited = 0,.is_used = true,.is_changed = 0,.is_or = 0,.is_tmp = 0,.is_auto_heap = 0,.is_stack_obj = true,}))))); or_kind = v__ast__OrKind__block; or_stmts = v__parser__Parser_parse_block_no_scope(p, false); or_pos = v__token__Pos_extend(or_pos, v__token__Token_pos(&p->prev_tok)); @@ -90160,33 +90500,33 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ v__token__Pos pos = v__token__Pos_extend(name_pos, end_pos); Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,})); v__ast__CallExpr mcall_expr = ((v__ast__CallExpr){ - .pos = pos, - .name_pos = name_pos, + .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), + .args = args, + .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), + .concrete_types = concrete_types, + .raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .comments = comments, .mod = (string){.str=(byteptr)"", .is_lit=1}, .name = field_name, + .left = left, + .scope = p->scope, + .pos = pos, + .name_pos = name_pos, + .concrete_list_pos = concrete_list_pos, + .left_type = 0, + .receiver_type = 0, + .return_type = 0, + .fn_var_type = 0, + .language = 0, .is_method = true, .is_field = 0, .is_fn_var = 0, .is_keep_alive = 0, .is_noreturn = 0, .is_ctor_new = 0, - .args = args, - .expected_arg_types = __new_array(0, 0, sizeof(v__ast__Type)), - .language = 0, - .or_block = ((v__ast__OrExpr){.stmts = or_stmts,.kind = or_kind,.pos = or_pos,}), - .left = left, - .left_type = 0, - .receiver_type = 0, - .return_type = 0, - .fn_var_type = 0, .should_be_skipped = 0, - .concrete_types = concrete_types, - .concrete_list_pos = concrete_list_pos, - .raw_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), .free_receiver = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), - .comments = comments, }); if (is_filter || string__eq(field_name, _SLIT("sort"))) { v__parser__Parser_close_scope(p); @@ -90212,18 +90552,18 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ } v__token__Pos pos = (p->name_error ? (v__token__Pos_extend(v__ast__Expr_pos(left), name_pos)) : (name_pos)); v__ast__SelectorExpr sel_expr = ((v__ast__SelectorExpr){ - .pos = pos, + .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), .field_name = field_name, - .is_mut = is_mut, - .mut_pos = mut_pos, - .next_token = p->tok.kind, .expr = left, + .scope = p->scope, + .pos = pos, + .mut_pos = mut_pos, .expr_type = 0, .typ = 0, .name_type = 0, + .next_token = p->tok.kind, .gkind_field = 0, - .scope = p->scope, - .from_embed_types = __new_array(0, 0, sizeof(v__ast__Type)), + .is_mut = is_mut, }); if (is_filter) { v__parser__Parser_close_scope(p); @@ -90266,7 +90606,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Type_Array_string v__parser__Parser_p array_push((array*)¶m_names, _MOV((string[]){ string_clone(name) })); int idx = v__ast__Table_find_type_idx(p->table, name); if (idx == 0) { - idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.parent_idx = 0,.info = {0},.kind = v__ast__Kind__any,.name = name,.cname = v__util__no_dots(name),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = p->mod,.is_pub = true,.language = 0,.idx = 0,})); + idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.info = {0},.name = name,.cname = v__util__no_dots(name),.mod = p->mod,.parent_idx = 0,.idx = 0,.size = -1,.align = -1,.kind = v__ast__Kind__any,.language = 0,.is_pub = true,})); } array_push((array*)&types, _MOV((v__ast__Type[]){ v__ast__Type_set_flag(v__ast__new_type(idx), v__ast__TypeFlag__generic) })); first_done = true; @@ -90341,7 +90681,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_string_expr(v__parser__Parser* p) if (p->peek_tok.kind != v__token__Kind__str_dollar) { v__parser__Parser_next(p); v__parser__Parser_filter_string_vet_errors(p, pos); - node = v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = val,.is_raw = is_raw,.language = (is_cstr ? (v__ast__Language__c) : (v__ast__Language__v)),.pos = pos,})))); + node = v__ast__StringLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__StringLiteral, (((v__ast__StringLiteral){.val = val,.pos = pos,.language = (is_cstr ? (v__ast__Language__c) : (v__ast__Language__v)),.is_raw = is_raw,})))); v__ast__Expr _t1 = node; return _t1; } @@ -90687,7 +91027,7 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (is_block && p->tok.kind == v__token__Kind__eof) { v__parser__Parser_error(p, _SLIT("unexpected eof, expecting \302\264)\302\264")); - v__ast__ConstDecl _t2 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t2 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t2; } if (p->tok.kind == v__token__Kind__rpar) { @@ -90704,12 +91044,12 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser _PUSH_MANY(&end_comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t4, Array_v__ast__Comment); if (p->tok.kind == v__token__Kind__key_fn) { v__parser__Parser_error(p, _SLIT("const initializer fn literal is not a constant")); - v__ast__ConstDecl _t5 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t5 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t5; } if (p->tok.kind == v__token__Kind__eof) { v__parser__Parser_error(p, _SLIT("unexpected eof, expecting an expression")); - v__ast__ConstDecl _t6 = ((v__ast__ConstDecl){.is_pub = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.is_block = 0,}); + v__ast__ConstDecl _t6 = ((v__ast__ConstDecl){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.fields = __new_array(0, 0, sizeof(v__ast__ConstField)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_block = 0,}); return _t6; } v__ast__Expr expr = v__parser__Parser_expr(p, 0); @@ -90739,11 +91079,11 @@ VV_LOCAL_SYMBOL v__ast__ConstDecl v__parser__Parser_const_decl(v__parser__Parser _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = true,.follow_up = 0,}))), _t8, Array_v__ast__Comment); } v__ast__ConstDecl _t9 = ((v__ast__ConstDecl){ - .is_pub = is_pub, - .pos = v__token__Pos_extend_with_last_line(start_pos, const_pos, p->prev_tok.line_nr), .attrs = attrs, .fields = fields, .end_comments = comments, + .pos = v__token__Pos_extend_with_last_line(start_pos, const_pos, p->prev_tok.line_nr), + .is_pub = is_pub, .is_block = is_block, }); return _t9; @@ -90757,9 +91097,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_84411 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_84411.arg0; - Array_v__ast__Comment comments2 = mr_84411.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_84736 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_84736.arg0; + Array_v__ast__Comment comments2 = mr_84736.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)),}); @@ -90863,15 +91203,15 @@ VV_LOCAL_SYMBOL v__ast__GlobalDecl v__parser__Parser_global_decl(v__parser__Pars typ = v__parser__Parser_parse_type(p); } v__ast__GlobalField field = ((v__ast__GlobalField){ + .comments = comments, .name = name, - .has_expr = has_expr, + .expr = expr, .pos = pos, .typ_pos = typ_pos, + .typ = typ, + .has_expr = has_expr, .is_markused = is_markused, .is_volatile = is_volatile, - .expr = expr, - .typ = typ, - .comments = comments, }); array_push((array*)&fields, _MOV((v__ast__GlobalField[]){ field })); v__ast__Scope_register(p->table->global_scope, v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(&field)); @@ -90906,12 +91246,12 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* string enum_name = v__parser__Parser_check_name(p); if (enum_name.len == 1) { v__parser__Parser_error_with_pos(p, _SLIT("single letter capital names are reserved for generic template types."), end_pos); - v__ast__EnumDecl _t1 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t1 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t1; } if (_IN_MAP(ADDR(string, enum_name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register enum `"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), end_pos); - v__ast__EnumDecl _t2 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t2 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t2; } string name = v__parser__Parser_prepend_mod(p, enum_name); @@ -90919,6 +91259,7 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* Array_v__ast__Comment enum_decl_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); Array_string vals = __new_array_with_default(0, 0, sizeof(string), 0); Array_v__ast__EnumField fields = __new_array_with_default(0, 0, sizeof(v__ast__EnumField), 0); + bool uses_exprs = false; for (;;) { if (!(p->tok.kind != v__token__Kind__eof && p->tok.kind != v__token__Kind__rcbr)) break; v__token__Pos pos = v__token__Token_pos(&p->tok); @@ -90930,6 +91271,7 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* v__parser__Parser_next(p); expr = v__parser__Parser_expr(p, 0); has_expr = true; + uses_exprs = true; } array_push((array*)&fields, _MOV((v__ast__EnumField[]){ ((v__ast__EnumField){ .name = val, @@ -90947,14 +91289,14 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* if (is_flag) { if (fields.len > 32) { v__parser__Parser_error(p, _SLIT("when an enum is used as bit field, it must have a max of 32 fields")); - v__ast__EnumDecl _t5 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t5 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t5; } for (int _t6 = 0; _t6 < fields.len; ++_t6) { v__ast__EnumField f = ((v__ast__EnumField*)fields.data)[_t6]; if (f.has_expr) { v__parser__Parser_error_with_pos(p, _SLIT("when an enum is used as a bit field, you can not assign custom values"), f.pos); - v__ast__EnumDecl _t7 = ((v__ast__EnumDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__EnumDecl _t7 = ((v__ast__EnumDecl){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.fields = __new_array(0, 0, sizeof(v__ast__EnumField)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pub = 0,.is_flag = 0,.is_multi_allowed = 0,}); return _t7; } } @@ -90962,29 +91304,31 @@ VV_LOCAL_SYMBOL v__ast__EnumDecl v__parser__Parser_enum_decl(v__parser__Parser* v__parser__Parser_codegen(p, str_intp(21, _MOV((StrIntpData[]){{_SLIT("\n//\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") is_empty() bool { return int(*e) == 0 }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") has(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") bool { return (int(*e) & (int(flag))) != 0 }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" ( e &"), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") all(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") bool { return (int(*e) & (int(flag))) == int(flag) }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") set(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) | (int(flag))) } }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") clear(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) & ~(int(flag))) } }\n[inline] "), /*115 &string*/0xfe10, {.d_s = pubfn}}, {_SLIT(" (mut e "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") toggle(flag "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT(") { unsafe{ *e = "), /*115 &string*/0xfe10, {.d_s = enum_name}}, {_SLIT("(int(*e) ^ (int(flag))) } }\n//\n"), 0, { .d_c = 0 }}}))); } int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__Enum_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Enum, (((v__ast__Enum){.vals = vals,.is_flag = is_flag,.is_multi_allowed = is_multi_allowed,})))), - .kind = v__ast__Kind__enum_, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__Enum_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Enum, (((v__ast__Enum){.vals = vals,.is_flag = is_flag,.is_multi_allowed = is_multi_allowed,.uses_exprs = uses_exprs,})))), .name = name, .cname = v__util__no_dots(name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__enum_, + .language = 0, + .is_pub = is_pub, })); if (idx == -1) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register enum `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), end_pos); } v__ast__EnumDecl enum_decl = ((v__ast__EnumDecl){ - .name = name, - .is_pub = is_pub, - .is_flag = is_flag, - .is_multi_allowed = is_multi_allowed, .comments = enum_decl_comments, .fields = fields, .attrs = p->attrs, + .name = name, .pos = v__token__Pos_extend_with_last_line(start_pos, end_pos, p->prev_tok.line_nr), + .is_pub = is_pub, + .is_flag = is_flag, + .is_multi_allowed = is_multi_allowed, }); v__ast__Table_register_enum_decl(p->table, enum_decl); v__ast__EnumDecl _t8 = enum_decl; @@ -91013,8 +91357,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t2; } 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_90608 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_90608.arg0; + multi_return_Array_v__ast__Type_Array_string mr_91005 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_91005.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); @@ -91062,16 +91406,18 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* Array_v__ast__Type variant_types =_t7; string prepend_mod_name = v__parser__Parser_prepend_mod(p, name); int typ = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.found_fields = 0,.is_anon = 0,.is_generic = generic_types.len > 0,.variants = variant_types,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))), - .kind = v__ast__Kind__sum_type, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__SumType_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__SumType, (((v__ast__SumType){.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.variants = variant_types,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.found_fields = 0,.is_anon = 0,.is_generic = generic_types.len > 0,})))), .name = prepend_mod_name, .cname = v__util__no_dots(prepend_mod_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__sum_type, + .language = 0, + .is_pub = is_pub, })); if (typ == _const_v__ast__invalid_type_idx) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register sum type `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); @@ -91102,16 +91448,18 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* v__parser__Parser_check_for_impure_v(p, parent_sym->language, decl_pos); string prepend_mod_name = v__parser__Parser_prepend_mod(p, name); int idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = pidx, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = v__ast__Alias_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Alias, (((v__ast__Alias){.parent_type = parent_type,.language = parent_sym->language,.is_import = 0,})))), - .kind = v__ast__Kind__alias, .name = prepend_mod_name, .cname = v__util__no_dots(prepend_mod_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = 0, + .parent_idx = pidx, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__alias, + .language = 0, + .is_pub = is_pub, })); v__token__Pos type_end_pos = v__token__Token_pos(&p->prev_tok); if (idx == _const_v__ast__invalid_type_idx) { @@ -91144,7 +91492,7 @@ VV_LOCAL_SYMBOL v__ast__Assoc v__parser__Parser_assoc(v__parser__Parser* p) { if (_t1.state != 0) { /*or block*/ IError err = _t1.err; v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown variable `"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); - v__ast__Assoc _t2 = ((v__ast__Assoc){.var_name = (string){.str=(byteptr)"", .is_lit=1},.fields = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.typ = 0,.scope = 0,}); + v__ast__Assoc _t2 = ((v__ast__Assoc){.fields = __new_array(0, 0, sizeof(string)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.var_name = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,}); return _t2; } @@ -91166,7 +91514,7 @@ VV_LOCAL_SYMBOL v__ast__Assoc v__parser__Parser_assoc(v__parser__Parser* p) { break; } } - v__ast__Assoc _t5 = ((v__ast__Assoc){.var_name = var_name,.fields = fields,.pos = pos,.exprs = vals,.typ = 0,.scope = p->scope,}); + v__ast__Assoc _t5 = ((v__ast__Assoc){.fields = fields,.exprs = vals,.var_name = var_name,.scope = p->scope,.pos = pos,.typ = 0,}); return _t5; } @@ -91199,7 +91547,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_top_level_statement_end(v__parser__Parser VV_LOCAL_SYMBOL void v__parser__Parser_rewind_scanner_to_current_token_in_new_mode(v__parser__Parser* p) { int tidx = p->tok.tidx; v__scanner__Scanner_set_current_tidx(p->scanner, tidx - 5); - v__token__Token no_token = ((v__token__Token){.kind = 0,.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,}); + v__token__Token no_token = ((v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,.kind = 0,}); p->prev_tok = no_token; p->tok = no_token; p->peek_tok = no_token; @@ -91595,7 +91943,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; string name = v__parser__Parser_check_name(p); if (name.len == 1 && u8_is_capital(string_at(name, 0))) { v__parser__Parser_error_with_pos(p, _SLIT("single letter capital names are reserved for generic template types."), name_pos); - v__ast__StructDecl _t1 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t1 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); return _t1; } if (string__eq(name, _SLIT("IError")) && !string__eq(p->mod, _SLIT("builtin"))) { @@ -91608,7 +91956,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; bool no_body = p->tok.kind != v__token__Kind__lcbr; if (language == v__ast__Language__v && no_body) { v__parser__Parser_error(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = p->tok.lit}}, {_SLIT("` lacks body"), 0, { .d_c = 0 }}}))); - v__ast__StructDecl _t2 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t2 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91618,7 +91966,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (language == v__ast__Language__v && !p->builtin_mod && !p->is_translated && name.len > 0 && !u8_is_capital(string_at(name, 0)) && !p->pref->translated && !p->is_translated) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct name `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` must begin with capital letter"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t3 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t3 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91628,7 +91976,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (name.len == 1) { v__parser__Parser_error_with_pos(p, _SLIT("struct names must have more than one character"), name_pos); - v__ast__StructDecl _t4 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t4 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91638,7 +91986,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t5 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t5 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91673,6 +92021,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; Array_v__ast__Comment end_comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); if (!no_body) { v__parser__Parser_check(p, v__token__Kind__lcbr); + int i = 0; for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr)) break; Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); @@ -91692,7 +92041,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; if (p->tok.kind == v__token__Kind__key_mut) { if (pub_mut_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `pub mut` section")); - v__ast__StructDecl _t7 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t7 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91708,7 +92057,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else { if (pub_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `pub` section")); - v__ast__StructDecl _t8 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t8 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91725,7 +92074,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_mut) { if (mut_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `mut` section")); - v__ast__StructDecl _t9 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t9 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91742,7 +92091,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_global) { if (global_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `global` section")); - v__ast__StructDecl _t10 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t10 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91759,7 +92108,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } else if (p->tok.kind == v__token__Kind__key_module) { if (module_pos != -1) { v__parser__Parser_error(p, _SLIT("redefinition of `module` section")); - v__ast__StructDecl _t11 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t11 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91800,7 +92149,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; type_pos = v__token__Pos_extend(type_pos, v__token__Token_pos(&p->prev_tok)); if (!is_on_top) { v__parser__Parser_error_with_pos(p, _SLIT("struct embedding must be declared at the beginning of the struct body"), type_pos); - v__ast__StructDecl _t14 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t14 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91811,7 +92160,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); if (Array_v__ast__Type_contains(embed_types, typ)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot embed `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` more than once"), 0, { .d_c = 0 }}})), type_pos); - v__ast__StructDecl _t15 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t15 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91822,7 +92171,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; field_name = v__ast__TypeSymbol_embed_name(sym); if (Array_string_contains(embed_field_names, field_name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), type_pos); - v__ast__StructDecl _t16 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t16 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91846,7 +92195,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; typ = v__parser__Parser_parse_type(p); p->inside_struct_field_decl = false; if (v__ast__Type_idx(typ) == 0) { - v__ast__StructDecl _t21 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t21 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91878,70 +92227,77 @@ bool v__parser__Parser_struct_decl_defer_0 = false; _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t23, Array_v__ast__Comment); } array_push((array*)&ast_fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = p->attrs, + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = default_expr, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = i, + .default_expr_typ = 0, + .typ = typ, .has_default_expr = has_default_expr, - .attrs = p->attrs, .is_pub = is_embed || is_field_pub, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, - .default_expr = default_expr, - .default_expr_typ = 0, - .name = field_name, - .typ = typ, }) })); } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = p->attrs, + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = default_expr, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = i, + .default_expr_typ = 0, + .typ = typ, .has_default_expr = has_default_expr, - .attrs = p->attrs, .is_pub = is_embed || is_field_pub, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = is_embed || is_field_mut, .is_global = is_field_global, .is_volatile = is_field_volatile, - .default_expr = default_expr, - .default_expr_typ = 0, - .name = field_name, - .typ = typ, }) })); p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); + i++; } v__parser__Parser_top_level_statement_end(p); last_line = p->tok.line_nr; v__parser__Parser_check(p, v__token__Kind__rcbr); } + bool is_minify = Array_v__ast__Attr_contains(attrs, _SLIT("minify")); v__ast__TypeSymbol t = ((v__ast__TypeSymbol){ - .parent_idx = 0, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = v__ast__Struct_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Struct, (((v__ast__Struct){ .attrs = attrs, .embeds = embed_types, .fields = fields, - .is_typedef = Array_v__ast__Attr_contains(attrs, _SLIT("typedef")), - .is_union = is_union, - .is_heap = Array_v__ast__Attr_contains(attrs, _SLIT("heap")), - .is_generic = generic_types.len > 0, .generic_types = generic_types, .concrete_types = __new_array(0, 0, sizeof(v__ast__Type)), .parent_type = 0, + .is_typedef = Array_v__ast__Attr_contains(attrs, _SLIT("typedef")), + .is_union = is_union, + .is_heap = Array_v__ast__Attr_contains(attrs, _SLIT("heap")), + .is_minify = is_minify, + .is_generic = generic_types.len > 0, })))), - .kind = v__ast__Kind__struct_, .name = name, .cname = v__util__no_dots(name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = language, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__struct_, + .language = language, + .is_pub = is_pub, }); if (v__ast__Table_has_deep_child_no_ref(p->table, &t, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid recursive struct `"), /*115 &string*/0xfe10, {.d_s = orig_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t26 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t26 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91953,7 +92309,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; ret = v__ast__Table_register_sym(p->table, t); if (ret == -1 && language != v__ast__Language__c) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); - v__ast__StructDecl _t27 = ((v__ast__StructDecl){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = (string){.str=(byteptr)"", .is_lit=1},.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.is_pub = 0,.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_union = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),}); + v__ast__StructDecl _t27 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { v__ast__Table_reset_parsing_type(p->table); @@ -91963,21 +92319,21 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } p->expr_mod = _SLIT(""); v__ast__StructDecl _t28 = ((v__ast__StructDecl){ - .pos = v__token__Pos_extend_with_last_line(start_pos, name_pos, last_line), - .name = name, .generic_types = generic_types, - .is_pub = is_pub, + .attrs = attrs, + .end_comments = end_comments, + .embeds = embeds, + .fields = ast_fields, + .name = name, + .pos = v__token__Pos_extend_with_last_line(start_pos, name_pos, last_line), .mut_pos = mut_pos, .pub_pos = pub_pos, .pub_mut_pos = pub_mut_pos, .global_pos = global_pos, .module_pos = module_pos, .language = language, + .is_pub = is_pub, .is_union = is_union, - .attrs = attrs, - .end_comments = end_comments, - .embeds = embeds, - .fields = ast_fields, }); // Defer begin if (v__parser__Parser_struct_decl_defer_0) { @@ -92058,22 +92414,22 @@ VV_LOCAL_SYMBOL v__ast__StructInit v__parser__Parser_struct_init(v__parser__Pars } p->is_amp = saved_is_amp; v__ast__StructInit _t5 = ((v__ast__StructInit){ - .pos = v__token__Pos_extend(first_pos, (short_syntax ? (v__token__Token_pos(&p->tok)) : (v__token__Token_pos(&p->prev_tok)))), - .name_pos = first_pos, - .is_short = no_keys, - .is_short_syntax = short_syntax, - .unresolved = v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic), .pre_comments = pre_comments, - .typ_str = typ_str, - .typ = typ, - .update_expr = update_expr, - .update_expr_type = 0, .update_expr_comments = update_expr_comments, - .is_update_embed = 0, - .has_update_expr = has_update_expr, .fields = fields, .embeds = __new_array(0, 0, sizeof(v__ast__StructInitEmbed)), .generic_types = p->struct_init_generic_types, + .typ_str = typ_str, + .update_expr = update_expr, + .pos = v__token__Pos_extend(first_pos, (short_syntax ? (v__token__Token_pos(&p->tok)) : (v__token__Token_pos(&p->prev_tok)))), + .name_pos = first_pos, + .typ = typ, + .update_expr_type = 0, + .is_short = no_keys, + .is_short_syntax = short_syntax, + .unresolved = v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic), + .is_update_embed = 0, + .has_update_expr = has_update_expr, }); return _t5; } @@ -92104,30 +92460,32 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13010 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13010.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13116 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13116.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register interface `"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("`, this type was already imported"), 0, { .d_c = 0 }}})), name_pos); - v__ast__InterfaceDecl _t1 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t1 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t1; } int reg_idx = v__ast__Table_register_sym(p->table, ((v__ast__TypeSymbol){ - .parent_idx = 0, - .info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){.types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.conversions = new_map(sizeof(int), sizeof(Array_v__ast__Type), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.is_generic = generic_types.len > 0,.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,})))), - .kind = v__ast__Kind__interface_, + .methods = __new_array(0, 0, sizeof(v__ast__Fn)), + .info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(ADDR(v__ast__Interface, (((v__ast__Interface){.conversions = new_map(sizeof(int), sizeof(Array_v__ast__Type), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.generic_types = generic_types,.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_generic = generic_types.len > 0,})))), .name = interface_name, .cname = v__util__no_dots(interface_name), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = p->mod, - .is_pub = is_pub, - .language = language, + .parent_idx = 0, .idx = 0, + .size = -1, + .align = -1, + .kind = v__ast__Kind__interface_, + .language = language, + .is_pub = is_pub, })); if (reg_idx == -1) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register interface `"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); - v__ast__InterfaceDecl _t2 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t2 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t2; } v__ast__Type typ = v__ast__new_type(reg_idx); @@ -92136,9 +92494,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser ts->methods = __new_array_with_default(0, 20, sizeof(v__ast__Fn), 0); Array_v__ast__StructField fields = __new_array_with_default(0, 20, sizeof(v__ast__StructField), 0); Array_v__ast__FnDecl methods = __new_array_with_default(0, 20, sizeof(v__ast__FnDecl), 0); + Array_v__ast__InterfaceEmbedding embeds = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); bool is_mut = false; int mut_pos = -1; - Array_v__ast__InterfaceEmbedding ifaces = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr && p->tok.kind != v__token__Kind__eof)) break; if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.line_nr != p->tok.line_nr || !(p->peek_tok.kind == v__token__Kind__name || p->peek_tok.kind == v__token__Kind__amp || p->peek_tok.kind == v__token__Kind__lsbr || p->peek_tok.kind == v__token__Kind__lpar))) { @@ -92149,7 +92507,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser iface_name = v__ast__Table_sym(p->table, iface_type)->name; } Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); - array_push((array*)&ifaces, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = iface_name,.typ = iface_type,.pos = iface_pos,.comments = comments,}) })); + array_push((array*)&embeds, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = iface_name,.typ = iface_type,.pos = iface_pos,.comments = comments,}) })); if (p->tok.kind == v__token__Kind__rcbr) { break; } @@ -92168,7 +92526,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser break; } Array_v__ast__Comment comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); - array_push((array*)&ifaces, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = from_mod_name,.typ = from_mod_typ,.pos = v__token__Token_pos(&p->prev_tok),.comments = comments,}) })); + array_push((array*)&embeds, _MOV((v__ast__InterfaceEmbedding[]){ ((v__ast__InterfaceEmbedding){.name = from_mod_name,.typ = from_mod_typ,.pos = v__token__Token_pos(&p->prev_tok),.comments = comments,}) })); if (p->tok.kind == v__token__Kind__rcbr) { break; } @@ -92176,7 +92534,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser if (p->tok.kind == v__token__Kind__key_mut) { if (is_mut) { v__parser__Parser_error_with_pos(p, _SLIT("redefinition of `mut` section"), v__token__Token_pos(&p->tok)); - v__ast__InterfaceDecl _t5 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t5 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t5; } v__parser__Parser_next(p); @@ -92190,23 +92548,49 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser string name = v__parser__Parser_check_name(p); if (string__eq(name, _SLIT("type_name")) || string__eq(name, _SLIT("type_idx"))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot override built-in method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), method_start_pos); - v__ast__InterfaceDecl _t6 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t6 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t6; } if (v__ast__TypeSymbol_has_method(ts, name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), method_start_pos); - v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); + v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t7; } - multi_return_Array_v__ast__Param_bool_bool mr_16146 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16146.arg0; - bool is_variadic = mr_16146.arg2; - Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = _SLIT("x"),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = true,.typ = typ,})})); + multi_return_Array_v__ast__Param_bool_bool mr_16252 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16252.arg0; + bool is_variadic = mr_16252.arg2; + Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t8, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ + .receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}, + .generic_names = __new_array(0, 0, sizeof(string)), + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .params = args, + .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), + .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), + .comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), + .label_names = __new_array(0, 0, sizeof(string)), .name = name, .short_name = name, .mod = p->mod, + .file = p->file_name, + .source_file = 0, + .scope = p->scope, + .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .pos = v__token__Pos_extend(method_start_pos, v__token__Token_pos(&p->prev_tok)), + .method_idx = 0, + .ctdefine_idx = -1, + .idx = 0, + .return_type = _const_v__ast__void_type, + .ninstances = 0, + .language = 0, + .file_mode = 0, + .rec_share = 0, .is_deprecated = 0, .is_pub = true, .is_variadic = is_variadic, @@ -92220,40 +92604,14 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_keep_alive = 0, .is_unsafe = 0, .is_markused = 0, - .receiver = (v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}, - .receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .is_method = 0, - .method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .method_idx = 0, .rec_mut = 0, - .rec_share = 0, - .language = 0, - .file_mode = 0, .no_body = 0, .is_builtin = 0, - .body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .file = p->file_name, - .generic_names = __new_array(0, 0, sizeof(string)), .is_direct_arr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), - .ctdefine_idx = -1, - .idx = 0, - .params = args, - .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), - .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), - .return_type = _const_v__ast__void_type, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, .has_return = 0, .should_be_skipped = 0, - .ninstances = 0, .has_await = 0, - .comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .end_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .next_comments = __new_array(0, 0, sizeof(v__ast__Comment)), - .source_file = 0, - .scope = p->scope, - .label_names = __new_array(0, 0, sizeof(string)), - .pos = v__token__Pos_extend(method_start_pos, v__token__Token_pos(&p->prev_tok)), }); if (v__token__Kind_is_start_of_type(p->tok.kind) && p->tok.line_nr == line_nr) { method.return_type_pos = v__token__Token_pos(&p->tok); @@ -92267,8 +92625,22 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser method.next_comments = mnext_comments; array_push((array*)&methods, _MOV((v__ast__FnDecl[]){ method })); v__ast__Fn tmethod = ((v__ast__Fn){ - .is_variadic = is_variadic, + .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 = name, + .pos = method.pos, + .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, + .return_type = method.return_type, + .receiver_type = typ, + .usages = 0, + .ctdefine_idx = 0, + .source_fn = 0, .language = 0, + .file_mode = 0, + .is_variadic = is_variadic, .is_pub = true, .is_ctor_new = 0, .is_deprecated = 0, @@ -92280,21 +92652,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_keep_alive = 0, .is_method = true, .no_body = 0, - .mod = (string){.str=(byteptr)"", .is_lit=1}, - .file = (string){.str=(byteptr)"", .is_lit=1}, - .file_mode = 0, - .pos = method.pos, - .return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, - .return_type = method.return_type, - .receiver_type = typ, - .name = name, - .params = args, - .source_fn = 0, - .usages = 0, - .generic_names = __new_array(0, 0, sizeof(string)), - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .is_conditional = 0, - .ctdefine_idx = 0, }); v__ast__TypeSymbol_register_method(ts, tmethod); array_push((array*)&info.methods, _MOV((v__ast__Fn[]){ tmethod })); @@ -92313,26 +92671,27 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } } array_push((array*)&fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){ + .comments = comments, + .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), + .default_val = (string){.str=(byteptr)"", .is_lit=1}, + .default_expr = {0}, + .name = field_name, .pos = field_pos, .type_pos = type_pos, - .comments = comments, + .i = 0, + .default_expr_typ = 0, + .typ = field_typ, .has_default_expr = 0, - .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .is_pub = true, - .default_val = (string){.str=(byteptr)"", .is_lit=1}, .is_mut = 0, .is_global = 0, .is_volatile = 0, - .default_expr = {0}, - .default_expr_typ = 0, - .name = field_name, - .typ = field_typ, }) })); - array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.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,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = true,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = field_name,.typ = field_typ,}) })); + array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = field_name,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = field_typ,.has_default_expr = 0,.is_pub = true,.is_mut = is_mut,.is_global = 0,.is_volatile = 0,}) })); } } Array_v__ast__Type _t14 = {0}; - Array_v__ast__InterfaceEmbedding _t14_orig = ifaces; + Array_v__ast__InterfaceEmbedding _t14_orig = embeds; int _t14_len = _t14_orig.len; _t14 = __new_array(0, _t14_len, sizeof(v__ast__Type)); @@ -92347,20 +92706,20 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__parser__Parser_check(p, v__token__Kind__rcbr); pos = v__token__Pos_extend_with_last_line(pos, v__token__Token_pos(&p->prev_tok), p->prev_tok.line_nr); v__ast__InterfaceDecl res = ((v__ast__InterfaceDecl){ - .name = interface_name, - .typ = typ, - .name_pos = name_pos, - .language = language, .field_names = __new_array(0, 0, sizeof(string)), - .is_pub = is_pub, - .mut_pos = mut_pos, - .pos = pos, .pre_comments = pre_comments, .generic_types = generic_types, .attrs = attrs, .methods = methods, .fields = fields, - .embeds = ifaces, + .embeds = embeds, + .name = interface_name, + .name_pos = name_pos, + .pos = pos, + .typ = typ, + .mut_pos = mut_pos, + .language = language, + .is_pub = is_pub, .are_embeds_expanded = 0, }); v__ast__Table_register_interface(p->table, res); @@ -92480,7 +92839,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t3.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@footer"))) { @@ -92491,7 +92850,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t4.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@include "))) { @@ -92517,7 +92876,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t6.data) + 9; - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), /*115 &string*/0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), /*115 &string*/0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), /*115 &string*/0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.reporter = v__errors__Reporter__parser,})); *(string*) _t5.data = _SLIT(""); } @@ -93291,7 +93650,7 @@ v__errors__Error v__builder__Builder_error_with_pos(v__builder__Builder* b, stri _v_exit(1); VUNREACHABLE(); } - v__errors__Error _t1 = ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = fpath,.pos = pos,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__builder,}); + v__errors__Error _t1 = ((v__errors__Error){.message = s,.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = fpath,.backtrace = (string){.str=(byteptr)"", .is_lit=1},.pos = pos,.reporter = v__errors__Reporter__builder,}); return _t1; } @@ -93884,8 +94243,6 @@ void v__builder__Builder_cc(v__builder__Builder* v) { break; } if (v->pref->compress) { - println(_SLIT("-compress does not work on Windows for now")); - return; int ret = os__system( str_intp(2, _MOV((StrIntpData[]){{_SLIT("strip "), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (ret != 0) { println(_SLIT("strip failed")); @@ -93897,6 +94254,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) { } if (ret2 != 0) { println(_SLIT("upx failed")); + println(_SLIT("install upx")); } } } @@ -93951,10 +94309,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_22763 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_22763.arg0; - Array_string others = mr_22763.arg1; - Array_string libs = mr_22763.arg2; + multi_return_Array_string_Array_string_Array_string mr_22693 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_22693.arg0; + Array_string others = mr_22693.arg1; + Array_string libs = mr_22693.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")) })); @@ -96298,16 +96656,18 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__ast__riscv_no_number_register_list = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("zero"), _SLIT("ra"), _SLIT("sp"), _SLIT("gp"), _SLIT("tp")})); _const_v__ast__riscv_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), _MOV((string[4]){_SLIT("x#"), _SLIT("t#"), _SLIT("s#"), _SLIT("a#"), }), _MOV((int[4]){32, 3, 12, 8, })); _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__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.parent_idx = _const_v__ast__invalid_type_idx, + _const_v__ast__invalid_type_symbol = ((v__ast__TypeSymbol*)memdup(&(v__ast__TypeSymbol){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0}, - .kind = v__ast__Kind__placeholder, .name = _SLIT("InvalidType"), .cname = _SLIT("InvalidType"), - .methods = __new_array(0, 0, sizeof(v__ast__Fn)), .mod = _SLIT("builtin"), - .is_pub = 0, - .language = v__ast__Language__v, + .parent_idx = _const_v__ast__invalid_type_idx, .idx = _const_v__ast__invalid_type_idx, + .size = -1, + .align = -1, + .kind = v__ast__Kind__placeholder, + .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"), @@ -96403,8 +96763,8 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), _SLIT("Option"), 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#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 #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); - _const_v__gen__c__c_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#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_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__) || defined(_M_AMD64)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n#if defined(__arm__) || defined(_M_ARM)\n #define __V_arm32 1\n #undef __V_architecture\n #define __V_architecture 3\n#endif\n\n#if defined(__i386__) || defined(_M_IX86)\n #define __V_x86 1\n #undef __V_architecture\n #define __V_architecture 6\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n #if defined(__MINGW32__) || defined(__MINGW64__)\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_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 :